Program for indexed sequential file creation-mode, COBOL Programming


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.


    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.  


  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.


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

Posted Date: 10/18/2012 1:24:42 AM | Location : United States

Related Discussions:- Program for indexed sequential file creation-mode, Assignment Help, Ask Question on Program for indexed sequential file creation-mode, Get Answer, Expert's Help, Program for indexed sequential file creation-mode Discussions

Write discussion on Program for indexed sequential file creation-mode
Your posts are moderated
Related Questions
RELATIVE FILES: The Files that are stored on a direct access storage medium like magnetic disk are frequently known as direct access files. The COBOL supports three different

READ STATEMENTS: The common format for the read statements is as shown bellow. Format 1: READ file-name RECORD [ INTO   identifier ] [  ;  AT   END     imperative-s

Rules for constructing an Arithmetic Expression: The rules for constructing an arithmetic expression are as shown below: (i) When an arithmetic expression specifies a calcu

DATA RECORD CLAUSE: The DATA RECORD clause, documents the record names defined for the file. For illustration, DATA RECORDS ARE REC-1, REC-2, REC-3 that means there are 3diffe

RULES OF REDEFINES CLAUSE The rules shown below govern the use of the REDEFINES clause: (i) The level-number of data-name-1 and data-name-2 should be identical. (ii) Exce

OCCURS - INDEXED BY PROGRAM: identification division. program- id. searching. environment division. data division. working-storage section. 01 table1.      0

GIVING    file-name-5. The input files to be merged through the MERGE statements which are specified in the USING phrase. These files should be sequential files and should be

Illustration of if- else statement: IF OK-BALANCE NEXT SENTENCE ELSE MOVE 2 BALANCE-CODE In this illustration, the OK-BALANCE is a condition name. No action is specific if

Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

calculate simple interest