I am trying to write a cobol program to read a file and increment the contents and write back to the same file, I am
trying to increment the first 4 bytes and write back the 4 bytes and the filler of 76.
Here is the code:
SPECIAL-NAMES.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATE-FILE ASSIGN TO DISDATE.
DATA DIVISION.
FILE SECTION.
FD DATE-FILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.
01 DATE-REC PIC X(80).
WORKING-STORAGE SECTION.
01 DATE-RECORD.
05 GWD-WEEK PIC 9(4).
05 FILLER PIC X(76).
01 HOLD-AREA.
05 END-READ-FLAG PIC X(03) VALUE 'YES'.
05 LINES-CTR PIC 9(09) VALUE ZEROES.
PROCEDURE DIVISION.
0001-MAIN.
OPEN I-O DATE-FILE.
PERFORM 3000-READ-DATE UNTIL
END-READ-FLAG = 'NO '.
CLOSE DATE-FILE.
DISPLAY 'ALL RECORDS = ' , LINES-CTR
STOP RUN.
3000-READ-DATE.
READ DATE-FILE INTO DATE-RECORD
AT END MOVE 'NO ' TO END-READ-FLAG
END-READ.
IF END-READ-FLAG = 'YES'
PERFORM 3000-INCREMENT-DATE
END-IF.
3000-INCREMENT-DATE.
INITIALIZE DATE-RECORD.
ADD +1 TO GWD-WEEK.
WRITE DATE-REC FROM DATE-RECORD.
The following error occurs when trying to run:
+IGZ020I A user logic error occurred. Neither FILE STATUS nor a
+ declarative was specified for file 'DISDATE' in program 'ADD1'
+ at relative location X'0308'. The I-O status code was '48'.
NoteISDATE is allocated in my proc as the 80 character file with the date in the first 4 positions.
Thanks
trying to increment the first 4 bytes and write back the 4 bytes and the filler of 76.
Here is the code:
SPECIAL-NAMES.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT DATE-FILE ASSIGN TO DISDATE.
DATA DIVISION.
FILE SECTION.
FD DATE-FILE
LABEL RECORDS ARE STANDARD
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS.
01 DATE-REC PIC X(80).
WORKING-STORAGE SECTION.
01 DATE-RECORD.
05 GWD-WEEK PIC 9(4).
05 FILLER PIC X(76).
01 HOLD-AREA.
05 END-READ-FLAG PIC X(03) VALUE 'YES'.
05 LINES-CTR PIC 9(09) VALUE ZEROES.
PROCEDURE DIVISION.
0001-MAIN.
OPEN I-O DATE-FILE.
PERFORM 3000-READ-DATE UNTIL
END-READ-FLAG = 'NO '.
CLOSE DATE-FILE.
DISPLAY 'ALL RECORDS = ' , LINES-CTR
STOP RUN.
3000-READ-DATE.
READ DATE-FILE INTO DATE-RECORD
AT END MOVE 'NO ' TO END-READ-FLAG
END-READ.
IF END-READ-FLAG = 'YES'
PERFORM 3000-INCREMENT-DATE
END-IF.
3000-INCREMENT-DATE.
INITIALIZE DATE-RECORD.
ADD +1 TO GWD-WEEK.
WRITE DATE-REC FROM DATE-RECORD.
The following error occurs when trying to run:
+IGZ020I A user logic error occurred. Neither FILE STATUS nor a
+ declarative was specified for file 'DISDATE' in program 'ADD1'
+ at relative location X'0308'. The I-O status code was '48'.
NoteISDATE is allocated in my proc as the 80 character file with the date in the first 4 positions.
Thanks