7 55 2 IF_KEY Comments Warnings

LANSA Technical

7.55.2 IF_KEY Comments / Warnings

  • The IF_KEY command should only be used after a command that uses the workstation such as DISPLAY, REQUEST, POP_UP or BROWSE has been executed. Using an IF_KEY command before any interaction with a workstation will produce unpredictable results.
  • The value *PROMPT allows tests to be made for the use of the prompt key. However in most RDML programs the prompt key is handled automatically because the associated parameter is coded as PROMPT_KEY(*YES *AUTO). To avoid having the prompt key handled automatically code PROMPT_KEY(*YES *NEXT) or PROMPT_KEY(*YES L10) where L10 is a command label. In these cases the prompt key is deemed to be handled by the RDML program, and thus the IF_KEY command can be used to test for its use.
  • The test values *CANCEL, *EXITHIGH and *EXITLOW are provided for complete compatibility with SAA/CUA function key assignments. Do not use these values in non-SAA/CUA applications.
  • *CANCEL is functionally identical to *MENU.
  • When testing for *EXITHIGH and *EXITLOW ensure that the associated DISPLAY, REQUEST or POP_UP command correctly enables either the exit high key or the exit low key via the EXIT_KEY parameter. It is not possible to enable a high and low exit on the one DISPLAY, REQUEST or POP_UP command.
  • The LANSA dictionary contains a special field called #IO$KEY which always contains the last function key used during a workstation interaction. This can be tested in an IF or CASE statement like any other field. In some situations using this field in an IF or CASE command is a better solution than using the hybrid IF_KEY command.

     An example of using this field follows:

    DISPLAY   USER_KEYS((15 'Purge')(16 'Commit')(17 'Save') (*ROLLUP 'Up')(*ROLLDOWN 'Down'))
 
    CASE      OF_FIELD(#IO$KEY)
           WHEN      VALUE_IS('= ''15''')
           WHEN      VALUE_IS('= ''16''')
           WHEN      VALUE_IS('= ''17''')
           WHEN      VALUE_IS('= ''UP''')
           WHEN      VALUE_IS('= ''DN''')
    ENDCASE
 

     Field #IO$KEY can be compared for normal function key use by using the function, key number (ie: 01 to 24). However, some other values may occur in #IO$KEY during an RDML programs execution. These include the following:   'RA' - The record advance / enter key was used    'UP' - The roll up key was used    'DN' - The roll down key was used   These values are referred to as AIDS values and are actually part of the i5/05 operating system.

  • If a DISPLAY, REQUEST or POP_UP command has been executed that enables the roll up (*ROLLUP) or roll down (*ROLLDOWN) keys, and a browse list is also displayed, control will not actually return to the RDML program until the user rolls off either "end" of the browselist.

For instance if a browse list is filled with 42 entries (assume 15 entries are displayed on each "page" of the display) and then displayed, the roll up key processing is handled automatically by the i5/05 operating system until the 3rd use. On the 3rd use the user has attempted to roll off the "end" of the browselist, thus control is returned to the RDML program. Roll down processing is handled similarly.