Program for sequential file creation & rewriting , COBOL Programming

Assignment Help:

Program for Sequential File Creation & Rewriting 

We have to write a program to create a Length file with just two fields: l (Length) and l-c (Length-Code). Add a few records. Change the record with l-c =1 as l-c=5. Use sequential file I-O.

 identification division.

  program- id.

  environment division.

  input-output section.

  file-control.

    select len- file assign to disk.

  data division.

  file section.

  fd len- file

    label records are standard

    value of file- id is "len.dat".

01 len-rec.

  02   l   pic 9(2).

  02   l-c pic 9(1).

working-storage section.

01   ans pic x value space.

01   eof pic x value space.

screen section.

01  cls-screen. 

  02  blank screen.

01  get-screen.

  02  line 3 column 5 value "Length = ".

  02   column plus 3 pic 9(2) to l auto bell.

  02  line 5 column 5 value "Code = ".

  02  column plus 3 pic 9 to l-c bell reverse-video.

procedure division.

p-1.

  open output len-file.

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

  close len- file.

  open i-o len- file.

  read len- file at end move 'y' to eof.

  perform rewrite-para until eof = 'y'.

  close len- file.

  stop run.

g-w-para.

  display cls-screen.

  display get-screen.

  accept get-screen.

  write len-rec.

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

  accept ans.

rewrite-para.

  if l-c = 1 

    move 5 to l-c

    rewrite len-rec.

  read len- file at end move 'y' to eof.


Related Discussions:- Program for sequential file creation & rewriting

Program for move corresponding, PROGRAM FOR MOVE CORRESPONDING: We hav...

PROGRAM FOR MOVE CORRESPONDING: We have to write a simple program to demonstrate Move Corresponding. identification division.   program- id.   environment division.

Example of read statement, Example of read statement: Illustration: ...

Example of read statement: Illustration: READ OLD-MASTER AT END MOVE ZERO TO END-OF-RECORDS. As a result of this statement, generally the next record from the OLD-MAST

Program., calculate simple interest

calculate simple interest

Handling file that was uploaded from a PC, I uploaded a file from PC to Mai...

I uploaded a file from PC to Mainframe, variable LRCL 256. In my COBOL program I defined it as FD INPUT-FILE LABEL RECORDS ARE OMITTED BLOCK CONTAINS 0 RECORDING MODE

Data names and identifiers - cobol program, Data Names and Identifiers:   ...

Data Names and Identifiers:   The Data name provides reference to the storage space in the memory where the real value is stored. This value takes part in the operation whene

Accept statement, ACCEPT STATEMENT: The ACCEPT statement is used to re...

ACCEPT STATEMENT: The ACCEPT statement is used to read the low-volume data from the operator's console, several other hardware device or from the operating system. The common

Go to, GO TO, STOP RUN: The GO TO verb is used to completely transfer ...

GO TO, STOP RUN: The GO TO verb is used to completely transfer the control to elsewhere in the program. Its form is as shown below: GO TO procedure-name As a result o

Example of class condition, Example of Class condition: Let the BASIC-...

Example of Class condition: Let the BASIC-PAY be a data name in the card record defined with picture 9(5) V99. By reading the card we can test the value of the BASIC-PAY to ma

File status clause, FILE STATUS clause: This clause has been involved ...

FILE STATUS clause: This clause has been involved in the above syntax for completeness. The ORGANIZATION, REVERSE, ACCESS and STATUS clause can be specified in any order.

Sign condition - cobol programming, SIGN CONDITION:   The sign condit...

SIGN CONDITION:   The sign condition establishes whether or not the algebraic value of an operand is negative, positive or zero. The operand can be either the numeric identif

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