Logo 
Search:

Cobol Articles

Submit Article
Home » Articles » Cobol » Homework HelpRSS Feeds

Program to Describe The Functionality of the Relative File

Posted By: Ava Campbell     Category: Cobol     Views: 1282

Write a Program to Describe The Functionality of the Relative File.

Code for Program to Describe The Functionality of the Relative File in Cobol

       identification division.
       program-id. testing.

       environment division.
       input-output section.
       file-control.
          select emp assign to disk
               organization is relative
               access mode is random
               relative key is empno.


       data division.
       file section.
       fd emp
          value of file-id is"emp.txt".
          01 emp-rec.
               05 empname pic x(10).
               05 empaddr pic x(10).
               05 empphne pic 9(8).


       working-storage section.
          01 empno pic 9(3).
          01 emp-rec1.
               05 empname1 pic x(10).
               05 empaddr1 pic x(10).
               05 empphne1 pic 9(8).

       procedure division.
       para1.
          open i-o emp.
          display "Enter EmpNo.: " with no advancing.
          accept empno.
          display "Name: " with no advancing.
          accept empname1.
          display "Address: " with no advancing.
          accept empaddr1.
          display "Phone no: " with no advancing.
          accept empphne1.
          write emp-rec from emp-rec1 invalid key perform para2.

          close emp.

          open input emp.
               display "Enter the number: " with no advancing.
               accept empno.
               read emp.
               display emp-rec.
          close emp.
          stop run.

       para2.
          display " Invalid Key . . .".
  
Share: 


Didn't find what you were looking for? Find more on Program to Describe The Functionality of the Relative File Or get search suggestion and latest updates.

Ava Campbell
Ava Campbell author of Program to Describe The Functionality of the Relative File is from Toronto, Canada.
 
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!