Write statement, COBOL Programming


The WRITE Statement verb releases a record in an output file. The syntax for the WRITE statement can be unlike depending on the output device and the medium used. The verb as explained here can be used only to print the results on continuous stationery through a line printer. The form for the WRITE statement in such a situation is

     WRITE   record-name     [FROM identifier-1]

The initial point to be noted is that in the situation of the READ statement the file name is to be specified, while in the case of the WRITE statement it is needed to mention the record name and not the file name. The phrase ADVANCING is used to control the vertical position of each record at the time of the printing on the stationery placed on the printer. 

Whenever the BEFORE phrase is used, then the record is printed before the stationary is advanced, while the AFTER phrase may be used when the intention is to advance the stationary first and then to print the record. When the integer-1 or identifier-1 is mentioned, then the stationary is advanced by the number of lines equivalent to the value of the integers-1 or to the present value of the identifier-1.

If the mnemonic-name is specified, then the printer will be advanced to the carriage control channel declared for the mnemonic-name in the SPECIAL-NAMES paragraph. This selection is provided so that the hardware names that may be peculiar to the particular computer require not appearing in the PROCEDURE DIVISION.

If the FROM option is used, the operation is equal to that of the MOVE identifier-1 TO record-name followed by the WRITE record-name without the FROM clause. It is illegal to use similar storage region for both the record-name and identifier-1.

It must be noted that after WRITE is executed the record is no longer available. 


Posted Date: 10/16/2012 5:37:34 AM | Location : United States

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

Write discussion on Write statement
Your posts are moderated
Related Questions
PROGRAM FOR SUBTRACT VERB: We have to write a simple program to elaborate the SUBTRACT verb. You can also use edit characters in the program. Identification division. Pr

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

STATEMENTS FOR SEQUENTIAL FILES: A basic operation on a file includes the reading and writing of its records. Whenever the file is sequential, there are three verbs for the

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

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

RULES FOR INDEXED TABLES: The rules of indexing a table with an INDEXED phrase are as shown below: (1) If indexing is completed for any one level of a table, then indexing

REWRITE STATEMENT: As in the situation of a relative file, the REWRITE statement needs that the file should be opened in the I-O mode, and if the SEQENTIAL access mode is spec

Character Set: To study any language, first one should know the alphabets of the language and they are termed as character set in general. There are 50 different characters in

PROCEDURE DIVISION statements for the indexed files: All the statements which are available for a relative file are also available for an indexed file. READ STTATEMENT :

Valid and Invalid Word - Cobol words: Valid Word             Invalid Word & Reason emp-sal                  -pay   ( it starts with a hyphen)  TOTAL MARK (blank space em