Receiving data from the partner transaction
The GDS RECEIVE command is used to receive data from the connected partner transaction.
T he rows in the state tables for the GDS RECEIVE command show the CONVDATA fields that should be tested after issuing a GDS RECEIVE command. As well as showing which fields should be tested, the state tables also show the order in which the tests should be made. As an alternative to testing some of the CONVDATA fields it is possible to test the resulting conversation state. This is shown in Figure 1. Note that both RETCODE and CDBERR should always be tested.
- How much the conversation partner sent
- The value supplied on the MAXFLENGTH option
- Whether the LLID or BUFFER option is used.
The first factor is obvious: the application cannot receive more than is sent. The value of MAXFLENGTH is an upper limit; CICS® never returns more bytes than this value specifies. The LLID and BUFFER options enable the application to specify how CICS is to treat the data. This is described in Receiving data by the record and Receiving data by the buffer.
In the same way as it is possible to send GDS records with the INVITE, LAST, or CONFIRM option, it is also possible to receive them together. Syncpoint requests can also be received with GDS records. However, GDS ISSUE ERROR, GDS ISSUE ABEND, and indications of conversation failure are received by themselves —never with GDS records.
* ...
RECVLOOP DS 0H
LA R5,L'RECVHDR Length of GDS header
ST R5,RECVMAX as maximum receive length
* Receive GDS header from partner transaction
EXEC CICS GDS RECEIVE INTO(RECVHDR) MAXFLENGTH(RECVMAX) *
LLID FLENGTH(RECVLEN) *
CONVID(WCONVID) RETCODE(WRETC) *
STATE(WSTATE) CONVDATA(WCDB)
*
* ... Check outcome of the GDS RECEIVE
* ...
LA R5,L'RECVAREA Length of application buffer
ST R5,RECVMAX as maximum receive length
* Receive application data from partner transaction
EXEC CICS GDS RECEIVE INTO(RECVAREA) MAXFLENGTH(RECVMAX) *
LLID FLENGTH(RECVLEN) *
CONVID(WCONVID) RETCODE(WRETC) *
STATE(WSTATE) CONVDATA(WCDB)
* ...
* ... Check outcome of the GDS RECEIVE
* ... (including CDBCOMPL).
B RECVLOOP Loop while in receive state
* ...
*
WSTATE DS F
WRETC DS XL6
WCDB DS 0CL24
COPY DFHCDBLK
WCONVID DS CL4
RECVAREA DS CL100
RECVMAX DS F
RECVLEN DS F
RECVHDR DS H
* ...