Logic of the 3600 chaining output routine
Figure 1 shows
the logic of the 3600 chaining output routine. The following notes
are keyed to this figure.
Figure 1. Logic of the chaining output routine

- 1
- The number of requests in the chain might vary. Assuming that
it varies in sample program 2, the number of chain requests must be
determined so that the routine knows when to send the last request.
It might be convenient to picture this routine being entered to send
a report to an administrative line printer; this report can vary in
length between 20 and 100 printer lines. Each line is sent to the
3601 LU as a chain request. The 3601 LU determines how many lines
(chain requests) it collects before sending them on to the administrative
printer.
This chaining routine can pass all of the data to be sent in a chain or only part of it. In other words, the routine is not necessarily sending an entire chain each time it is entered. The logic discussed here, however, assumes that all or, in a retry situation, the last part of a chain is being sent.
- 2
- Because one of the advantages of chaining output is to reduce the number of required responses while still breaking output into requests that can be interspersed on the communication path, all SEND macroinstructions, other than the last one, specify that a response is to be returned only if an exception is noted (RESPOND=EX). When the last request is received, a positive response is returned, and the VTAM® application program recognizes that the entire chain arrived successfully. When RESPOND=EX is specified, the scheduling of output (POST=SCHED) is assumed by VTAM; it does not have to be specified.
- 3
- In some cases, it might be necessary to save the sequence number of the first request sent in a chain. This number is available as soon as sending has been scheduled. It can be obtained from the SEQNO field of the RPL by using the SHOWCB macroinstruction. In case all or part of the chain must be resent (a negative response arrives in the RESP exit routine), the first-of-chain sequence number can be useful in determining where to start resending. It might also be necessary (not shown here) to reset the beginning sequence number for the session that is receiving the chain; this number is altered by using a SESSIONC macroinstruction. The sequence number can be saved in the control block associated with the session.
- 4
- All requests except the first and last are middle requests (CHAIN=MIDDLE).
- 5
- For the last request of the chain, the SEND macroinstruction must
identify it as the last (CHAIN=LAST) and ask for the return of a response
(RESPOND=NEX). Either POST=SCHED or POST=RESP can be specified.
When the response is received, if POST=SCHED was specified, the RESP exit routine posts an ECB, causing the wait routine to return to the processor that originated the output request. If POST=RESP was specified, VTAM posts an ECB or schedules an RPL exit routine.