Previous Topic: INPUT CommandNext Topic: Create Alternate Screens


COMPARE and BRANCH Statements

The variable &TAID in the following COMPARE statements represents the key pressed by the user; that is, the last AID (attention identifier) byte received from the terminal in response to the INPUT command. If the user presses PF1, for example, &TAID is given a value of PF1.

COMPARE '&TAID','PF1' 
BRANCH EQ,SYS1

The COMPARE statement compares the value of &TAID with "PF1" and sets a condition code that is used by the BRANCH statement. If the condition code is EQ (indicating that the user pressed the PF1 key) the program goes to the statement labeled SYS1, which displays the System 1 News screen. If the condition code is NE (indicating that the user did not press PF1), the program goes to the next statement, which is another COMPARE statement.

The following COMPARE statement compares the value of &TAID with "PF2" and sets a condition code that is used by the BRANCH statement:

COMPARE '&TAID','PF2' 
BRANCH EQ,SYS2

If the condition code is EQ (indicating that the user pressed the PF2 key) the program goes to the statement labeled SYS2, which displays the System 2 News screen. If the condition code is NE (indicating that the user did not press PF2), the program goes to the next statement, which checks to see if the user pressed PF3. If the user did press PF3, the BRANCH statement terminates the ACL/E program.

The program uses the same logic to determine whether it should return to the menu from a news screen. If the user presses PF3 while viewing a news screen, the program returns to the statement labeled MNU that displays the menu screen (MNU001).