Hello guys,
I need to write a very stupid code to read and write a file. WHERE do I specify the directories where those files are located?
I tried to run the program and it seems I get a "35" error code when I open the files. I am guessing it's because I defined their location in the wrong place. Is there a easy way to do it?
Also don't laugh at my code, it's the first one hahaha
BB IDENTIFICATION DIVISION.
BB ENVIRONMENT DIVISION.
BB CONFIGURATION SECTION.
BB *SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.
BB INPUT-OUTPUT SECTION.
BB FILE-CONTROL.
BB *
BC SELECT EXTIN ASSIGN TO EXTERNAL ENTRADA
BC FILE STATUS IS EXTIN-STATUS.
BC *
BC SELECT EXTOUT ASSIGN TO EXTERNAL SAIDA
BC ORGANIZATION IS LINE SEQUENTIAL
BC FILE STATUS IS EXTOUT-STATUS.
BB DATA DIVISION.
BB FILE SECTION.
BB *
FD EXTIN
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 ENTRADA-REC PIC X(667).
*
FD EXTOUT
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 SAIDA-REC PIC X(667).
CC *
BB WORKING-STORAGE SECTION.
BB 01 W-FILE-STATUS-CODES VALUE ZERO.
BB 03 EXTIN-STATUS PIC XX.
BB 03 EXTOUT-STATUS PIC XX.
BB PROCEDURE DIVISION.
BB *
BB OPEN INPUT EXTIN.
BB OPEN OUTPUT EXTOUT
IF EXTIN-STATUS NOT = '00'
DISPLAY EXTIN-STATUS
GOBACK.
IF EXTOUT-STATUS NOT = '00'
DISPLAY EXTOUT-STATUS
GOBACK.
BB *
BB LER.
BB READ EXTIN INTO ENTRADA-REC AT END
BB CLOSE EXTIN EXTOUT
GO TO FIM.
BB MOVE ENTRADA-REC TO SAIDA-REC
WRITE SAIDA-REC.
BB GO TO LER.
FIM.
GOBACK.
I need to write a very stupid code to read and write a file. WHERE do I specify the directories where those files are located?
I tried to run the program and it seems I get a "35" error code when I open the files. I am guessing it's because I defined their location in the wrong place. Is there a easy way to do it?
Also don't laugh at my code, it's the first one hahaha
BB IDENTIFICATION DIVISION.
BB ENVIRONMENT DIVISION.
BB CONFIGURATION SECTION.
BB *SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.
BB INPUT-OUTPUT SECTION.
BB FILE-CONTROL.
BB *
BC SELECT EXTIN ASSIGN TO EXTERNAL ENTRADA
BC FILE STATUS IS EXTIN-STATUS.
BC *
BC SELECT EXTOUT ASSIGN TO EXTERNAL SAIDA
BC ORGANIZATION IS LINE SEQUENTIAL
BC FILE STATUS IS EXTOUT-STATUS.
BB DATA DIVISION.
BB FILE SECTION.
BB *
FD EXTIN
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 ENTRADA-REC PIC X(667).
*
FD EXTOUT
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS STANDARD
FFS RECORD CONTAINS 667 CHARACTERS.
FFS 01 SAIDA-REC PIC X(667).
CC *
BB WORKING-STORAGE SECTION.
BB 01 W-FILE-STATUS-CODES VALUE ZERO.
BB 03 EXTIN-STATUS PIC XX.
BB 03 EXTOUT-STATUS PIC XX.
BB PROCEDURE DIVISION.
BB *
BB OPEN INPUT EXTIN.
BB OPEN OUTPUT EXTOUT
IF EXTIN-STATUS NOT = '00'
DISPLAY EXTIN-STATUS
GOBACK.
IF EXTOUT-STATUS NOT = '00'
DISPLAY EXTOUT-STATUS
GOBACK.
BB *
BB LER.
BB READ EXTIN INTO ENTRADA-REC AT END
BB CLOSE EXTIN EXTOUT
GO TO FIM.
BB MOVE ENTRADA-REC TO SAIDA-REC
WRITE SAIDA-REC.
BB GO TO LER.
FIM.
GOBACK.