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
PROGRAM FOR MASTER FILE MAINTENANCE: We have to write a program to keep the stu-file for which a record has just 2 fields,viz., rno(Roll Number) and name(Student Name). Give t

Illustration of perform statement: PERFORM    CALCUALTE-TAX. In this illustration, the CALCULATE-TAX is either a section name or paragraph name. Assume that it is a section

LEVEL NUMBERS: The COBOL makes use of the level number concept to explain the hierarchical data structure. A level number is a 2 digit number. The permitted level numbers a

SUBTRACT VERB: The SUBTRACT verb is used to subtract one, or the sum of two or more numbers from one or more numbers and to store the result. The form of the SUBTRACT verb

PROGRAM FOR SIZE ERROR:   We have to write an easy program to elaborate the size error option. Identification division. Program- id. sizeerr. Environment division.

PROGRAM USING OCCURS CLAUSE: We have to write a simple program to demonstrate Occurs Clause. Get the employee details for 3 persons and compute the total salary. identifica

MOVE CORRESPONDING: It is frequently required to move some of the data items of one group to some other data items in the other group. If the names of the equivalent data item

MULTIPLY VERB:   The Multiply Verb causes one or more multiplicands to be multiplied by the multiplier and to store the products. The form of the MULTIPLY verb is as shown be

Illustration of if- else statement: IF OK-BALANCE NEXT SENTENCE ELSE MOVE 2 BALANCE-CODE In this illustration, the OK-BALANCE is a condition name. No action is specific if

RULES OF REDEFINES CLAUSE The rules shown below govern the use of the REDEFINES clause: (i) The level-number of data-name-1 and data-name-2 should be identical. (ii) Exce