Chapter 6. Moving Data, Printing Information, and Displaying Output Interactively

OBJECTIVES

To familiarize you with

  1. The various options of the MOVE statement.

  2. The rules for moving fields and literals.

  3. How to print decimal points, dollar signs, and other edit symbols.

  4. How to design and print reports.

INTRODUCTION

The MOVE statement has the following components:

INTRODUCTION

Every COBOL statement in the PROCEDURE DIVISION, like every English sentence, must contain a verb. A COBOL statement usually starts with a verb. In the preceding, MOVE is the verb. The identifier or data-name AMT-IN is called the sending field. The contents of AMT-IN will be transmitted or copied to the second field, AMT-OUT, as a result of the MOVE operation. AMT-OUT is called the receiving field. The contents of AMT-OUT will be replaced by the contents of AMT-IN when the MOVE operation is executed. AMT-IN will remain unchanged.

The MOVE statement, like all COBOL imperative statements, appears in the PROCEDURE DIVISION. AMT-IN and AMT-OUT are identifiers defined in the DATA DIVISION. You will recall that elementary items in the DATA DIVISION require PICTURE or PIC clauses to indicate (1) the type of data in the field (numeric, alphanumeric, or alphabetic) and (2) the size of the field. To perform a MOVE operation that replaces the contents of AMT-OUT with the very same contents as AMT-IN, the PICTURE clauses of both fields must be ...

Get COBOL for the 21st Century now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.