Receiving data from the partner transaction
The RECEIVE command is used to receive data from the connected partner.
T
he rows in the state tables for the RECEIVE command
show the EIB fields
that should be tested after issuing a RECEIVE command. As well as showing
which field should be tested, the state table also shows the order in
which
the tests should be made. Instead of testing some of the EIB fields, you
can test the resulting conversation state; this is shown in
Figure 1.
Note that you should always test the value returned by the RESP option.
Figure 1. Checking the outcome of a
RECEIVE command
* ...
DATA DIVISION.
WORKING-STORAGE SECTION.
* ...
01 FILLER.
02 WS-RESP PIC S9(8) COMP.
02 WS-STATE PIC S9(8) COMP.
* ...
PROCEDURE DIVISION.
* ...
* Check return code from RECEIVE
IF WS-RESP = DFHRESP(NORMAL)
THEN
* ... Request successful, check state
EVALUATE WS-STATE
WHEN DFHVALUE(ROLLBACK)
* ... Partner issued SYNCPOINT ROLLBACK
WHEN DFHVALUE(SYNCFREE)
* ... Partner issued SYNCPOINT and LAST
WHEN DFHVALUE(SYNCRECEIVE)
* ... Partner issued SYNCPOINT
WHEN DFHVALUE(FREE)
* ... Partner issued LAST
WHEN DFHVALUE(SEND)
* ... Partner issued INVITE
WHEN DFHVALUE(RECEIVE)
* ... Processing for receipt of data
* (including EIBCOMPL for incomplete data)
WHEN OTHER
* ... Logic error, should never happen
END-EVALUATE.
ELSE
* ... Examine EIBRCODE for source of error
END-IF.
* ...
Note: In the same way as it is possible to send the INVITE and LAST
indicators
with data, it is also possible to receive them with data. Syncpoint
requests
may also be received with data. However, indications of conversation
failure
are never received with data.