MOVE command (COBOL)
The MOVE command transfers data from one area of storage to another. The keywords cannot be abbreviated.
>>-MOVE--+-reference-+--TO--reference--;----------------------->< '-literal---'
- reference
- A valid Debug Tool COBOL reference.
- literal
- A valid COBOL literal.
Usage notes
- For Enterprise COBOL for z/OS® Version 5, you can use the MOVE command
to update the following special registers:
JNIENVPTR SHIFT-IN SHIFT-OUT LINAGE-COUNTER of <FD>
- For Enterprise COBOL for z/OS Version 5, you can use the MOVE command to update a numerical type with a non-numerical character. For example: "Move "-999999909" to Znumed" where Znumed is defined as "01 Znumed pic -9,999.909".
- If Debug Tool was started because of a computational condition or an attention interrupt, using an assignment to set a variable might not give expected results. This is due to the uncertainty of variable values within statements as opposed to their values at statement boundaries.
- MOVE assigns a value only to a single receiver; unlike COBOL, multiple receiver variables are not supported.
- The COBOL CORRESPONDING phrase is not supported.
- MOVE does not support date windowing. Therefore, you cannot use the MOVE command to assign the value of a windowed date field to an expanded date field or to a nondate field.
- You cannot use the MOVE command to assign the
value of one expanded date field to another expanded date field with
a different DATE FORMAT clause, or to assign the value of one windowed
date field to another windowed date field with a different DATE FORMAT
clause.
Enterprise COBOL for z/OS Version 5 compiler does not support the DATE FORMAT clause. Additional information on the DATE FORMAT clause and other clauses no longer available can be found in Enterprise COBOL for z/OS Migration Guide Version 5 Release 1.
- If the DATA parameter of the PLAYBACK ENABLE command is in effect for the current compile unit, the MOVE command can be used while you replay recorded statements by using the PLAYBACK commands. The target of the MOVE command must be a session variable, not a program variable.
- If you are debugging an optimized COBOL program, you can use the MOVE command to assign a value to a program variable only if you first enter the SET WARNING OFF command.
- If you are debugging a COBOL program that was compiled with the OPTIMIZE compiler option, neither operand of the MOVE command can be a variable that was discarded by the optimizer.
- If a COBOL variable defined as National is used as the receiving field in a MOVE command with an alphabetic or alphanumeric operand, the operand that is not National is converted to Unicode before that move is done, except for Group items. See Enterprise COBOL for z/OS Language Reference for more information about using COBOL variables with the MOVE statement.
- Literals with an N or NX prefix are always treated as National data and can be moved only to other National Data Items or Group items.
Examples
- Move the string constant "Hi There" to the variable field.
MOVE "Hi There" TO field;
- Move the value of session variable temp to the
variable b.
MOVE temp TO b;
- To assign a new value
to a DBCS variable when the current programming language is COBOL,
enter the following command in the Command/Log window.
MOVE G"D B C S V A L U E"
- Assign to the program variable c, found in structure d,
the value of the program variable a, found in structure b.
Note the qualification used in this example.MOVE a OF b TO c OF d;
- Assign the value of 123 to the first table element of itm-2.
MOVE 123 TO itm-2(1,1);
- You can also use reference modification to assign values to variables
as shown in the following two examples.
andMOVE aa(2:3) TO bb;
MOVE aa TO bb(1:4);
Refer to the following topics for more information related to the material discussed in this topic.
- Related tasks
- Enterprise COBOL for z/OS Programming Guide
- Related references
- Allowable moves for the MOVE command (COBOL)
- SET WARNING command (C, C++, COBOL, and PL/I)