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
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

Record Description for the Variable-length Records: When the variable- length records consists of records of various lengths, each record type is to be explained at level 01 f

PROGRAM FOR COMPUTE VERB: We have to write an easy program to elaborate the COMPUTE verb.  Identification division. Program- id. compverb. Environment division. Da

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

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

SEARCH VERB: The SEARCH verb is used to position elements in one-dimensional tables. Let us consider the following problem. Assume that each element of a table consists of thr

There are some restrictions when these procedures are used. (i) The Procedure should not contain any SORT/MERGE statement. (ii) An explicit transfer of the control outside

PERFORM WITH TIMES OPTION: The format of a PERFORM TIMES statement is as shown below: Illustration:   A)  Perform the para-2 5 times. In this situation the specifie

Common form of the READ statements: Format 1 is the common form of the READ statements. Format 2 is used when the access mode is either random or dynamic. For illustration,

NONSTANDARD CLAUSES: The various clauses explained above are as per the ANSI standard. Also, most compilers provide for additional nonstandard clauses to meet the specific nec