Skip to Main Content
PROGRAMMING IN COBOL/400: 2nd Edition
book

PROGRAMMING IN COBOL/400: 2nd Edition

by James Cooper, Nancy Stern, Robert A. Stern
January 2002
Intermediate to advanced content levelIntermediate to advanced
736 pages
18h 57m
English
Wiley
Content preview from PROGRAMMING IN COBOL/400: 2nd Edition

Chapter 6. MOVING DATA AND TEXT MANIPULATION

CHAPTER OBJECTIVES

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

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Designing and Programming CICS Applications

Designing and Programming CICS Applications

John Horswill, Members of the CICS Development Team at IBM Hursley

Publisher Resources

ISBN: 9780471418467Purchase book