Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to Accept The Records of Employee and Store the contents in one file and store the records of a particular field in another file

Posted By: Luki Fischer     Category: Cobol     Views: 4229

Program to Accept The Records of Employee and Store the contents in one file and store the records of a particular field in another file identification division.

Code for Program to Accept The Records of Employee and Store the contents in one file and store the records of a particular field in another file in Cobol

       identification division.
       program-id. employee.

       environment division.
       input-output section.
       file-control.
        select emp assign to disk
           organization is line sequential.

        select empn assign to disk
           organization is line sequential.

       data division.
       file section.

       fd emp
           value of file-id is"emp.txt".
       01 emp-rec.
           05 empno pic 9(3).
           05 filler pic x(5).
           05 empname pic x(10).
           05 filler pic x(5).
           05 state pic x(10).
           05 filler pic x(5).
           05 anlsal pic 9(4).

       fd empn
           value of file-id is"empn.txt".
       01 empn-rec pic x(10).
           
       working-storage section.
       01 eof pic x value"n".
       01 emp1-rec.
           05 empno1 pic 9(3).
           05 filler pic x(5).
           05 empname1 pic x(10).
           05 filler pic x(5).
           05 state1 pic x(10).
           05 filler pic x(5).
           05 anlsal1 pic 9(4).

       01 empn1-rec pic x(10).

       procedure division.
       para1.
        open extend emp.
        open extend empn.
        display "Emp No.: " with no advancing.
        accept empno1.
        display "Emp Name: " with no advancing.
        accept empname1.
        display "Emp State: " with no advancing.
        accept state1.
        display "Emp Salary: " with no advancing.
        accept anlsal1.

        move emp1-rec to emp-rec.
        write emp-rec.
        close emp.
        open input emp.
        perform until eof="y"
         read emp
                at end move "y" to eof

                not at end
                      display state
                      move state to empn1-rec
                      move empn1-rec to empn-rec
                      write empn-rec
        end-read
        end-perform.
        close emp.
        close empn.
        stop run.


  
Share: 



Luki Fischer
Luki Fischer author of Program to Accept The Records of Employee and Store the contents in one file and store the records of a particular field in another file is from Frankfurt, Germany.
 
View All Articles

 
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!