LINKLOOP Command [ HP ALLBASE/4GL Developer Reference Manual Vol. 2 ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Reference Manual Vol. 2
LINKLOOP Command
The LINKLOOP command concatenates a series of fields.
Formats
LINKLOOP [*JOINER=joiner] loop_count link_data_ref step_factor
result_data_ref
Window
Parameters
loop_count
A number specifying the number of fields to be concatenated. The loop
count must be a value greater than or equal to 2.
link_data_ref
The name of the first field to be linked in the loop. Enter one of the
following:
* A literal.
* A numeric or alphanumeric constant.
* A variable or calculated item.
* A master title name.
* A screen field reference.
* A scratch-pad field reference.
* A file record field reference.
* A work area field reference.
* A communication area field.
step_factor
A number specifying the increment applied to the link_data_ref name to
obtain the next data reference which is linked on each successive loop of
the command.
The step factor may be a positive or negative number.
The increment is applied to the name and not to its value. This enables
successive, but not necessarily consecutive, fields to be linked.
You must use a zero step factor if the link_data_ref is a constant, a
literal, a master title, a variable, a calculated item, or a
communication area field other than *COUNT(n), *CROSS(n), or *TOTALS(n).
result_data_ref
The field where the result of the link is placed. Enter one of the
following:
* A variable.
* A screen field reference.
* A scratch-pad field reference.
* A file record field reference.
* A work area field reference.
* The communication area field *PASS.
joiner
The data used to separate each of the link_count fields. The joiner is
optional but, if specified, must be preceded by the argument *JOINER=.
Enter the joiner into the Joiner field on the window.
The joiner may be one of the following:
* A literal.
* A numeric or alphanumeric constant.
* A variable or calculated item.
* A master title name.
* A screen field reference.
* A scratch-pad field reference.
* A file record field reference.
* A work area field reference.
* A communication area field.
Description
The LINKLOOP command concatenates (links or joins together) successive
fields.
The LINKLOOP command operates in a similar manner to the LINK command in
the way it concatenates fields. Unlike the LINK command however, you
don't need to specify each field to be concatenated explicitly. You only
need to specify the first field.
The loop_count specifies the number of fields starting from and including
the link_data_ref to be concatenated in the result_data_ref. The
loop-count must be greater than or equal to 2. That is, at least two
fields must be linked together.
The step_factor determines, on each successive iteration of the loop, the
next field to be linked. If the link_data_ref is a file record field
reference or a work area field reference, HP ALLBASE/4GL links successive
fields on the record depending on the step factor. HP ALLBASE/4GL also
steps through the multiple occurrences of fields defined as having
multiple occurrences in the dictionary.
Example 1
LINKLOOP *JOINER="/" 3 * 1 F-date.stock
This command concatenates the current screen field and the next two
screen fields. The command separates each field with the character /,
and places the result into the field date on the file stock. This
operation could be picking up three fields on the screen, representing
the month, day, and year, formatting them as a date, and then saving the
date in the file buffer.
Example 2
LINKLOOP 4 *S03 2 *P01
This command links four fields, starting with screen field number 3 on
the current screen. The command links every second field (that is,
fields *S03, *S05, *S07, and *S09) and places the result into scratch-pad
field *P01.
MPE/iX 5.0 Documentation