MOVE ALL
|
TO |
[UNTIL
operand7] * |
* The UNTIL
option is not allowed when a
SUBSTRING
clause is used for the target operand.
This document covers the following topics:
For an explanation of the symbols used in the syntax diagrams below, see Syntax Symbols.
Related Statements: ADD
| COMPRESS
|
COMPUTE
|
DIVIDE
|
EXAMINE
|
MOVE
|
MULTIPLY
|
RESET
|
SEPARATE
|
SUBTRACT
Belongs to Function Group: Arithmetic and Data Movement Operations
The MOVE ALL
statement enables you to move repeatedly the
content of operand1
to
operand2
until the complete target
field is full or the UNTIL
value
(operand7
) is reached.
Using a SUBSTRING
Clause, you may limit the MOVE ALL
operation to just
segments of the source and target field.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1
|
C | S | A | A | U | N1 | B | yes | no | |||||||||||
operand2
|
S | A | A | U | B | yes | yes | |||||||||||||
operand3
|
C | S | N | P | I | B2 | yes | no | ||||||||||||
operand4
|
C | S | N | P | I | B2 | yes | no | ||||||||||||
operand5
|
C | S | N | P | I | B2 | yes | no | ||||||||||||
operand6
|
C | S | N | P | I | B2 | yes | no | ||||||||||||
operand7
|
C | S | N | P | I | yes | no |
1 A numeric format (N) for
operand1
is permitted only when used
without the SUBSTRING
clause.
2 If
operand3
/operand5
or
operand4
/operand6
is a binary variable, it may be used only with a length of less than or equal
to 4.
Syntax Element Description:
Syntax Element | Description | ||
---|---|---|---|
operand1
|
Source Operand:
The source operand contains the value to be moved. All digits of a numeric operand including leading zeros are moved |
||
TO
operand2
|
Target Operand:
The target operand is not reset before the execution of the
|
||
UNTIL operand7
|
UNTIL Option:
The If The For general information on dynamic variables, see Usage of Dynamic Variables. Note: |
||
SUBSTRING |
SUBSTRING Clause:
The
If If
See also Examples of SUBSTRING Clause Usage below. |
DEFINE DATA LOCAL 1 ALFA (A10) INIT <'AAAAAAAAAA'> 1 DYN (A) DYNAMIC INIT <'1234567890'> 1 #VAL (A4) INIT <'1234'> END-DEFINE
Statement
|
Result
|
|
Before
|
After
|
|
MOVE ALL SUBSTRING (#VAL,1,2) TO
ALFA |
AAAAAAAAAA |
1212121212 |
MOVE ALL '123' TO SUBSTRING
(ALFA,3,5) |
AAAAAAAAAA |
AA12312AAA |
MOVE ALL 'x' TO SUBSTRING
(DYN,7,3) |
1234567890
(*LENGTH =10 )
|
123456xxx0
(*LENGTH =10 )
|
MOVE ALL 'xyz' TO SUBSTRING
(DYN,7,6) |
1234567890
(*LENGTH =10 )
|
123456xyzxyz
(*LENGTH =12 )
|
MOVE ALL 'xyz' TO SUBSTRING
(DYN,11,4) |
1234567890
(*LENGTH =10 )
|
1234567890xyzx
(*LENGTH =14 )
|
** Example 'MOAEX1': MOVE ALL ************************************************************************ DEFINE DATA LOCAL 1 EMPLOY-VIEW VIEW OF EMPLOYEES 2 PERSONNEL-ID 2 FIRST-NAME 2 NAME 2 CITY 1 VEH-VIEW VIEW OF VEHICLES 2 PERSONNEL-ID 2 MAKE END-DEFINE * LIMIT 4 RD. READ EMPLOY-VIEW BY NAME SUSPEND IDENTICAL SUPPRESS /* FD. FIND VEH-VIEW WITH PERSONNEL-ID = PERSONNEL-ID (RD.) IF NO RECORDS FOUND MOVE ALL '*' TO FIRST-NAME (RD.) MOVE ALL '*' TO CITY (RD.) MOVE ALL '*' TO MAKE (FD.) END-NOREC /* DISPLAY NOTITLE (ES=OFF IS=ON ZP=ON AL=15) NAME (RD.) FIRST-NAME (RD.) CITY (RD.) MAKE (FD.) (IS=OFF) /* END-FIND END-READ END
NAME FIRST-NAME CITY MAKE --------------- --------------- --------------- --------------- ABELLAN *************** *************** *************** ACHIESON ROBERT DERBY FORD ADAM *************** *************** *************** ADKINSON JEFF BROOKLYN GENERAL MOTORS