AID Keys
AID (Attention Identifier) keys are special keys on a 3270 terminal keyboard that send a signal to CICS, indicating that the user has completed an action. These keys are used to trigger transaction processing, navigate between screens, or execute commands.
DFHAID is the system-defined copybook for AID keys, having definitions for the ENTER key, PF1 to PF24, PA1 to PA3, and CLEAR keys. AID keys can be included in the application program by copying the library member DFHAID (COPY DFHAID).
Some of the common AID keys and its function -
AID Key | Function |
---|---|
ENTER | Sends data to the CICS application. |
PF1 - PF24 | Function keys |
CLEAR | Clears the screen. |
PA1 - PA3 | Program attention keys used for system-level interactions. |
DFHAID Copybook layout with full set of keys specified below -
COPY DFHAID.
The copybook expansion look like -
*COPY DFHAID
01 DFHAID.
02 DFHNULL PIC X VALUE IS ' '.
02 DFHENTER PIC X VALUE IS ''''.
02 DFHCLEAR PIC X VALUE IS '_'.
02 DFHCLRP PIC X VALUE IS '¦'.
02 DFHPEN PIC X VALUE IS '='.
02 DFHOPID PIC X VALUE IS 'W'.
02 DFHMSRE PIC X VALUE IS 'X'.
02 DFHSTRF PIC X VALUE IS 'h'.
02 DFHTRIG PIC X VALUE IS '"'.
02 DFHPA1 PIC X VALUE IS '%'.
02 DFHPA2 PIC X VALUE IS '>'.
02 DFHPA3 PIC X VALUE IS ','.
02 DFHPF1 PIC X VALUE IS '1'.
02 DFHPF2 PIC X VALUE IS '2'.
...
02 DFHPF23 PIC X VALUE IS '.'.
02 DFHPF24 PIC X VALUE IS '<'.
How it works?
- A user presses an AID key (e.g., ENTER, PF3, PF7) on a 3270 terminal.
- CICS detects the keypress and stores the corresponding AID value.
- The program retrieves the AID value using the EIBAID field in the CICS EXEC Interface Block (EIB).
- The program processes the request based on the AID key pressed.
Once the AID key is pressed, CICS stores the information in the EIBAID field. We then need to compare the EIBAID value with each field definition from DFHAID to determine which functional key was pressed. The validation process shown below -
EVALUATE TRUE
WHEN EIBAID = DFHENTER
PERFORM PROCESS-ENTER-LOGIC
WHEN EIBAID = DFHPF3
PERFORM PROCESS-EXIT-LOGIC
WHEN EIBAID = DFHPF7
PERFORM PROCESS-SCROLL-UP-LOGIC
END-EVALUATE.
Short Examples -
Scenario - COBOL program reads user input and determines the action based on the AID key pressed.
...
DATA DIVISION.
WORKING-STORAGE SECTION.
...
PROCEDURE DIVISION.
EXEC CICS RECEIVE
MAP('SCREEN1')
MAPSET('MAPSET1')
INTO(WS-MESSAGE)
END-EXEC.
EVALUATE TRUE
WHEN EIBAID = DFHENTER
PERFORM PROCESS-ENTER-LOGIC
WHEN EIBAID = DFHPF3
PERFORM PROCESS-EXIT-LOGIC
WHEN EIBAID = DFHPF7
PERFORM PROCESS-SCROLL-UP-LOGIC
END-EVALUATE.
...
The program receives input from the user and checks the AID key using EIBAID. If the ENTER key (DFHENTER) is pressed, the program processes the input. If PF3 (DFHPF3) is pressed, the program exits. If PF7 (DFHPF7) is pressed, the screen scrolls up. For any other AID key, no action is taken.