Program for indexed sequential file creation , COBOL Programming

Assignment Help:

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: rno(Roll Number), cl (Class) and m(Mark). Read the file and display the records.

identification division.

program- id.

environment division.

input-output section.

file-control.

  select stu- file assign to disk

  organization is indexed

  access mode is dynamic

  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  cl pic x(4).

  02  m  pic 9(3).

working-storage section.

01  ans pic x value space.

01  a-rno pic 9(3) value 0.

01  fs  pic x(2) value spaces.

procedure division.

p-1.

  open i-o  stu-file.

    if fs = "30"

      open output stu-file

      close stu-file

      open i-o stu-file.

  perform g-w-para until ans = 'n'.

  go to p-2.

g-w-para.

  display(1 1) erase.

  display "Enter Data :".

  accept rno.

  accept cl.

  accept m.

  write stu-rec invalid key

      display "Record Exists!".

  display "Continue [y/n] : ".

  accept ans.

p-2.

  display(1 1) erase.

  display(3 5) "Give Roll No : ".

         accept a-rno.

         move a-rno to rno.

  read stu- file  key is rno

    invalid key 

        display(10 5) "No Record Found"

        go to c-para.

    display(5 5) "Rno = " rno.

    display(7 5) "Class = " cl.

    display(9 5) "Mark = " m.

      c-para.

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

    accept ans.

    if ans = 'y' or 'Y' go to p-2.

    close stu-file.

    stop run.


Related Discussions:- Program for indexed sequential file creation

Conditions-name condition, CONDITIONS-NAME CONDITION:   The condition...

CONDITIONS-NAME CONDITION:   The condition name is an entity which itself is a condition and these can have either a true or false value. Though, a condition name cannot be d

Rewrite statement, REWRITE statement: The REWRITE statement is used to...

REWRITE statement: The REWRITE statement is used to update the existing record in a disk file. The normal format is as shown below: REWRIE  record-name  [  FROM      ide

Program for if -else, PROGRAM FOR IF -ELSE: We have to write a program...

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

File- section and working-storage section, File- Section &Working-Storage S...

File- Section &Working-Storage Section: a) FILE SECTION: The FILE SECTION includes the explanation of all data items that must be read from or written onto some external

Compute verb, COMPUTE VERB: The COMPUTE verb is very powerful. All the...

COMPUTE VERB: The COMPUTE verb is very powerful. All the evaluations performed by the other 4 verbs can also be completed easily by using the COMPUTE verb. Its normal format i

Illustration of subtract verb, Illustration of Subtract verb: (a) SUBT...

Illustration of Subtract verb: (a) SUBTRACT A FROM B. This illustration means that the value of A will be subtracted from the value of B and the subtracted result will be s

Perform with until option, PERFORM WITH UNTIL OPTION: The format is as...

PERFORM WITH UNTIL OPTION: The format is as shown below: Illustration:  A) Perform p-3 until i > 5. Here p-3 will be executed whenever i B)  Perform p-2 thru

Merge verb with output procedure, MERGE VERB WITH OUTPUT PROCEDURE: Li...

MERGE VERB WITH OUTPUT PROCEDURE: Like the sort verb, the merge verb can also have an output procedure. The syntax of the MERGE verb is as shown below:   The r

Perform with varying option, PERFORM WITH VARYING OPTION: The format i...

PERFORM WITH VARYING OPTION: The format is as shown below:

Illustration of the abbreviation - compound condition, Illustration of the ...

Illustration of the abbreviation: A few illustration of the abbreviation are given below: Illustration: The compound condition  AMOUNT GREATER THAN 499 AND AMOUNT L

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