Application programming on z/OS
|
Previous topic |
Next topic |
Contents |
Glossary |
Contact z/OS |
PDF
COBOL program format Application programming on z/OS |
|
|
With the exception of the COPY and REPLACE statements and the end program marker, the statements, entries, paragraphs, and sections of a COBOL source program are grouped into four divisions.
Example of COBOL divisions Figure 1. IDENTIFICATION DIVISION
IDENTIFICATION DIVISION. Program-ID. Helloprog. Author. A. Programmer. Installation. Computing Laboratories. Date-Written. 08/21/2002. Example of input-output coding Figure 2. ENVIRONMENT DIVISION
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. computer-name.
OBJECT-COMPUTER. computer-name.
SPECIAL-NAMES.
special-names-entries.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT [OPTIONAL] file-name-1
ASSIGN TO system-name [FOR MULTIPLE {REEL | UNIT}]
[.... .
I-O-CONTROL.
SAME [RECORD] AREA FOR file-name-1 ... file-name-n.
Explanations of the user-supplied information follow Figure 3.
Figure 3. Input and output files
in FILE-CONTROL
IDENTIFICATION DIVISION.
. . .
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT filename ASSIGN TO assignment-name
ORGANIZATION IS org ACCESS MODE IS access
FILE STATUS IS file-status
. . .
DATA DIVISION.
FILE SECTION.
FD filename
01 recordname
nn . . . fieldlength & type
nn . . . fieldlength & type
. . .
WORKING-STORAGE SECTION
01 file-status PICTURE 99.
. . .
PROCEDURE DIVISION.
. . .
OPEN iomode filename
. . .
READ filename
. . .
WRITE recordname
. . .
CLOSE filename
. . .
STOP RUN.
|
Copyright IBM Corporation 1990, 2010 |