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
RULES OF RENAMES CLAUSE:   The rules below should be observed while using the RENAMES clause: (i) All RENAMES entries should be written only after the last record descript

Rules for Simple sort verb: The work file is to be defined by a sort elaboration entry (SD entry).The format of SD entry is as shown below. The rules below should be taken

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

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

FILE-CONTROL ENTRIES FOR THE SEQUENTIAL FILES: The characteristics of each and every files handled in a program are specified in the ENVIRONMENT DIVISION and DATA DIVISION.

Group Item as Operand in the Relational Condition: Whenever an operand of a relational condition is the group item, the item is then considered to be an alphanumeric field. Th

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

Rules of read statements: The next record is identified according to the rules as shown below: (i) Whenever the READ NEXT statement is the initial statement to be executed

Identification Division: The Identification Division is the first division of each and every COBOL source program. The paragraph PROGRAM-ID is necessary in most of the mac

PROGRAM FOR SIMPLE PERFORM: We have to write a program to elaborate simple PERFORM statement Identification division. Program- id.  Perf1. Environment division. Da