Considerations for specifying RETKEY and RETCMDKEY keywords
Considerations for specifying RETKEY and RETCMDKEY keywords
These rules must be considered when you specify the RETKEY and RETCMDKEY keywords.
- The file must specify a separate indicator area (INDARA keyword).
- RETKEY and RETCMDKEY are ignored on the first output operation after a file is opened. The retain function is valid only between record formats in the same display file.
- The response indicator of the VLDCMDKEY keyword is set by the IBM i program according to the current valid command keys, including the keys retained when you specify the RETKEY and RETCMDKEY keywords.
- Neither keyword is allowed on a subfile format (SFL keyword) or on a user-defined record (USRDFN keyword).
- You cannot specify either RETKEY or RETCMDKEY in a file that contains the ALTHELP, ALTPAGEUP, or ALTPAGEDWN keyword.
Option indicators are not valid for these keywords.
Example
The following example shows how to specify the RETKEY and RETCMDKEY keywords.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A INDARA
A R RECORD1 CFO1(01 'EXIT SCREEN')
A CFO2(02 'SET ON IN02')
A ROLLUP(03)
A 08 CLEAR(03 'CLEAR KEY')
A 1 3'COMPANY NAME'
A 1 25'CF01 TO EXIT'
A R RECORD2 RETKEY
A RETCMDKEY
A OVERLAY
A FIELD1 4A B 5 5
A R RECORD3 RETKEY
A CF01(90 'ALTERNATE CF01')
A FIELD1 10A B 7 5
A
The records are displayed in the following order: RECORD1, RECORD2, RECORD3.
When RECORD1 is displayed, CF01, CF02, Clear, and Page Up keys are activated. The same keys are valid for RECORD2, because RETKEY and RETCMDKEY are specified. Because RECORD3 specifies RETKEY, the Clear and Page Up keys are valid. CF01 has been redefined for this record. CF02 is not valid for this record.
Note: The retain function does not require the record format to be displayed. (RECORD3 uses function keys defined in RECORD1, but because no OVERLAY keyword is specified in RECORD3, the display is erased before RECORD3 is displayed.)