The Check Active Object command provides a method of determining
whether an object is in use.
A typical command would be:
CHKACTOBJ OBJ(FILEX) OBJTYPE(*FILE)
MONMSG MSGID(CPF9898) EXEC(DO) /* In use */
Only object types which can be locked with *EXCL can be specified.
The typical object types that are excluded are described in the
OBJTYPE parameter description. Program object types are rejected
with a message that says 'Use the CHKACTPGM' command. You cannot
specify a device file (e.g. Printer or Display file) as they cannot
be locked by ALCOBJ.
The default for the command is to use ALLOCATE(*TEST). This means
that the object will attempt to be allocated to a *EXCL lock and then
unlocked if successful.
You can also specify *LOCK or *UNLOCK. Only *EXCL lock states are
requested. If you need a different lock type, you must use ALCOBJ.
Command parameters *CMD
OBJ The qualified object to be checked. The library
value defaults to *LIBL. *CURLIB may be specified.
OBJTYPE The object type to be checked. Only the values
supported by ALCOBJ that support *EXCL locks are
valid. This excludes such object types as *CLS,
*CMD, *DEVD, *JOBD, *JOBQ, *JRN, *JRNRCV, *LIB,
*OUTQ, and *TBL. Because there is a special command
used for program objects, *PGM is rejected with a
message recommending the use of CHKACTPGM.
ALLOCATE The type of allocation.
*TEST is the default and is used to determine if an
*EXCL lock can be achieved. This performs both an
allocate and deallocate function. If the object can
be locked, it is automatically unlocked on return.
A completion message is sent if successful.
The WAIT parameter on ALCOBJ is set to 2 seconds.
*LOCK may be specified meaning to attempt to lock
the object with an *EXCL lock. You can lock an
object more than once in the same job. Each lock is
unique. Therefore, if you use CHKACTOBJ with *LOCK
multiple times in the same program, you would have a
unique lock for each use. *UNLOCK may be specified
to unlock the object. The command will complete
normally regardless of whether a lock had been held
or not (assuming it is a valid object). The system
does not send an escape message if the object is not
currently locked by the same job.
MBR The member to be checked. *DFT is the default. If
a non-data base file is named, *DFT means there is
no member. If a data base file is named, *DFT
becomes *FIRST or the first member of the file.
The following TAA Tools must be on your system:
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CHKACTOBJ *CMD TAAOBJK QATTCMD
TAAOBJKC *PGM CLP TAAOBJKC QATTCL