HANDLE AID


The HANDLE AID command is used to specify the label or paragraph to which the control is to be passed when an AID key (e.g., ENTER, PF keys, PA keys) is pressed from a display device. This allows the program to branch to a specific label based on the key pressed by the user instead of manually checking EIBAID in conditional statements.

HANDLE AID is especially beneficial in applications with menus where different function keys activate various actions.

Syntax -

EXEC CICS HANDLE AID
     [ENTER(label-name1)]
     [CLEAR(label-name2)]
     [PA1(label-name3)]
     [PA2(label-name4)]
     [PA3(label-name5)]
     [PF1(label-name6)]
     [PF2(label-name7)]
     [PF3(label-name8)]
     [PF4(label-name9)]
     ...
     [PF24(label-name-n)]
     END-EXEC.
  • ENTER(label-name1) - Branches to label-name1 if the ENTER key is pressed.
  • PF1 - PF24 - Branches to corresponding label-name if a specific PF key (PF1 to PF24) is pressed.

How it works?

  • A user presses an AID key on a 3270 terminal.
  • CICS checks if the key is defined in a HANDLE AID statement.
  • If a matching key is found, CICS transfers control to the specified label.
  • The program executes the code at that label.
  • If no HANDLE AID is defined for a key, normal program execution continues.

Short Examples -


Scenario - COBOL program example demonstrates how to use CICS HANDLE AID to process user input based on AID keys.

...
DATA DIVISION.
WORKING-STORAGE SECTION.
...
PROCEDURE DIVISION.

    EXEC CICS HANDLE AID
         ENTER(PROCESS-ENTER)
         PF3(PROCESS-EXIT)
         PF7(PROCESS-SCROLL-UP)
         PF8(PROCESS-SCROLL-DOWN)
         END-EXEC.

    EXEC CICS RECEIVE
         MAP('SCREEN1')
         MAPSET('MAPSET1')
         INTO(WS-MESSAGE)
         END-EXEC.
	...
	...
PROCESS-ENTER.

    EXEC CICS SEND
         MAP('SCREEN1')
         MAPSET('MAPSET1')
         END-EXEC.
    ...
    ...
PROCESS-EXIT.

    EXEC CICS RETURN 
	END-EXEC.

PROCESS-SCROLL-UP.
    ...
    ...
PROCESS-SCROLL-DOWN.
    ...
    ...

The HANDLE AID command is used to define actions for specific AID keys. If ENTER is pressed, control jumps to the PROCESS-ENTER label. If PF3 is pressed, control jumps to PROCESS-EXIT to exit the program. If PF7 is pressed, the screen scrolls up (PROCESS-SCROLL-UP). If PF8 is pressed, the screen scrolls down (PROCESS-SCROLL-DOWN). If no defined key is pressed, the program continues normal execution.

Error Conditions -


Eror Condition RESP RESP2 Reason
INVREQ 16 The command was issued by a distributed program link server application.