See (p2,gtt) for Tymnet access via VM's Tymnet base. See (p2,tymnet) for a description of the only program that we now expect to use the TBA key.
The Tymnet base interface is either (_working) or not. {It is an exercise for the student to determine the relationship of this definition to IBM subchannel terminology.} The interface becomes working when an I/O operation with the base begins. The interface becomes not working when the base signals the completion of the operation.
A (_data operation) is either a "write then read", "read", or "reread" operation.
A (_long timeout) is 15 seconds on a real machine and 1 hour on a virtual machine.
The TYMNET base access maintains a flag called (_abort) which is initially off. The abort flag is set to off when a data operation completes.
TBA(0,((1,startseq),(outlength,outdata));==>c,((inlength, indata));) ("write then read").
Otherwise, a write I/O operation to the base is initiated. A byte variable called (_seq) is initialized to startseq. A byte variable called (_retried) is initialized to zero. Outdata is written to the base.
If the write I/O operation cannot be begun because the base or base access is not operational, 3 is returned in c and nothing in indata.
If the write I/O operation cannot be begun because the base or base subchannel has signaled an error condition {such as a spurious interrupt pending} (detected by the setting of condition code 1 on the Start I/O instruction), 1 is returned in c and ((1,seq),(1,0),(1, unit status), (1, channel status)) (see below) is returned in indata.
If the write I/O operation is begun and does not complete within the long timeout, 6 is returned in c and nothing in indata. A Halt Device is issued to the base. When the write I/O operation completes, any data and/or status returned will be lost.
If the write I/O operation is begun and completes within the long timeout and an error occurred, and the base did not signal unit check status, 7 is returned in c and ((1,seq),(1,0),(1,unit status),(1,channel status), (2, residual count)) is returned in indata. {The unit check bit in unit status will be off.}
If the write I/O operation is begun and completes within the long timeout and an error occurred, and the base did signal unit check status, a sense I/O operation is initiated.
If the sense I/O operation cannot be begun because the base or base subchannel has signaled an error condition, 9 is returned in c.
If the sense I/O operation is begun and does not complete within the long timeout, 14 is returned in c, and a Halt Device is issued to the base; when the sense I/O operation completes, any data and/or status returned will be lost.
In each of the above three cases, ((1,seq), (1,retried), (1,unit status), (1,channel status), (2, residual count from write I/O operation), (26,0)) is returned in indata.
If the sense I/O operation is begun and completes within the long timeout, 8 is returned in c and ((1,seq), (1,retried), (1, unit status), (1, channel status), (2, residual count from write I/O operation), (2,sc), (24, data from sense I/O operation)) is returned in indata. Sc is the number of bytes of data received from the sense I/O operation or 24, whichever is less. If fewer than 24 bytes are received from the sense I/O operation, they are padded on the right with zeros; if more are received, the extra are lost.
The unit status and channel status referred to in this section {(p2,tbasense)} are from the {write or read or reread} I/O operation prior to the sense I/O operation. The unit status and channel status, if any, from the sense I/O operation itself are lost.
If the read I/O operation is begun and does not complete within the long timeout, and this is not the first read of a "write then read", then 22 is returned in c and ((1,seq), (1, retried)) in indata. If this is the first read of a "write then read", 22 and seq and retried {which will be zero} may be returned as above, or 6 and nothing may be returned as when a write times out {in which case you won't be able to tell whether the write completed}. In all cases, a Halt Device is issued to the base; when the read I/O operation completes, any data and/or status returned will be lost.
If the read I/O operation is begun and completes within the long timeout and an error occurred and the base did not signal unit check status, 23 is returned in c and ((1,seq), (1, retried), (1, unit status), (1, channel status), (28,0), (rc, data from read I/O operation)) is returned in indata.
If the read I/O operation is begun and completes within the long timeout and an error occurred and the base did signal unit check status, a sense I/O operation is initiated. The result will be as above except the value returned in c will be 16 greater and (rc, data from read I/O operation) will be returned in indata following the information described above.
If the read I/O operation is begun and completes within the long timeout and no error occurred and either the number of bytes received was not 6 or those six bytes were not equal to (0, 255, seq, 2, seq, 2) or the abort flag is on, 0 is returned in c and ((1,seq), (1, retried), (30,0), (rc, data from read I/O operation)) in indata.
If the read I/O operation is begun and completes within the long timeout and no error occurred and the number of bytes received was 6 and those bytes were equal to (0, 255, seq, 2, seq, 2) and the abort flag is off, then a 0.2 second delay is begun. If the abort flag becomes on during the delay, the delay is ended and 0 is returned in c and (1,seq), (1, retried), (30,0), (rc, data from read I/O operation)) is returned in indata {as above}. Otherwise, at the end of the delay, seq is incremented {mod 256}, retried is set to 1, a new read I/O operation is initiated, and the action described above is repeated. {This operation is not prompt.}
Unit status is information from the base. Channel status is (IF a machine error has been detected in the information transferred to or from main storage during the I/O operation THEN 8 ELSE 0 FI + IF an invalid signal has occurred on the I/O interface THEN 2 ELSE 0 FI).
{Inlength should be at least 438 to ensure no data will be lost.}
The following summarizes the meanings of the return codes:
0 - Normal end of operation, non-trivial information read
1 - CC=1 {interrupt pending} on SIO
3 - CC=3 {not operational} on SIO
4 - Another operation is in progress
5 - Previous operation timed out and is not complete
6 - Timeout on write
7 - Error without unit check on write
8 - Error with unit check on write, sense operation completed
9 - error on write with unit check, sense can not be started, error on SIO
11 - error on write with unit check, sense can not be started, device not operational
14 - Timeout on sense after write error with unit check
17 - Read can not be started, error on SIO
19 - Read can not be started, base not operational
22 - Timeout on read
23 - Error without unit check on read
24 - Error with unit check on read, sense operation completed
25 - error on read with unit check, sense can not be started, error on SIO
27 - error on read with unit check, sense can not be started, device not operational
30 - Timeout on sense after read error with unit check
.Grab=9;.SP=FR; return code -1 0 1 3 4 5 6 7 8 9 11 14 17 19 22 23 24 25 27 30 (1, seq) - X X - - - - X X X X X X X X X X X X X (1, retried) - X 0 - - - - 0 0 0 0 0 X X X X X X X X (1,unit stat) - 0 X - - - - X X X X X X - - X X X X X (1, ch. stat) - 0 X - - - - X X X X X X - - X X X X X (2, res. cnt) - 0 - - - - - X X X X X - - - 0 X X X X (2, sns cnt) - 0 - - - - - - X 0 0 0 - - - 0 X 0 0 0 (24,sns data) - 0 - - - - - - X 0 0 0 - - - 0 X 0 0 0 (n,read data) - X - - - - - - - - - - - - - X X X X X.Ilev=2,0.15;.Lm=2,0.5;