Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

PROGRAM FOR READ CUSTOMERS DATA FROM INPUT-FILE AND MOVE INTO OUTPUT-FILE

Posted By: Sean Brown     Category: Cobol     Views: 5627

PROGRAM FOR READ CUSTOMERS DATA FROM INPUT-FILE AND MOVE INTO OUTPUT-FILE.

Code for PROGRAM FOR READ CUSTOMERS DATA FROM INPUT-FILE AND MOVE INTO OUTPUT-FILE in Cobol

       identification division.
       program-id. test.
       environment division.
       configuration section.
       input-output section.
       file-control.
       select in-file assign to disk
       organization is line sequential.

       select out-file assign to disk
       organization is line sequential.

       data division.

       file section.

       fd in-file
       label records are standard
       value of file-id is"ex12in.txt".
       01 in-rec.
       03 cust-no-in pic 999.
       03 amt1-in pic 999.
       03 amt2-in pic 999.
       03 amt3-in pic 999.

       fd out-file
       label records are standard
       value of file-id is"ex12out.txt".
       01 out-rec pic x(80).

       working-storage section.

       77 eof pic x value'n'.

       01 h0.
       03 F PIC X(25) VALUE ALL SPACES.
       03 f pic x(15) value"CUSTOMER RECORD".
       01 h1.
       03 f pic x(80) value all "~".
       01 h2.
       03 f pic x(5) value spaces.
       03 f pic x(11) value"CUSTOMER-NO".
       03 f pic x(5) value spaces.
       03 f pic x(9) value"TOTAL-AMT".
       01 h3.
       03 f pic x(7) value spaces.
       03 s1 pic 999.
       03 f pic x(11) value spaces.
       03 s2 pic z(6).
       77 total pic 9(6).
       procedure division.
       main-para.
       open input in-file.
       open output out-file.

       write out-rec from h1.
       write out-rec from h0.
       write out-rec from h1.
       write out-rec from h2.
       write out-rec from h1.

       read in-file at end move 'y' to eof.
       perform p-para until eof = 'y'.

       close in-file out-file.
       stop run.
       p-para.
       move cust-no-in to s1.
       compute total =  amt1-in + amt2-in + amt3-in.
       move total to s2.
       write out-rec from h3.
       read in-file at end move 'y' to eof.
  
Share: 



Sean Brown
Sean Brown author of PROGRAM FOR READ CUSTOMERS DATA FROM INPUT-FILE AND MOVE INTO OUTPUT-FILE is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!