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

File updation, FILE UPDATION: The method of modifying an old file with...

FILE UPDATION: The method of modifying an old file with present information is termed as file updating. Master file: A master file is a file which is used as an author

File characteristics, FILE CHARACTERISTICS: The task of file handling ...

FILE CHARACTERISTICS: The task of file handling is the responsibility of the system software termed as IOCS (Input-Output control system). Record Size: We know that th

Rules for simple sort verb, Rules for Simple sort verb: The work file ...

Rules for Simple sort verb: The work file is to be defined by a sort elaboration entry (SD entry).The format of SD entry is as shown below. The rules below should be taken

Write statement - relative files, WRITE Statement:      The WRITE stat...

WRITE Statement:      The WRITE statement for a relative file has the format which is as shown below.          WRITE  record-name   [ FORM   identifier ]

Label records or disk directory - file characteristics, Label Records / Dis...

Label Records / Disk Directory: The most important information stored in the header label is what is termed as the file title. In the situation of magnetic-disk files the labe

Blank insertion and zero insertion, B (Blank Insertion) : The occurren...

B (Blank Insertion) : The occurrence of a B anyplace in the picture will insert a space character in the edited data. There can be more than one B in the picture. Examples:

File volatility and file interrogation, File volatility: File volatili...

File volatility: File volatility associates to the number of times the updating of records are needed during some time period. File interrogation: Some files hold re

File-control - input-output section, FILE-CONTROL: The FILE-CONTROL pa...

FILE-CONTROL: The FILE-CONTROL paragraph names each and every file and identifies the first medium through file control entries. The basic format of a file control entry is gi

Indexed tables, INDEXED TABLES: The OCCURS clause that is used to defi...

INDEXED TABLES: The OCCURS clause that is used to define tables can optionally have an INDEXED phrase. This phrase involves the names of data items which are to be used as sub

Comparison of nonnumeric operands - relational condition, Comparison of Non...

Comparison of Nonnumeric Operands: A nonnumeric operand can be compared to the other nonnumeric operand according to the rules as shown below: (i) Fields of Equal Sizes:

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