Hello COBOL,
I have a very basic question, pardon my nobienes please
For each execution, the file has only a single record. (previous records are cleared)
Can someone please show me the reason?
Thank You..
I have a very basic question, pardon my nobienes please
For each execution, the file has only a single record. (previous records are cleared)
Can someone please show me the reason?
Code:
IDENTIFICATION DIVISION. PROGRAM-ID. CBL015R. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT WS-DEBTOR ASSIGN TO DEBTOR FILE STATUS IS WS-INFILE-SW. DATA DIVISION. FILE SECTION. FD WS-DEBTOR. 01 INP-DEB-REC. 05 INP-DEBCD PIC 9(06). 05 INP-DEBNM PIC 9(50). WORKING-STORAGE SECTION. 01 WS-INFILE-SW PIC X(02) VALUE SPACES. 88 WS-INFILE-SUCESS VALUE '00'. 88 WS-INFILE-EOF VALUE '10'. 01 WS-INP-DEB-REC. 05 WS-INP-DEBCD PIC 9(06). 05 WS-INP-DEBNM PIC 9(50). 01 WS-EOF-SW PIC X(01) VALUE 'N'. 88 WS-EOF-NO VALUE 'N'. 88 WS-EOF-YES VALUE 'Y'. PROCEDURE DIVISION. MAIN-PARA. PERFORM PARA-1. PERFORM A3000-INPUT-PARA. PERFORM A4000-INSERT-PARA. PERFORM A5000-CLOSE-PARA. STOP RUN. PARA-1. INITIALIZE WS-INFILE-SW WS-INP-DEB-REC WS-EOF-SW. OPEN OUTPUT WS-DEBTOR IF WS-INFILE-SUCESS DISPLAY "FILE OPEN SUCCESSFUL" ELSE DISPLAY "FILE OPENING ERROR" END-IF. A3000-INPUT-PARA. ACCEPT WS-INP-DEBCD. ACCEPT WS-INP-DEBNM. DISPLAY WS-INP-DEBCD WS-INP-DEBNM. A4000-INSERT-PARA. WRITE INP-DEB-REC FROM WS-INP-DEB-REC. A5000-CLOSE-PARA. CLOSE WS-DEBTOR.
Comment