Set Attention Program (SETATNPGM)

The Set Attention Program (SETATNPGM) command sets up a program that is called when the Attention key is pressed. The setting is in effect for this recursion level and lower levels if more programs are called, but it is no longer in effect if the job returns from this recursion level to the previous one. If the Attention key handler's status is on, the specified program is called when the key is pressed. No parameters are passed to the Attention key handler when it is called. The Attention handling program runs in the same process with the same job attributes, overrides, and group authorities as the program that issued the SETATNPGM command. However, program adopted authority is not carried over.

The handling of the attention key does not change the auxiliary storage pool (ASP) group that is in effect. The ASP group determines the library name space of the thread. If the attention handling program resides in an independent ASP and if that ASP is not part of the library name space for the thread at the time the attention key is handled, the intended program will not be found. To avoid potential problems when applications change the library name space, the program should reside in the system ASP or a basic user ASP.

Parameters

Keyword Description Choices Notes
PGM Program Single values: *CURRENT, *PRVINVLVL
Other values: Qualified object name
Required, Positional 1
Qualifier 1: Program Name
Qualifier 2: Library Name, *LIBL, *CURLIB
SET Set attention key *ON, *OFF Optional, Positional 2

Program (PGM)

Specifies the qualified name of the program to be the Attention key handler at this recursion level.

This is a required parameter.

Single values

*CURRENT
The program name of the Attention key handler currently in effect is used as the value of this parameter.
*PRVINVLVL
The Attention key handler in effect at the previous recursion level is reinstated as the Attention key handler at this recursion level. The Set attention key (SET) parameter is not allowed if this special value is specified, because the SET status of the previous recursion level is also reinstated. This option is used when a program has specified an Attention program and wants to revert back to a previous level.

Qualifier 1: Program

name
Specify the name of the Attention key handler program.

Qualifier 2: Library

*LIBL
All libraries in the thread's library list are searched until a match is found.
*CURLIB
The current library for the thread is used to locate the object. If no library is specified as the current library for the thread, the QGPL library is used.
name
Specify the library where the attention program is located.

Set attention key (SET)

Specifies whether the Attention key handler indicated in the Program (PGM) parameter is called when the Attention key is pressed. This parameter is not allowed if *PRVINVLVL is specified for the PGM parameter.

*ON
The Attention key handler specified in the Program (PGM) parameter is called when the Attention key is pressed.
*OFF
The Attention key handler specified in the Program (PGM) parameter is not called when the Attention key is pressed.

Examples

Example 1: Setting the ATTN Key Handler

SETATNPGM   PGM(QGPL/ATTN)  SET(*ON)

This command causes the program QGPL/ATTN to become the ATTN key handler. Because SET(*ON) is specified, the program is called when the ATTN key is pressed.

Example 2: Setting the Attention Key Off

SETATNPGM   PGM(*CURRENT)  SET(*OFF)

The current attention handling program has its status changed to SET(*OFF). Because the status is SET(*OFF) when the ATTN key is pressed, the attention handling program is not called.

Example 3: Previous Recursion-Level Support

SETATNPGM   PGM(*PRVINVLVL)

The attention handling program and status that was in effect at the previous recursion level is reinstated at this recursion level. If no attention handler is in effect, after this command is run nothing happens when the ATTN key is pressed.

Example 4: Emulating the System Request Key

SETATNPGM   PGM(QWSSYSRQ)

The system-supplied program QWSSYSRQ will be called when the ATTN key is pressed. This system program allows the ATTN key to act as a system request key by showing the system request menu on the display when the ATTN key is pressed.

Error messages

*ESCAPE Messages

CPF1318
Attention key program &1 in &2 not set.