- 1). Type "Edit" on the z/OS360 mainframe system-management console and press the "Enter" key to edit your COBOL program.
- 2). Add the following code to the beginning of your program:
IDENTIFICATION DIVISION.
PROGRAM-ID. COBVAR.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT IFILE ASSIGN TO "IFILE".
DATA DIVISION.
FILE SECTION.
FD IFILE
RECORD IS VARYING FROM 10 TO 50 DEPENDING ON LEN.
01 IREC.
05 FILLER PIC X OCCURS 10 TO 50 TIMES DEPENDING ON LEN.
PROCEDURE DIVISION.
P1.
DISPLAY "EXAMPLE 1 OCCURS DEPENDING ON REC"
OPEN INPUT IFILE
PERFORM UNTIL LEN = -1
READ IFILE
AT END MOVE -1 TO LEN
NOT AT END
DISPLAY IREC
DISPLAY LEN
END-READ
END-PERFORM
CLOSE IFILE
DISPLAY SPACE
DISPLAY "EXAMPLE FIXED REC"
OPEN INPUT IFILE
MOVE ALL "X" TO IREC
READ IFILE AT END MOVE -1 TO LEN
DISPLAY IREC
DISPLAY SPACE - 3). Type "Save" on the console and press the "Enter" key to enable your program to process variable-length records.
SHARE