6.2.30 RETURN Statement
The RETURN statement transfers records from the final phase of a sorting
or merging operation to an OUTPUT PROCEDURE.
The RETURN statement can be used only within the range of an OUTPUT
PROCEDURE associated with a SORT or MERGE statement.
___ Format _____________________________________________________________
| >>__RETURN__file-name-1__ ________ __ ____________________ __________> |
| |_RECORD_| |_INTO__identifier-1_| |
| >__ ____ __END__imperative-statement-1_______________________________> |
| |_AT_| |
| >__ __________________________________________ __ ____________ _____>< |
| |_NOT__ ____ __END__imperative-statement-2_| |_END-RETURN_| |
| |_AT_| |
Within an OUTPUT PROCEDURE, at least one RETURN statement must be
When the RETURN statement is executed, the next record from file-name-1 is
made available for processing by the OUTPUT PROCEDURE.
The record areas associated with file-name-1 and identifier-1 must not be
the same storage area.
Must be described in a Data Division SD entry.
If more than one record description is associated with file-name-1,
these records automatically share the same storage; that is, the area
is implicitly redefined. After RETURN statement execution, only the
contents of the current record are available; if any data items lie
beyond the length of the current record, their contents are undefined.
The result of the execution of a RETURN statement with the INTO phrase
is equivalent to the application of the following rules in the order
- The execution of the same RETURN statement without the INTO
- The current record is moved from the record area to the area
specified by identifier-1 according to the rules for the MOVE
statement without the CORRESPONDING phrase. The size of the
current record is determined by rules specified for the RECORD
clause. If the file description entry contains a RECORD IS
VARYING clause, the implied move is a group move. The implied
MOVE statement does not occur if the execution of the RETURN
statement was unsuccessful. Any subscripting or reference
modification associated with identifier-1 is evaluated after the
record has been read and immediately before it is moved to the
data item. The record is available in both the record area and
the data item referenced by identifier-1.
The INTO phrase can be specified in a RETURN statement if one or both of
the following are true:
- If only one record description is subordinate to the sort-merge file
- If all record-names associated with file-name-1 and the data item
referenced by identifier-1 describe a group item or an elementary
X Multiple non-alphanumeric records can be specified for file-name-1.
X Identifier-1 need not describe a group item or an elementary alphanumeric
X item. The following rules apply:
- X If the file referenced by file-name-1 contains variable-length records
X or, under OS/390 and VM, a QSAM file with RECORDING MODE 'S' or 'U', a
X group move will take place.
- X If the file referenced by file-name-1 contains fixed-length records,
X the movement will take place according to the rules for the MOVE
X statement, using, as a sending field description, the record that
X specifies the largest number of character positions. If more than one
X such record exists, the sending field record selected will be the one
X among those records that appears first under the description of
© Copyright IBM Corp. 1991, 1998
IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.
Return to library:
IBM Hardware |
IBM System z Redbooks
How to order publications
Download IBM Library Reader |
Download IBM Softcopy Reader |
Download Adobe® Acrobat® Reader®
Download IBM Softcopy Librarian
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks
of Adobe Systems incorporated.