Hi at all
I have a problem when I try to rewrtie to a sequential file. I get always this error message: IGYPS2074-S "OUTPUT-FILE" was defined as a type that was invalid in this context.
Program-Code:
CBL LIB,QUOTE,OPT
************************************************
** Counter - Read a file and count the words in
** this file.
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COUNTER.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE
ASSIGN TO INFILE
FILE STATUS IS INPUT-FILE-STATUS.
SELECT OUTPUT-FILE
ASSIGN TO OUTFILE
* ORGANIZATION IS SEQUENTIAL
* ACCESS MODE IS SEQUENTIAL
* ACCESS MODE IS DYNAMIC
FILE STATUS IS OUTPUT-FILE-STATUS.
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE
RECORDING MODE IS F.
01 INPUT-RECORD.
05 TEXT-STRING PIC X(80).
FD OUTPUT-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 80 CHARACTERS.
01 OUTPUT-RECORD.
05 TEXT-STRING PIC X(80).
WORKING-STORAGE SECTION.
77 INPUT-FILE-STATUS PIC XX VALUE "00".
88 EOF-EIN VALUE "10".
77 OUTPUT-FILE-STATUS PIC XX VALUE "00".
88 EOF-OUT VALUE "10".
01 WORD-COUNT PIC 9(8) VALUE 0.
01 C-COUNT PIC 9(8) VALUE 0.
01 DELIM PIC X(1) VALUE " ".
01 T-REC PIC X(80).
01 TEMP-REC PIC X(80).
01 I PIC 9(09) USAGE BINARY.
01 TARGET-AREA.
02 INDIVIDUAL-CHAR OCCURS 1 TO 1000 TIMES DEPENDING ON
C-COUNT PIC X VALUE " ".
PROCEDURE DIVISION.
OPEN-OUTPUT.
OPEN I-O OUTPUT-FILE.
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
READ OUTPUT-FILE INTO TEMP-REC
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
DISPLAY "TEMP-REC : " TEMP-REC
PERFORM UNTIL EOF-OUT
REWRITE OUTPUT-FILE FROM TEMP-REC
READ OUTPUT-FILE INTO TEMP-REC
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
END-PERFORM
CLOSE OUTPUT-FILE
GOBACK.
END PROGRAM COUNTER.
Some one now this problem?
Thanks
I have a problem when I try to rewrtie to a sequential file. I get always this error message: IGYPS2074-S "OUTPUT-FILE" was defined as a type that was invalid in this context.
Program-Code:
CBL LIB,QUOTE,OPT
************************************************
** Counter - Read a file and count the words in
** this file.
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. COUNTER.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT INPUT-FILE
ASSIGN TO INFILE
FILE STATUS IS INPUT-FILE-STATUS.
SELECT OUTPUT-FILE
ASSIGN TO OUTFILE
* ORGANIZATION IS SEQUENTIAL
* ACCESS MODE IS SEQUENTIAL
* ACCESS MODE IS DYNAMIC
FILE STATUS IS OUTPUT-FILE-STATUS.
DATA DIVISION.
FILE SECTION.
FD INPUT-FILE
RECORDING MODE IS F.
01 INPUT-RECORD.
05 TEXT-STRING PIC X(80).
FD OUTPUT-FILE
RECORDING MODE IS F
BLOCK CONTAINS 0 RECORDS
RECORD CONTAINS 80 CHARACTERS.
01 OUTPUT-RECORD.
05 TEXT-STRING PIC X(80).
WORKING-STORAGE SECTION.
77 INPUT-FILE-STATUS PIC XX VALUE "00".
88 EOF-EIN VALUE "10".
77 OUTPUT-FILE-STATUS PIC XX VALUE "00".
88 EOF-OUT VALUE "10".
01 WORD-COUNT PIC 9(8) VALUE 0.
01 C-COUNT PIC 9(8) VALUE 0.
01 DELIM PIC X(1) VALUE " ".
01 T-REC PIC X(80).
01 TEMP-REC PIC X(80).
01 I PIC 9(09) USAGE BINARY.
01 TARGET-AREA.
02 INDIVIDUAL-CHAR OCCURS 1 TO 1000 TIMES DEPENDING ON
C-COUNT PIC X VALUE " ".
PROCEDURE DIVISION.
OPEN-OUTPUT.
OPEN I-O OUTPUT-FILE.
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
READ OUTPUT-FILE INTO TEMP-REC
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
DISPLAY "TEMP-REC : " TEMP-REC
PERFORM UNTIL EOF-OUT
REWRITE OUTPUT-FILE FROM TEMP-REC
READ OUTPUT-FILE INTO TEMP-REC
DISPLAY "OUTPUT-FILE-SATUS : " OUTPUT-FILE-STATUS
END-PERFORM
CLOSE OUTPUT-FILE
GOBACK.
END PROGRAM COUNTER.
Some one now this problem?
Thanks