Command reference / object
CHKOBJ
Check Object
Checks that an object exists and that the user has the specified authority before the program accesses it. If the object exists and the authority is held, no error is sent. Up to ten specific authorities can be checked. Useful before accessing several objects, for validating object names in CL variables, and for verifying authorizations under program control. If the object is not found or the authority is missing, an error message is sent to the user.
Allowed environments: *ALL.
Positional parameters: 4.
Parameters
OBJ
Object
Specifies the object to be checked. Qualified as object name plus library name.
*LIBL- All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB- The current library for the thread is searched. If none is set, the QGPL library is searched.
Qualified parts (object, then library; write LIBRARY/OBJECT)
Object
Object
Library
Library
Suggested / special values:
*LIBL, *CURLIB
OBJTYPE
Object type
Specifies the object type of the object to be checked. The page lists about 100 values (for example *PGM, *FILE, *DTAARA) without per-value meanings, so they are not itemized here.
Allowed values:
*ALRTBL, *AUTL, *BNDDIR, *CFGL, *CHTFMT, *CLD, *CLS, *CMD, *CNNL, *COSD, *CRG, *CRQD, *CSI, *CSPMAP, *CSPTBL, *CTLD, *DEVD, *DOC, *DTAARA, *DTADCT, *DTAQ, *EDTD, *EXITRG, *FCT, *FILE, *FLR, *FNTRSC, *FNTTBL, *FORMDF, *FTR, *GSS, *IGCDCT, *IGCSRT, *IGCTBL, *IMGCLG, *IPXD, *JOBD, *JOBQ, *JOBSCD, *JRN, *JRNRCV, *LIB, *LIND, *LOCALE, *MEDDFN, *MENU, *MGTCOL, *MODD, *MODULE, *MSGF, *MSGQ, *M36, *M36CFG, *NODGRP, *NODL, *NTBD, *NWID, *NWSCFG, *NWSD, *OUTQ, *OVL, *PAGDFN, *PAGSEG, *PDFMAP, *PDG, *PGM, *PNLGRP, *PRDDFN, *PRDLOD, *PSFCFG, *QMFORM, *QMQRY, *QRYDFN, *RCT, *SBSD, *SCHIDX, *SPADCT, *SQLPKG, *SQLUDT, *SQLXSR, *SRVPGM, *SSND, *SVRSTG, *S36, *TBL, *TIMZON, *USRIDX, *USRPRF, *USRQ, *USRSPC, *VLDL, *WSCST
MBR
Member, if data base file
Specifies the file member to be checked, if a member of a database file is to be checked. A logical member is checked along with the physical members it is based on.
Suggested / special values:
*NONE, *FIRST
*NONE- Database file members are not checked. The existence and optionally the authority of the file are checked. For all other object types, including device files, *NONE is the only valid value.
*FIRST- The first member of the specified file is used.
AUT
Authority
Specifies the authority to be checked, or an authorization list to be checked. Can be a single value or a list of one or more elements, up to ten.
Allowed values:
*NONE, *ALL, *CHANGE, *USE, *EXCLUDE, *AUTLMGT, *OBJALTER, *OBJEXIST, *OBJMGT, *OBJOPR, *OBJREF, *ADD, *DLT, *EXECUTE, *READ, *UPD
*NONE- Authority is not checked.
*ALL- Provides the authority to perform all operations except those limited to the owner or to *AUTLMGT authority. Includes control of existence, security, change and ownership.
*CHANGE- Provides the authority to perform all operations except owner-limited and *OBJEXIST/*OBJMGT operations. Includes *OBJOPR and all data authority. For an authorization list, users cannot be added, changed or removed.
*EXCLUDE- Prevents access to the object.
*AUTLMGT- Provides the authority to add, change or remove users on an authorization list, rename it, or duplicate it. Must be used with OBJTYPE(*AUTL).
*OBJALTER- Authority to alter object attributes. For database files, add or remove triggers and constraints and change file attributes. For SQL packages, change package attributes.
*OBJEXIST- Authority to control object ownership and existence, needed to delete, free storage, save, restore or transfer ownership.
*OBJMGT- Authority to set object security, move or rename the object, and add members to database files.
*OBJOPR- Authority to look at the object description and use the object, subject to the user's data authority.
*OBJREF- Authority to reference the object from another object, such as a parent in a referential constraint on a physical file.
*ADD- Authority to add entries to an object, such as job entries to a queue or records to a file.
*DLT- Authority to remove entries from an object.
*EXECUTE- Authority to run a program or locate an object in a library or directory.
*READ- Authority to show the contents of an object.
*UPD- Authority to change the entries in an object.
Examples
CHKOBJ OBJ(LIB1/PROG1) OBJTYPE(*PGM)
Checks that program PROG1 exists in library LIB1. Your authorities to PROG1 are not checked.
CHKOBJ OBJ(SOURCE1) OBJTYPE(*FILE) MBR(MBR3) AUT(*CHANGE)
Checks that file SOURCE1 and member MBR3 exist, and that you have *CHANGE authority to SOURCE1.
Generated from os/cl/catalog/CHKOBJ.json and os/cl/help/CHKOBJ.json.