UNLOCK (Unlock) keyword for display files
You use this record-level keyword to specify that the IBM® i operating system is to unlock the keyboard immediately after issuing an input operation to the record format you are defining.
Without the UNLOCK keyword, the IBM i operating system leaves the keyboard locked after reading the data on the display. The workstation user cannot key data into input-capable fields while the data that has just been read is being processed.
UNLOCK[(*ERASE) | (*MDTOFF)] | [(*ERASE *MDTOFF)] | [(*MDTOFF *ERASE)]
The parameter values *ERASE and *MDTOFF are optional. If you do not specify any parameter value, *ERASE is the default.
When your program sends an input operation, the following sequence of operations typically occurs:
- The keyboard is unlocked (if it is not already unlocked) to allow the workstation user to key into input-capable fields on the display.
- The workstation user presses the Enter key (or a valid function key).
- Modified data tags (MDTs) for input-capable fields in the record format are set on if they have been typed into or if they were displayed with the DSPATR(MDT) keyword in effect.
- When the input operation is completed, the parameter values for UNLOCK affect the input-capable fields with MDTs set on as described in the following sections.
UNLOCK (without GETRETAIN) or UNLOCK(*ERASE)
The keyboard remains unlocked, input-capable fields on the display are erased, and their MDTs remain on following the input operation.
UNLOCK(*MDTOFF) or UNLOCK (with GETRETAIN)
The keyboard remains unlocked, input-capable fields on the display are not erased, and their MDTs are set off following the input operation.
UNLOCK(*ERASE *MDTOFF) or UNLOCK(*MDTOFF *ERASE)
The keyboard remains unlocked, input-capable fields on the display with their MDTs set on are erased, and their MDTs are set off following the input operation.
The GETRETAIN keyword is ignored and an error message results at file creation time if the GETRETAIN keyword is specified with UNLOCK(any parameter).
Option indicators are not valid for this keyword.
Example
The following example shows how to specify the UNLOCK keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A R RECORD1 UNLOCK(*ERASE)
00020A FLD1 4 B 2 2
00030A FLD2 4 B 3 2
A
00040A R RECORD2 UNLOCK(*MDTOFF)
00050A FLD21 4 B 4 2
00060A FLD22 4 B 5 2
A
00070A R RECORD3 UNLOCK(*ERASE *MDTOFF)
00080A FLD31 4 B 6 2
00090A FLD32 4 B 7 2
A