*---------*---------------*-----------------*----------------*---------------* | CODE | FACTOR 1 | FACTOR 2 | RESULT | INDICATORS | | | | | FIELD | | *---------*---------------*-----------------*----------------*---------------* | UNLCK | | Data area or | | _ ER _ | | | | file name | | | *---------*---------------*-----------------*----------------*---------------*
The UNLCK operation is used to unlock data areas and release record locks in a program. The data area must already be specified in the result field of an *NAMVAR DEFN statement. If the UNLCK operation is specified to an already unlocked data area, an error does not occur.
In addition, the UNLCK operation allows the most recently locked record to be unlocked for an update disk file.
Factor 2 must contain the name of the data area to be unlocked, the name of an update disk file, or the reserved word *NAMVAR. When *NAMVAR is specified in factor 2, all data areas in the program that are locked are unlocked. Factor 2 must not refer to the local data area or the Program Initialization Parameters (PIP) data area.
The file specified in factor 2 must be an UPDATE disk file.
You can specify a resulting indicator in positions 56 and 57 to be set on if an error occurs on the operation. Positions 54, 55, 58, and 59 must be blank.
*...1....+....2....+....3....+....4....+....5....+....6....+....7... FFilenameIPEAF....RlenLK1AIOvKlocEDevice+......KExit++Entry+A....U F* FUPDATA UF E DISK F* C* Assume that the file UPDATA contains record format VENDOR. C* A record is read from UPDATA. Since the file is an update C* file, the record is locked. If *IN50 is on, the record is C* updated; otherwise the record is unlocked using the UNLCK C* operation. Note that factor 2 of the UNLCK operation is the C* file name, UPDATA, not the record name, VENDOR. C* CL0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments++++++ C* C READ VENDOR 12 : C* *IN50 IFEQ *ON C* UPDATVENDOR Update record C ELSE C UNLCKUPDATA 99 Release record C ENDIF C*
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.