input and output file description.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: input and output file description.

Postby dhoomphatash » Mon May 17, 2010 12:57 am

sure will do that....tomorrow!
dhoomphatash
 
Posts: 10
Joined: Sat May 15, 2010 2:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: input and output file description.

Postby dhoomphatash » Mon May 17, 2010 8:23 pm

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


                                     
dhoomphatash
 
Posts: 10
Joined: Sat May 15, 2010 2:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: input and output file description.

Postby dick scherrer » Mon May 17, 2010 11:54 pm

Thank you :)

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

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: input and output file description.

Postby dhoomphatash » Wed May 19, 2010 12:31 am

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. :?
dhoomphatash
 
Posts: 10
Joined: Sat May 15, 2010 2:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: input and output file description.

Postby dick scherrer » Wed May 19, 2010 1:14 am

Hello,

Someone will be here when there are questions :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Previous

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post