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
specified.
When the RETURN statement is executed, the next record from file-name-1 is
made available for processing by the OUTPUT PROCEDURE.
-
file-name-1
-
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.
-
INTO phrase
-
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
specified:
- The execution of the same RETURN statement without the INTO
phrase.
- 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 record areas associated with file-name-1 and identifier-1 must not be
the same storage area.
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
description entry
- If all record-names associated with file-name-1 and the data item
referenced by identifier-1 describe a group item or an elementary
alphanumeric item.
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
X file-name-1.
Subtopics:
© 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.