Write statement - relative files, COBOL Programming

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.

 

Posted Date: 10/17/2012 8:15:37 AM | Location : United States







Related Discussions:- Write statement - relative files, Assignment Help, Ask Question on Write statement - relative files, Get Answer, Expert's Help, Write statement - relative files Discussions

Write discussion on Write statement - relative files
Your posts are moderated
Related Questions
, (Comma) : A comma, whenever used in a picture, is considered as an insertion character and inserted wherever it become visible. There can be more than one comma in the pictu

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

Introduction to MOVE Verb: The aim of this section is to introduce the learner how to move data from one place to the other place in the memory. This is completed with the help

BLOCK CONTAINS CLAUSE: Integer -1 of the BLOCK CONTAINS clause indicates the block size either in terms of records or in terms of characters. For illustration, BLOCK CONTAINS

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

IF ... ELSE STATEMENT: We are familiar with an easy form of the IF statement. The common form of the IF statement is as shown below: Each of the statement-1 and statem

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.

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

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

Illustration of Divide verb: (a) DIVIDE 5 INTO A. If the value of A is 20, then after execution of this statement the value of A will be 4. The older value of A will be los