Sequence number management
An understanding of how sequence numbers are handled during normal message transmission is prerequisite to understanding how and why the SLU P system performs the functions described in this topic.
The management of sequence numbers is shared between the controller, VTAM®, and the VTAM application program (IMS). The controller assigns sequence numbers to messages originated by its workstations. VTAM assigns VTAM sequence numbers to messages originated by IMS. To ensure recoverability, IMS maintains a separate copy of the sequence numbers associated with the messages it sends.
Sequence numbers are assigned to each workstation. For each workstation, the controller tracks the last sequence number that it assigns (called the last-assigned value), and tracks the last sequence number that it receives (called the last-received value). Similarly, IMS tracks the last sequence number that VTAM assigns (called the last-assigned value), and tracks the last sequence number it receives (called the last-received value).
When the controller issues a request to transmit data, it updates its last assigned value for the requesting workstation, appends the new number to the data, and sends the message. When VTAM receives the message, it merely passes it on to IMS. IMS, in turn, adds 1 to its last received value for that workstation and compares this value with the sequence number of the message it just received. If the two numbers match, IMS processes the message as required. If the two numbers do not match, IMS issues a VTAM CLSDST macro instruction to terminate the session.
When IMS has a message to transmit, it updates its copy of VTAM's last assigned value and sends the message to VTAM. VTAM updates its last assigned value, appends the new number to the message, and sends the message. The controller removes the appended sequence number, updates its last received value, and compares this value with the sequence number that accompanied the message. If the two numbers match, the controller sends the message on to the application program. If the two numbers do not match, the controller returns an exception DR2 to indicate a sequence error. When IMS receives the sequence error indication, it issues a VTAM CLSDST macro instruction to terminate the session.