Chapter 6. MOVING DATA AND TEXT MANIPULATION
Upon completion of this chapter, you should be able to
Demonstrate the various options of the MOVE statement.
Explain the rules for moving numeric and alphanumeric fields and literals.
Demonstrate how text can be manipulated with the STRING statement.
THE INSTRUCTION FORMATS OF THE MOVE STATEMENT
The two instruction formats for the MOVE statement are
Either a data field (identifier-1 in Format 1) or a literal (literal-1 in Format 2) may be used as a sending field. The receiving field must be a data-field (identifier-2). Uppercase words like MOVE and TO are reserved words. Because they are underlined, they are required in the statement. The ellipses, or dots, at the end of the statements mean that one sending field can be moved to numerous receiving fields.
In Format 1, identifier-1 and identifier-2 are data-fields that are defined in the DATA DIVISION.
In Format 2, a literal is used as the sending field. Although identifiers are defined in the DATA DIVISION, literals may be used directly in the PROCEDURE DIVISION. Assuming an appropriate PICTURE clause in the receiving field, the exact content or value of the literal is moved to the receiving field. Keep in mind that the receiving field of any MOVE instruction must always be a data-field, never a literal.
The MOVE statement has these components:
Every COBOL statement in the PROCEDURE ...