Which transaction?
On receipt of an unsolicited input, how does CICS® determine which transaction to run? Typically the previous task with the same principal facility determines what transaction CICS runs next, using the TRANSID option on its final RETURN.

- 0.
- On the first input from a terminal, CICS sometimes schedules a
preliminary task before creating one to process the input. This task
runs the CICS-supplied
query
transaction, CQRY, which causes the terminal to transmit an encoded description of some of its hardware characteristics—extended attributes, character sets, and so on.CQRY allows the system programmer to simplify maintenance of the terminal network by omitting these particulars from the terminal definitions. It occurs only if the terminal definition so specifies, and has no effect on the subsequent determination of what transaction to use to process the input, which goes as follows.
- 1.
- If the terminal is a 3270 and the input is the “print request
key”, the CICS-supplied transaction that prints the contents of the
screen, CSPP, is initiated. See CICS print key in Printing display screens for more information about this
feature. For this purpose, a
3270 logical unit
or any other device that accepts the 3270 data stream counts as a 3270. - 2.
- If full BMS support is present, the terminal is of a type supported by BMS terminal paging, and the input is a paging command, the CICS-supplied transaction CSPG is initiated to process the request. BMS support levels are explained in BMS support levels, and the same section contains a list of the terminals that BMS supports. The PGRET, SKRxxxx, PGCHAIN, PGCOPY, and PGPURGE options in the system initialization table define the paging commands. As paging requires full BMS, this step is skipped if the CICS system contains less than that level.
- 3.
- If the terminal definition indicates that a specific transaction should be used to process all unsolicited inputs from that terminal, the indicated transaction is executed. (If present, this information appears in the TRANSACTION attribute of the TERMINAL definition.)
- 4.
- If the previous task at the terminal specified the TRANSID option of the RETURN command that ended it, the transaction named is executed.
- 5.
- If an attach function management header is present in the input, the attach names in the header are converted to a four-character CICS transaction identifier, and that transaction is executed.
- 6.
- If the terminal is a 3270, and the attention identifier is defined as a transaction, that transaction is executed. Attention keys in Input from a 3270 terminal explains attention identifiers. You define one as a transaction identifier with the TASKREQ attribute of the corresponding TRANSACTION definition.
- 7.
- If all the preceding tests fail, the initial characters of the input
are used to identify the transaction to be executed. The characters
used are the first ones (up to four) after any control information
in the data stream and before the first field separator character or
the next 3270 Control Character (X'00' to X'3F').
Field separators are defined in the FLDSEP option of the system initialization
table (the default is a blank).
If there are no such characters in the input, as occurs when you use the CLEAR key, for example, or if there is no transaction definition that matches the input, CICS cannot determine what transaction to execute and sends an
invalid transaction identification
message to the terminal.