SNAX/APC Application Programming Manual
Using the Application Program Interface
SNAX/APC Application Programming Manual—138786
1-24
RECEIVE-AND-WAIT Processing
normal conditions). It should also be understood under what conditions a TP can issue a
(MC)SEND-ERROR or (MC)DEALLOCATE (ABEND) verb request. When a TP
issues (MC)SEND-ERROR, it enters Send state; further action must be determined by
transaction conventions.
The recommended way to prepare for information from the SNAX/APC server is to
write a loop in the TP, at the beginning of which is a (MC)RECEIVE-AND-WAIT verb
request. When the TP receives a (MC)RECEIVE-AND-WAIT reply from SNAX/APC,
it should first check the IPC reply header for errors, and then it should check the return
code (RWR-RETN-CODE), as follows:
•
If the return-code field does not contain RC-OK (value 0), the TP should check for
DEALLOCATE-NORMAL (1005). (Note that, unlike the remaining return codes,
DEALLOCATE-NORMAL should not be perceived as an error code; it is returned
in normal processing when the remote TP deallocates the conversation.) If the
return code is DEALLOCATE-NORMAL, the TP should issue DEALLOCATE
LOCAL to deallocate its side of the conversation. If the local TP is ready to
terminate, the TP should issue TP-END.
•
If the return code is an error code, the TP should handle the error. If possible, the
TP should retry the action; if the error code indicates that the TP cannot retry the
action, the TP should terminate the conversation (by using DEALLOCATE
ABEND).
•
If the return code is OK, the TP should examine the WHAT-RECEIVED field in the
RECEIVE-AND-WAIT reply:
•
If WHAT-RECEIVED indicates DATA, DATA-COMPLETE, DATA-
INCOMPLETE, PS-HEADER-PENDING, PS-HEADER-COMPLETE, or PS-
HEADER-INCOMPLETE (values 0, 1, 2, 8, 9, or 10), the TP should handle the
data and issue another RECEIVE-AND-WAIT request (return to the beginning
of the loop).
•
If WHAT-RECEIVED indicates SEND (value 3), the TP enters Send state and
must prepare to send data to the remote TP.
•
If WHAT-RECEIVED indicates CONFIRM (value 4), the TP can send either a
CONFIRMED or SEND-ERROR verb request to the remote TP. CONFIRMED
indicates that the data received is satisfactory; SEND-ERROR indicates that the
data received is bad, or the TP detected an error. After issuing CONFIRMED,
the TP should issue another RECEIVE-AND-WAIT request.
•
If WHAT-RECEIVED indicates CONFIRM-SEND (value 5), the TP must send
either CONFIRMED or SEND-ERROR to the remote TP before entering Send
state. The local TP receives no data when WHAT-RECEIVED indicates SEND
or CONFIRM-SEND. When the TP finishes sending data, it should either issue
another RECEIVE-AND-WAIT request or, if the transaction is complete, it
should deallocate the conversation.
Note. Processing is the same for mapped and basic conversations. The examples given
in this section are based however, on the use of basic verb conversations.