Program for master file maintenance , COBOL Programming

Assignment Help:

PROGRAM FOR MASTER FILE MAINTENANCE:

We have to write a program to keep the stu-file for which a record has just 2 fields,viz., rno(Roll Number) and name(Student Name). Give the provisions to add, modify, delete the records in the file

identification division.

  program- id.

  environment division.

  input-output section.

  file-control.

    select stu- file assign to disk

    organization is indexed

    access mode is random

    record key is rno

    file status is fs.

  data division.

  file section.

  fd stu- file

    label records are standard

    value of file- id is "stu.dat".

  01 stu-rec.

    02 rno pic 9(3).

    02 name pic x(20).

working-storage section.

01 fs pic x(2) value spaces.

01 ans pic x value space.  

01 ch pic 9 value 0.

procedure division.  

open-para.

  open i-o stu-file.

  if fs = "30"

      open output stu-file

      close stu-file

      open i-o stu-file.

  p-1.

    display(1 1) erase.

    display(3 5) "Main Menu".

    display(5 5) "1 to Add".

    display(7 5) "2 to Modify".

    display(9 5) "3 to Delete".

    display(11 5) "4 to Exit".

    display(13 5) "Your Choice [1..4] : ".

    accept ch.

    if ch < 0 or ch > 4 go to p-1.

    go to add-para modi-para del-para exit-para

      depending on ch.

  add-para.

    display(1 1) erase.

    display(3 5) "Rno : ".

    accept rno.

    display(5 5) "Name : ".

    accept name.

    write stu-rec invalid key display(15 5) "Error!".

    display(20 5) "Continue Add Records [y/n] : ".

    accept ans.

    if ans = "y" go to add-para else go to p-1.

  modi-para.

    display(1 1) erase.

    display(3 5) "Enter Roll no to Modify".

    accept rno.

    read stu- file key is rno 

      invalid key display(13 5) "No Record Found"

            go to c-para.

    display(5 5) "Rno = " rno.

    display(7 5) "Name = " name.

    display(9 5) "Sure to Modify [y/n] : ".

    accept ans.

    if ans  = 'y'

      display(1 1) erase

      display(5 5) "Name : "

      accept name

            rewrite stu-rec.

  c-para.

    display(15 5) "Continue Modification [y/n] : ".

    accept ans.

    if ans = 'y' go to modi-para else go to p-1.

  del-para.

          display(1 1) erase.

    display(3 5) "Enter Roll no to Delete".

    accept rno.

    read stu- file key is rno 

    invalid key display(13 5) "No Record Found"

          go to c-para1.

  display(5 5) "Rno = " rno.

  display(7 5) "Name = " name.

  display(9 5) "Sure to Delete [y/n] : ".

  accept ans.

  if ans  = 'y'

    delete stu- file record.

c-para1.

  display(15 5) "Continue  Deletion  [y/n] : ".

  accept ans.

  if ans = 'y' go to del-para else go to p-1.

exit-para.

  close stu-file.

  stop run.


Related Discussions:- Program for master file maintenance

Programming Assignment, I need help with a COBOL programming assingment. I ...

I need help with a COBOL programming assingment. I have started the program but I need help completing the program. I have 5 errors. Here is the question. 10. Suppose your company

Program for indexed sequential file creation , PROGRAM FOR INDEXED SEQUENTI...

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION: We have to write a program to create an Indexed Sequential File in a dynamic mode for Student particulars. Suppose just 3 fields:

Buffers - file characteristics, Buffers: The Modern computers are able...

Buffers: The Modern computers are able of handling I-O operations independent of the CPU by means of the hardware termed as data channel. For illustration, if two buffers a

File status clause, FILE STATUS clause: This clause has been involved ...

FILE STATUS clause: This clause has been involved in the above syntax for completeness. The ORGANIZATION, REVERSE, ACCESS and STATUS clause can be specified in any order.

If- else statement - cobol programming, IF ... ELSE STATEMENT: We are ...

IF ... ELSE STATEMENT: We are familiar with an easy form of the IF statement. The common form of the IF statement is as shown below: Each of the statement-1 and statem

File description for the relative and indexed files, File Description for t...

File Description for the Relative and Indexed Files: The FD entry for a relative or an indexed file is similar to that of a sequential file. Some compilers do not permit varia

Declarative and file status clause, DECLARATIVE and FILE STATUS Clause: ...

DECLARATIVE and FILE STATUS Clause: The input-output exception condition in the situation of a direct access files can be handled by a declarative procedure in a manner simila

Program for simple perform, PROGRAM FOR SIMPLE PERFORM: We have to wri...

PROGRAM FOR SIMPLE PERFORM: We have to write a program to elaborate simple PERFORM statement Identification division. Program- id.  Perf1. Environment division. Da

Example of add verb, Example of add verb: (a) ADD A TO B. This illu...

Example of add verb: (a) ADD A TO B. This illustration represents that the value of A will be added to the value of B and the result will be stored in B.  The alignment of

Block size - file characteristics , Block Size: The normal practice is...

Block Size: The normal practice is to group a number of consecutive records to form that is termed as a block or a physical record. The number of records in a block is frequen

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd