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
Example of constructing an arithmetic expression: An arithmetic expression may be proceeded by a + or - sign. These operations are known as unary + or unary - operators. Il

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

Example of add verb: (a) ADD A TO B. This illustration represents that the value of A will be added to the value of B and the result will be stored in B.  The alignment of

Illustration of Renames clause: In the illustration, PAT-OTHER-THAN-BASIC will become a fresh group consisting of DEARNESS-ALLOWANCE, HOUSE-RENT & MTHLY-INCENTIVE. Keep in min

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

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

We have input file, record layout is EMP ID (6 char) , EMP NAME (20 char), Designation (3 char),Salary (5 digit) Base Branch (10char) Grade (3 Alphanumeric). This is the input f

MULTI-DIMENSIONAL TABLES: The type of table which has been considered above is known as one-dimensional table. Whenever a table is such that each of its elements in turn is a

READ STATEMENTS: The common format for the read statements is as shown bellow. Format 1: READ file-name RECORD [ INTO   identifier ] [  ;  AT   END     imperative-s

Example of Open statement: Illustration: The OPEN INPUT TRANSACTION, OLD-MASTER OUTPUT NEW-MASTER. The illustration represents that there are two input files named the