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

COMPOUND CONDITION: The two simple conditions can be connected by the logical operators AND or OR to form a compound condition (also termed as combined condition). When two co

TO WRITE A QUADRATIC EQN ROOTS ARE COMPLEX IN COBOL PROGRAM

Picture Clause: The picture clause explains the general characteristics of an elementary data item. These characteristics are elaborated below: Class: In COBOL the

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,

Illustration of Multiply verb: (a)  MULTIPLY A BY B. In this situation the value of A & B will be multiplied and the product will be stored in B.  The decimal point locatio

File Description for the Relative and Indexed Files: The FD entry for a relative or an indexed file is similar to that of a sequential file. Some compilers do not permit varia

Example of Redefines clause: This illustration describes a sales record that may either contain the total amount of sale or the quantity (QTY) and UNIT-PRICE. The aim of such

Examples - Edit characters for numeric data: The following illustration illustrates the use of Z editing characters. The character b is used to indicate the space character an

PROGRAM FOR INVENTORY  We have to write a program to update the inventory file. Consider 2 files,viz, invfile an tranfile. Invfile has 3 fields pno,name,qty. Tranfile has 3 fil