The RECEIVE statement makes available to the program a message or a message segment and pertinent information about that data.
cd-name-1 must reference an input CD or an input-output CD.
If cd-name-1 references an input CD, the contents of the data items specified by data-name-1 (SYMBOLIC QUEUE) through data-name-4 (SYMBOLIC SUB-QUEUE-3) of the area referenced by cd-name-1 designate the queue structure containing the message.
If cd-name-1 references an input-output CD, the contents of the data item specified by data-name-3 (SYMBOLIC TERMINAL) of the area referenced by cd-name-1 designates the source of the message.
The message, message segment, or portion of a message or segment, is transferred to the receiving character positions of the area referenced by identifier-1 aligned to the left without space fill.
The data items identified by cd-name-1 are appropriately updated by the MCS at each execution of a RECEIVE statement.
A single execution of a RECEIVE statement never returns to the data item referenced by identifier-1 more than a single message (when the MESSAGE phrase is used) or a single segment (when the SEGMENT phrase is used).However, the MCS does not return any portion of a message to the object program until the entire message is available to the MCS, even when the SEGMENT phrase of the RECEIVE statement is specified.
Once the execution of a RECEIVE statement has returned a portion of a message, only subsequent execution of RECEIVE statements in that run unit can cause the remaining portion of the message to be returned.
NO DATA and WITH DATA Phrases
NODATA imperative -statement-1
WITH DATAimperative -statement-2
When, during the execution of a RECEIVE statement, the MCS makes data available in the data item referenced by identifier-1, the NO DATA phrase, if specified, is ignored and control is transferred to the end of the RECEIVE statement or, if the WITH DATA phrase is specified, to imperative-statement-2.In the latter case, execution continues according to the rules for each statement in imperative-statement-2.If a procedure branching or conditional statement that 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 RECEIVE statement.
When, during the execution of a RECEIVE statement, the MCS does not make data available in the data item referenced by identifier-1, one of the following actions occurs:
If the MESSAGE phrase is used, end of segment indicators are ignored, and the following rules apply to data transfer:
If the SEGMENT phrase is used, the following rules apply:
RECEIVE Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.