Example of read statement, COBOL Programming

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-MASTER file will be read. If there is no more record in the OLD-MASTER, the value zero will be moved to the field named END-OF-RECORDS.

Illustration:

READ TRANSACTION RECORD AT END GO TO PARA-END.

This illustration is similar to the former illustration. The next record from the TRANSACTION file will be read if it is available. If the file does not hold any extra records, the control will be transferred to the paragraph named PARA-END.

Illustration:  

READ KARD-FILE INTO IN-REC AT END

                                                 GO TO JOB-END.

This statement not only reads the next record into the record region of the KARD-FILE but also moves the record into the region name the IN-REC.  When there is no more record in the KARD-FILE, then the control is transferred to the paragraph named JOB-END.  If the record region of the KARD-FILE has been named KARD-REC, the above statement is alike to

READ KARD-FILE AT END GO TO JOB-END.

MOVE KARD-REC TO IN-REC.

It may be noted that if the record has been effectively read, it is now available in the

KARD-REC as well as IN-REC.

Posted Date: 10/16/2012 5:36:53 AM | Location : United States







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

Write discussion on Example of read statement
Your posts are moderated
Related Questions
Sign - Picture clause: The numeric data item can be signed or unsigned. If a numeric data is regarded as unsigned then during the execution these unsigned data items are treat

ADD and SUBTRACT CORRESPONDING: The CORRESPONDING option can also used with the ADD and SUBTRACT verbs. The following are some of the formats of these verbs with the CORRESPON

Non numeric: The nonnumeric literal is used in normal to output messages or headings. The Characters which are enclosed between " " constitute nonnumeric literal. The maximum

Second form of Divide verb: The second form of this verb is as shown below: In this situation the identifier-1 or numeric- literal-1 will be divided by identifier-2 or

SEQUENTIAL FILES WITH THE VARIABLE-LENGTH RECORDS: The Magnetic - tape or disk files can hold variable-length records. In this situation the file can have records with various

ON SIZE ERROR OPTION: Whenever a size error occurs, the contents of the result field after the operation is unpredictable.  Though, the processing is not-terminated and the co

THE SIMPLE SORT VERB: The process of sequencing the records in some preferred manner is termed as sorting. The Sorting is done upon some key data item in the record. For illus

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

Environment Division: The Environment Division is the second division in the COBOL source program. It is mainly machine-dependent . The computer and all the peripheral dev

When using the accept verb in cobol is it possible to assign something other then "SYSIN" for a ddname?