Program for indexed sequential file creation-mode, COBOL Programming

Assignment Help:

PROGRAM FOR INDEXED SEQUENTIAL FILE CREATION (RANDOM MODE):

We have to write a program to create an Indexed Sequential File in random mode for Student particulars. Suppose just 2 fields: rno(Roll Number), name(Name  of Student) 

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.    

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".

  close stu-file.

  stop run.

g-w-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 [y/n] : ".


Related Discussions:- Program for indexed sequential file creation-mode

Structure of a cobol program, Structure of a COBOL Program: Every COBO...

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

Program for perform - until, PROGRAM FOR PERFORM ...UNTIL We have to w...

PROGRAM FOR PERFORM ...UNTIL We have to write a program to find the sum of "n" natural numbers. Identification division. Program- id. PerfUntil. Environment division.

Program for divide verb, PROGRAM FOR DIVIDE VERB:   We have to write ...

PROGRAM FOR DIVIDE VERB:   We have to write an easy program to elaborate DIVIDE verb. You can also use edit characters in the program. Identification division. Program-

Different data types available in cobol, Data types available in COBOL are ...

Data types available in COBOL are given below Alpha-numeric (X), numeric (9), alphabetic (A)

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

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

Perform with times option, PERFORM WITH TIMES OPTION: The format of ...

PERFORM WITH TIMES OPTION: The format of a PERFORM TIMES statement is as shown below: Illustration:   A)  Perform the para-2 5 times. In this situation the specifie

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

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

Add and subtract corresponding, ADD and SUBTRACT CORRESPONDING: The CO...

ADD and SUBTRACT CORRESPONDING: The CORRESPONDING option can also used with the ADD and SUBTRACT verbs. The following are some of the formats of these verbs with the CORRESPON

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