Page 2 of 2

Re: input and output file description.

PostPosted: Mon May 17, 2010 12:57 am
by dhoomphatash
sure will do that....tomorrow!

Re: input and output file description.

PostPosted: Mon May 17, 2010 8:23 pm
by dhoomphatash
IDENTIFICATION DIVISION.       
PROGRAM-ID. CASE3.             
ENVIRONMENT DIVISION.           
INPUT-OUTPUT SECTION.           
FILE-CONTROL.                   
    SELECT FILE1 ASSIGN TO DD1 
    ORGANIZATION IS SEQUENTIAL 
    ACCESS MODE IS SEQUENTIAL. 
    SELECT FILE2 ASSIGN TO DD2 
    ORGANIZATION IS SEQUENTIAL 
    ACCESS MODE IS SEQUENTIAL. 
DATA DIVISION.                 
FILE SECTION.                   
FD FILE1.                       
01 FILE1-REC.                   
   05 FS-BILL-NO PIC X(5).     
    05 FILLER PIC X.                 
    05 FS-BILL-DATE PIC X(8).       
    05 FILLER PIC X.                 
    05 FS-CUST-ID PIC X(5).         
    05 FILLER PIC X. 
*########note this#########               
    05 FS-BILL-AMOUNT PIC 9(4)V99.   
    05 FILLER PIC X(53).             
 FD FILE2.                           
 01 FILE2-REC.                       
    05 FS-BILL-NO1 PIC X(5).         
    05 FILLER PIC X(18).             
    05 FS-BILL-DATE1 PIC X(8).       
    05 FILLER PIC X(19).             
    05 FS-CUST-ID1 PIC X(5).         
    05 FILLER PIC X(19).
*####### note this#########             
    05 FS-BILL-AMOUNT1 PIC 9(4)V99.
 WORKING-STORAGE SECTION.                       
 01 WS-DATA-END PIC X(3) VALUE "YES".           
 PROCEDURE DIVISION.                           
       PERFORM OPEN-PARA THRU OPEN-PARA-END.   
       PERFORM READ-PARA THRU READ-PARA-END     
       UNTIL WS-DATA-END = 'NO'.               
       CLOSE FILE1 FILE2.                       
       STOP RUN.                               
 OPEN-PARA.                                     
       OPEN INPUT FILE1                         
            OUTPUT FILE2.                       
 OPEN-PARA-END.                                 
 READ-PARA.                                     
        READ FILE1                             
*       PERFORM PRINT-PARA THRU PRINT-PARA-END.
        AT END MOVE 'NO' TO WS-DATA-END.       
         IF WS-DATA-END NOT = 'NO'                 
         PERFORM PRINT-PARA THROUGH PRINT-PARA-END 
         ELSE                                       
         GOBACK                                     
         END-IF.                                   
  READ-PARA-END.                                   
  PRINT-PARA.                                       
       MOVE FS-BILL-NO TO FS-BILL-NO1.             
       MOVE FS-BILL-DATE TO FS-BILL-DATE1.         
       MOVE FS-CUST-ID TO FS-CUST-ID1.             
       MOVE FS-BILL-AMOUNT TO FS-BILL-AMOUNT1.     
       WRITE FILE2-REC.                             
  PRINT-PARA-END.                                   
       EXIT.   




input file was(b is for blank)

 12345b10/05/10b98765b4321.54
 23456b10/10/76b43219b4536.71


                                     

Re: input and output file description.

PostPosted: Mon May 17, 2010 11:54 pm
by dick scherrer
Thank you :)

Hopefully, you realize that the file CLOSEs and the STOP RUN will never be executed. . .

d

Re: input and output file description.

PostPosted: Wed May 19, 2010 12:31 am
by dhoomphatash
yep... there are still some errors in the code. like the input. but as I am new to mainframe so, I guess i need a bit more time to get the hang of it. :?

Re: input and output file description.

PostPosted: Wed May 19, 2010 1:14 am
by dick scherrer
Hello,

Someone will be here when there are questions :)

d