MOVELOOP Command [ HP ALLBASE/4GL Developer Reference Manual Vol. 2 ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Reference Manual Vol. 2
MOVELOOP Command
The MOVELOOP command repeatedly performs a MOVE operation.
Format
MOVELOOP loop_count {from_data_ref step_factor_1} to_data_ref
{*NULL 0 }
step_factor_2
Window
Parameters
loop_count
A number specifying the number of times that the move is performed.
from_data_ref
The first field containing the data to be copied. It can be any of the
following:
* Literal.
* Master title name.
* Numeric or alphanumeric constant.
* Variable or calculated item.
* Screen field reference.
* Scratch-pad field reference.
* File record field reference.
* Work area field reference.
* Communication area field.
to_data_ref
The first field to which the data is to be copied. It can be any of the
following:
* Variable.
* Screen field reference.
* Scratch-pad field reference.
* File record field reference.
* Work area field reference.
* Cmunication area fields *COUNT(n), *TOTALS(n), or *CROSS(n).
step_factors
The step factors are numbers specifying the increments to be applied to
the from and to data reference names to obtain the data reference names
for the next loop of the command. You can use different step factors for
the from data reference and the to data reference.
The step factors may be a positive or negative number, or zero.
The increments are applied to the data reference names and not to their
values. This enables successive fields on a screen or file record to be
moved.
A zero step factor causes the same data reference to be used in each
successive loop of the command. You must use a zero step factor with the
following:
* Numeric or alphanumeric constant.
* Literal.
* Variable or calculated item.
* Master title name.
* Any communication area field other than *TOTALS, *COUNT, or
*CROSS.
* The command argument *NULL.
Description
The MOVELOOP command repeatedly copies the contents of fields between a
number of consecutive fields. The fields do not need to be adjacent.
The MOVELOOP command operates in a similar manner to the MOVE command
except that the field move is repeated for each occurrence of the
loop_count. In the MOVELOOP command, from_data_ref and to_data_ref
incorporate a step factor.
The step factor determines the operand to be moved on each successive
iteration of the loop.
If one of the data references for the MOVELOOP command is a file record
field reference, or a work area field reference, HP ALLBASE/4GL steps
through fields in the file record buffer or work area buffer according to
the defined step factor. HP ALLBASE/4GL will also step through
successive occurrences of fields defined in the dictionary as having more
than one occurrence.
The MOVELOOP loop_count *NULL to_data_ref form of the command sets the
indicator variable associated with to_data_ref to the null status and
fills the field with the pad character. You can only use this form of
the move command if the to_data_ref is a select list field or an HP
ALLBASE/SQL table field.
Example 1
MOVELOOP 16 "0" 0 *TOTALS(1) 1
This command is performed 16 times. Each time, it moves the value zero
into the next *TOTALS communication area field starting at *TOTALS(1).
This command initializes the 16 *TOTALS fields.
Example 2
MOVELOOP 23 F-key.stock.buf1 1 F-key.stock.buf2 1
This command moves the 23 fields from the record buffer buf1 of the KSAM
file stock into the record buffer buf2 of the same file. The move starts
with the field key which occurs in each record.
Example 3
MOVELOOP 5 * 2 *COUNT(1) 1
This command moves five fields from the current screen, starting with the
current screen field, into the five *COUNT communication area fields.
The command only moves every second screen field.
MPE/iX 5.0 Documentation