Chapter 3. DEFINING FILES AND PROCESSING DATA
Upon completion of this chapter, you should be able to
Explain the purpose of the DATA DIVISION.
Demonstrate how program-described files are defined in the DATA DIVISION.
Explain the purpose of the WORKING-STORAGE SECTION.
Explain the purpose of the PROCEDURE DIVISION.
Explain the purpose of the statements typically coded in the main module of a program.
Explain the purpose of the statements used for end-of-file processing.
Explain the purpose of the MOVE and WRITE statements.
Demonstrate the use of externally described physical files in programs.
SPECIFYING ARRIVAL SEQUENCE AND KEYED SEQUENCE FILES FOR PROCESSING
As mentioned in Chapter 2, the FILE-CONTROL paragraph of the INPUT-OUTPUT SECTION is used to assign the input and output files in the program. Every file used by the program must be defined using a SELECT statement in the FILE-CONTROL paragraph.
THE SELECT STATEMENT
The SELECT statement selects a file for processing by defining a system file-name and assigning a COBOL file-name to that file. The COBOL file-name is referenced in the DATA DIVISION to designate the input or output area to be used by the file. It is also referenced in the PROCEDURE DIVISION to access the file and must be correctly specified throughout the program.
The instruction format for a SELECT statement is
SELECT statements are specified ...