Program for indexed sequential file creation-mode, COBOL Programming

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

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
DELETE STATEMENT: The format of the delete statement is as shown below: DELETE   file-name RECORD   [  ;   INVALID   KEY  imperative-statement  ] Whenever the ACCESS MOD

WRITE statement: The WRITE statement for tape and sequential-disk files has the syntax shown below. WRITE            record-name      [  FROM    identifier   ] As a resu

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

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

Comparison of Numeric Operands: We are well-known with the kind of the relational condition where both the operands are numeric. The comparison in this situation is algebraic

CLASS CONDITION:   The class condition establishes whether or not the value of the operand is numeric or alphabetic. The operand is numeric if it contains only the digits 0 t

When using the accept verb in cobol is it possible to assign something other then "SYSIN" for a ddname?

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

Introduction to COBOL: In the year 1959, a new language named the COBOL ( CO mmon B usiness O riented L anguage) was introduced remembering the business purpose application

Example of Write statement: Illustration: (i) WRITE TRANS-RECORD AFTER ADVANCING 3 LINES. This WRITE statement specified that the TRANS-RECORD is a record name of a fi