Figure 1. Example of Send_Error in Receive State ┌─────────┐ ┌─────────┐
│ PROGRAM │ │ PROGRAM │
│ │←───────────────────────────────→│ │
│ A │ │ B │
└─────────┘ └─────────┘
(RUNNING) (RUNNING)
(IN CONVERSATION) (IN CONVERSATION)
Call ATBSEND 1 2 Call ATBRCVW
RC=OK
.
.
Call ATBSEND 3 ──────────────────────→ 4 RC=OK
RC=OK DATA_RECEIVED=
DATA_COMPLETE
6 ←────────────────────── 5 Call ATBSERR (Send_Error)
.
Call ATBSEND 7 ───────────────────────────→ .
. .
RC= 10 ←───────────────────── 8 RC=OK
(Program_Error_Purging)
Call ATBRCVW 11 9 Call ATBSEND
.
.
.
A transaction program can send an error notification to its partner
to report that an error occurred and to cause buffer data to be purged.
In
Figure 1, program A has already
allocated the conversation and is in Send state, with program B in
Receive state.
- Program A calls the Send_Data service, causing the LU to place
the data (a logical record) in its buffer. Nothing is sent.
- Program B calls the Receive_and_Wait service, suspending processing
until it receives data.
- Program A calls Send_Data again, causing the LU to place more
data (another logical record) in its buffer. The LU now has enough
data to send, based on session characteristics, so it sends the data.
- The LU returns control to program B, indicating that the program
has received a complete record.
- Program B encounters an error in the data or in its processing
and calls the Send_Error service. The Send_Error service causes program
B's LU to purge information it has received but not yet sent, and
to send a negative response. Program B's processing is suspended
awaiting Send control.
- Program A's LU receives the negative response, purging any remaining
buffered data from program A.
- Program A, unaware of the error yet, calls Send_data, which fails.
The LU does not accept the data. Instead, the LU sends Send control
to program B, suspending program A.
- The LU for program B receives the Send control, sends the error
notification, and returns control to program B.
- Program B calls the Send_Data service, possibly to transfer more
error-recovery information.
- Program A's LU returns control to it, along with the error notification
(return code program_error_purging).
- Now in Receive state, program A calls Receive_and_Wait.