Set-and-Test-Sequence-Numbers (STSN)

Message resynchronization is initiated by IMS when it sends the set-and-test-sequence-numbers (STSN) command to the workstation.

The STSN command contains a 5-byte data field:
Byte 0
Action code
Bytes 1, 2
Controller sequence number of the last inbound sync-point message IMS received from the workstation
Bytes 3, 4
VTAM® sequence number of the last outbound sync-point message IMS sent to the workstation
IMS uses the action code to ask the SLU P system to verify the controller and VTAM sequence numbers. The bits of the action code byte are:
Bits 0, 1
Refer to the controller sequence-number field
Bits 2, 3
Refer to the VTAM sequence-number field
Bits 4, 5, 6, and 7
Reserved
The following values are acceptable for bits 0, 1, 2, and 3 of the action code:
00 IGNORE
Not used by IMS.
01 SET
Set the appropriate sequence number to the value indicated in the sequence-number field.
10 INVALID
Not used by IMS. The SLU P system must return its version of the sequence number in the command response.
11 SET AND TEST
Set the appropriate sequence number to the value indicated in the sequence-number field. The SLU P system must indicate in the command response whether the sequence number values are acceptable.

IMS uses the SET option for the controller sequence number. For the VTAM sequence number, IMS uses either SET or SET AND TEST. SET is used when no acknowledgment to a recoverable output message is outstanding from the previous session. SET is also used when the IMS master terminal operator enters the /DEQUEUE or /ASSIGN commands that cause the last recoverable message to be removed from the queue. SET AND TEST is used if IMS sends a recoverable message to the workstation but does not receive the required acknowledgment prior to session termination. The response sent by the SLU P system to the STSN command indicates whether the workstation received the message.

When the SLU P system receives the STSN command, it must be able to:
  • Verify the controller sequence number and arrange to retransmit a message to IMS if required.
  • Verify the VTAM sequence number and inform IMS whether the number is acceptable.
  • Return a DR1 to IMS and, if required, return a 5-byte data response to the STSN command.

To verify the controller sequence number, the SLU P system compares the number provided by IMS with the number it maintained from the previous session. An equal compare indicates that IMS received all messages sent by the workstation. If the IMS-provided number is smaller, IMS did not receive the last inbound sync-point message sent by the workstation. These two numbers can differ by more than 1 if intervening irrecoverable or chained messages were sent by the workstation when the workstation was defined with the ACK option. A message that was not received by IMS should be retransmitted after message resynchronization is complete. If a copy of the message was maintained, that copy could be sent. Otherwise, the SLU P system can inform the workstation operator that the last inbound recoverable message was not received by IMS.

To verify the VTAM sequence number, the SLU P system compares the number provided by IMS with the number it maintained from the previous session. An equal compare indicates that the workstation has received all messages. If the IMS-provided number is unequal, the workstation did not receive the last outbound recoverable message.

The response to the STSN command indicates the results of the synchronization tests to IMS. The SLU P system must return a DR1 and, optionally, 5 bytes of data. If both the controller and VTAM sequence numbers are acceptable, only the DR1 is required. If one or both of the sequence numbers are not acceptable, a DR1 and the 5-byte data response are required. The format of the data response has the same format as the STSN command:
Byte 0
Action code
Bytes 1, 2
Controller sequence number of the last inbound recoverable message the workstation sent to IMS
Bytes 2, 3
VTAM sequence number of the last outbound recoverable message the workstation received from IMS
The SLU P system uses the action code to indicate the test results. The bits of the action code byte are:
Bits 0, 1
Refer to the controller sequence-number field
Bits 2, 3
Refer to the VTAM sequence-number field
Bits 4, 5, 6, and 7
Reserved
The following values are acceptable for bits 0, 1, 2, and 3 of the action code:
00 RESET
The sequence number in the command is unacceptable and should be reestablished at its previous value. This code should never be returned to IMS.
01 TEST POSITIVE
The sequence number in the command is acceptable. This code must be returned in response to the SET option. If the SET AND TEST option is specified and the SLU P system finds the sequence number acceptable, TEST POSITIVE should be returned.
10 INVALID
The SLU P system has detected an error in the sequence number.
11 TEST NEGATIVE
The SLU P system does not agree with the sequence number presented with the SET AND TEST option.

TEST POSITIVE is the only acceptable response to the SET option. TEST POSITIVE and TEST NEGATIVE are acceptable responses to the SET AND TEST option. INVALID should be used if the SLU P system detects a should-not-occur condition when comparing the sequence numbers. An example of this condition is a controller sequence number specified in the command that is higher than the application program's copy of the sequence number.

If IMS receives a TEST NEGATIVE response to the SET option, a RESET response, or an INVALID response, it terminates the session.

When returning any action code except TEST POSITIVE, the SLU P system should use the STSN response to return its version of the sequence numbers. The sequence numbers can be valuable information during problem determination and debugging. Any value can be returned, because IMS does not use the returned values. A TEST NEGATIVE response is all that is required to indicate that the sequence number is not acceptable.

When IMS receives the STSN response, it sends the start-data-traffic (SDT) command to the workstation. The SDT command allows normal message transmission to begin. If IMS receives a TEST NEGATIVE response to the SET AND TEST option, it sends the SDT command and retransmits the last recoverable message followed by any other available output. When IMS receives a TEST POSITIVE response to the SET AND TEST option, it sends the SDT command, dequeues the last recoverable message, and sends any other available output.

The contents of the STSN command as received from IMS and the resulting actions of the SLU P system and VTAM are summarized in the following table.

Table 1. Set-and-Test-Sequence-Numbers (STSN) summary
Remote system number action code VTAM number action code Controller sequence number1 VTAM sequence number1 Remote system action when STSN received VTAM action when STSN received
01 set   Last inbound sync point message that IMS received   Set controller sequence number field to value indicated in STSN controller field. Set VTAM value to value indicated in STSN controller field.
  01 set   Last outbound sync point message that IMS sends, and responded to by station. Set host sequence number field to value indicated in VTAM field of STSN. Set VTAM's last assigned value to value in VTAM field of STSN.
  11 set and test   Last recoverable message that IMS sends; no response from station received. Set host sequence number field to value indicated in VTAM field of STSN. Set VTAM's last assigned value to value in VTAM field of STSN.
Note:
  1. The controller and VTAM sequence number fields can contain any value.

The valid SLU P system responses to the STSN command and the resulting IMS actions are summarized in the following tables.

Table 2. STSN response summary when the action code is the remote system number
Remote system action code value Response action code must be1: IMS action when response received
01 set 01 test positive Send SDT to station
Note:
  1. Any other response causes IMS to terminate the session.
Table 3. STSN response summary when the action code is the VTAM number
VTAM number action code value Response action code must be1: IMS action when response received
01 set 01 test positive Send SDT to station
11 set and test 01 test positive Dequeue last recoverable message and send SDT to station
11 set and test 11 test negative Send SDT to station and retransmit last recoverable message.
Note:
  1. Any other response causes IMS to terminate the session.