Receiving data from the partner transaction
The RECEIVE command is used to receive data from the connected partner.
The 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 tables also show the order in which the tests should be made.
As an alternative to testing the EIB fields it is possible to test the resulting conversation state; this is shown in Figure 1. The conversation state can be meaningfully tested only after issuing a command with the STATE option or by using the EXTRACT ATTRIBUTES STATE command. Note that the RESP value returned and EIBERR should always be tested. If EIBNODAT is set on ( X'FF' ), no data has been received. For more information about response testing, see Checking the outcome of a DTP command . For information about testing the conversation state, see Testing the conversation state.
* ...
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(EOC)
OR WS-RESP = DFHRESP(NORMAL)
THEN
* ... Request successful
IF EIBERR = LOW-VALUES
THEN
* ... No errors, check state
EVALUATE WS-STATE
WHEN DFHVALUE(SYNCFREE)
* ... Partner issued SYNCPOINT and LAST
WHEN DFHVALUE(SYNCRECEIVE)
* ... Partner issued SYNCPOINT
WHEN DFHVALUE(SYNCSEND)
* ... Partner issued SYNCPOINT and INVITE
WHEN DFHVALUE(CONFFREE)
* ... Partner issued CONFIRM and LAST
WHEN DFHVALUE(CONFRECEIVE)
* ... Partner issued CONFIRM
WHEN DFHVALUE(CONFSEND)
* ... Partner issued CONFIRM and INVITE
WHEN DFHVALUE(FREE)
* ... Partner issued LAST or FREE
WHEN DFHVALUE(SEND)
* ... Partner issued INVITE
WHEN DFHVALUE(RECEIVE)
* ... No state change. Check EIBCOMPL.
WHEN OTHER
* ... Logic error, should never happen
END-EVALUATE.
ELSE
* ... Error indicated
EVALUATE WS-STATE
WHEN DFHVALUE(ROLLBACK)
* ... ROLLBACK received
WHEN DFHVALUE(RECEIVE)
* ... ISSUE ERROR received, reason in EIBERRCD
WHEN OTHER
* ... Logic error, should never happen
END-EVALUATE
END-IF
ELSE
* ... Examine RESP code for source of error
END-IF.