Write statement - relative files, COBOL Programming

Assignment Help:

WRITE Statement:

     The WRITE statement for a relative file has the format which is as shown below.

         WRITE  record-name   [ FORM   identifier ]

                                            [  ;   INVALID KEY  imperative statement  ]

At the time of the execution of WRITE statement, the file should be open either in the OUTPUT or I-O mode. For illustration, assume REL-OUTPUT AND REL-KEY are the record name and relative key data item name for a relative file opened in the I-O mode. Then, upon execution of the statements below:

MOVE     50  TO  REL-KEY.

WRITE REL-OUTPUT  INVALID KEY GO TO PARA-INVALID.

The record is written at the 50th record location on the file.     

The imperative statement of INVALID KEY phrase is the execution in the situation as shown below:

(i)  When a try is made to write beyond the externally-defined boundaries of the file.

(ii) When a try is made to write in the record place that already contains a valid record.

 


Related Discussions:- Write statement - relative files

Program for inventory , PROGRAM FOR INVENTORY  We have to write a progr...

PROGRAM FOR INVENTORY  We have to write a program to update the inventory file. Consider 2 files,viz, invfile an tranfile. Invfile has 3 fields pno,name,qty. Tranfile has 3 fil

Numeric literals - cobol program, Numeric -   Literals : The numeri...

Numeric -   Literals : The numeric literal can be created with the help of digits only. It can have a sign (+ or -) and can also have a decimal point. If no sign is specifi

Input-output section - cobol programming, INPUT-OUTPUT SECTION: This s...

INPUT-OUTPUT SECTION: This section holds information regarding the files to be used in the program. There are 2 paragraphs in this section- FILE-CONTROL & I-O-CONTROL. The

Delete statement - indexed files, DELETE STATEMENT : The file should be...

DELETE STATEMENT : The file should be opened in the I-O mode. If the access is SEQUENTIAL, the INVALID KEY phrase must be specified. Rather than, the last input-output state

Program for if -else, PROGRAM FOR IF -ELSE: We have to write a program...

PROGRAM FOR IF -ELSE: We have to write a program to check whether the given number is ODD or EVEN. You can use IF..ELSE. Identification division. Program- id. IfElse.

Close statement - sequential files, CLOSE statement: The simplified sy...

CLOSE statement: The simplified syntax of the CLOSE statement is as shown below:   CLOSE          file-name-1   [WITH   LOCK   ]                         [  , file-

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

Move, can we move spaces to numeric field

can we move spaces to numeric field

Illustration of indexed tables, Illustration of indexed tables: Index ...

Illustration of indexed tables: Index items defined through the INDEXED phrase of the OCCURS clause are one type of indexes. There can be other type of index items that are de

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