The RETURN Statement
Syntax
Format
RETURN file-name-1 RECORD [INTO identifier-1]
[AT END imperative-statement-1]
[NOT AT END imperative-statement-2]
[END-RETURN]
Description
The RETURN statement is used within the context of a SORT OUTPUT PROCEDURE to obtain data records from the sort process. The returned data is moved into the sort record associated with file-name-1. If the INTO clause is included, the sort record is copied into the INTO item after the data record has been returned. If the end of the sort file is reached, the code between AT END and NOT AT END, if any, will be executed. If the end of the sort file is reached, the code between NOT AT END and END-RETURN, if any, will be executed.
Tips
1. The RETURN statement is the equivalent of a READ statement, except that is used exclusively for SORT files.
2. An OUTPUT PROCEDURE must contain at least one RETURN statement.
3. The RETURN statement may only be used within the context of an OUTPUT PROCEDURE.
4. The RELEASE statement is used to write SORT files.
Syntax
Format
RETURN file-name-1 RECORD [INTO identifier-1]
[AT END imperative-statement-1]
[NOT AT END imperative-statement-2]
[END-RETURN]
Description
The RETURN statement is used within the context of a SORT OUTPUT PROCEDURE to obtain data records from the sort process. The returned data is moved into the sort record associated with file-name-1. If the INTO clause is included, the sort record is copied into the INTO item after the data record has been returned. If the end of the sort file is reached, the code between AT END and NOT AT END, if any, will be executed. If the end of the sort file is reached, the code between NOT AT END and END-RETURN, if any, will be executed.
Tips
1. The RETURN statement is the equivalent of a READ statement, except that is used exclusively for SORT files.
2. An OUTPUT PROCEDURE must contain at least one RETURN statement.
3. The RETURN statement may only be used within the context of an OUTPUT PROCEDURE.
4. The RELEASE statement is used to write SORT files.