Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.28.6.1 Sequential Files



The NEXT RECORD is the next record in a logical sequence of records. The NEXT phrase need not be specified; it has no effect on READ statement execution.

If SELECT OPTIONAL is specified in the FILE-CONTROL entry for this file, and the file is absent during this execution of the object program, execution of the first READ statement causes an at end condition; however, since no file is present, the system-defined end-of-file processing is not performed.

At End Condition: If the file position indicator indicates that no next
logical record exists, or that an optional input file is not present, the following occurs in the order specified:

  1. A value, derived from the setting of the file position indicator, is placed into the I-O status associated with file-name-1 to indicate the at end condition.
    
    
  2. If the AT END phrase is specified in the statement causing the condition, control is transferred to imperative-statement-1 in the AT END phrase. Any USE AFTER STANDARD EXCEPTION procedure associated with file-name-1 is not executed.
    
    
  3. If the AT END phrase is not specified, a USE AFTER STANDARD EXCEPTION procedure must be specified with this file, and the procedure is executed. Return from that procedure is to the next executable statement following the end of the READ statement.
    
    

    X If the AT END phrase is not specified, a USE AFTER STANDARD EXCEPTION
    X procedure does not have to be associated with file-name-1.
    
    
    When the at end condition occurs, execution of the READ statement is unsuccessful. The contents of the associated record area are undefined and the file position indicator is set to indicate that no valid next record has been established. Attempts to access or move data into the read record area following an unsuccessful read can result in a protection exception.
    
    

If an at end condition does not occur during the execution of a READ statement, the AT END phrase is ignored, if specified, and the following actions occur:

  1. The file position indicator is set and the I-O status associated with file-name-1 is updated.
    
    
  2. If an exception condition that is not an at end condition exists, control is transferred to the end of the READ statement following the execution of any USE AFTER STANDARD EXCEPTION procedure applicable to file-name-1.
    
    
    If no USE AFTER STANDARD EXCEPTION procedure is specified, control is transferred to the end of the READ statement or to imperative-statement-2, if specified.
    
    
  3. If no exception condition exists, the record is made available in the record area and any implicit move resulting from the presence of an INTO phrase is executed. Control is transferred to the end of the READ statement or to imperative-statement-2, if specified. In the latter case, execution continues according to the rules for each statement specified in imperative-statement-2. If a procedure branching or conditional statement which causes explicit transfer of control is executed, control is transferred in accordance with the rules for that statement; otherwise, upon completion of the execution of imperative-statement-2, control is transferred to the end of the READ statement.
    
    

Following the unsuccessful execution of a READ statement, the contents of the associated record area are undefined and the file position indicator is set to indicate that no valid next record has been established. Attempts to access or move data into the record area following an unsuccessful read can result in a protection exception.

Multivolume QSAM Files (OS/390 and VM Only): If end-of-volume is
recognized during execution of a READ statement, and logical end-of-file has not been reached, the following actions are taken:



Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.