Where allowed to run: All environments (*ALL) Threadsafe: Yes |
Parameters Examples Error messages |
The Check Object (CHKOBJ) command checks object existence and verifies the user's authority for the object before trying to access it. If the object exists and the user has the proper authority for the object, no error messages are sent to the user. For verification, as many as ten specific authorities can be specified on the command.
These checks are particularly useful before the user tries to access several objects at the same time. This command is also used to check the validity of object names contained in CL variables and to verify object authorizations under program control.
When the command runs, the system searches for the specified object. If the object is found, the system verifies that the user is authorized to that object as specified for the Authority (AUT) parameter. If the object is not found or the user does not have the authorities specified for the AUT parameter, an error message is sent to the user.
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
OBJ | Object | Qualified object name | Required, Positional 1 |
Qualifier 1: Object | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
OBJTYPE | Object type | *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, *SRVPGM, *SSND, *SVRSTG, *S36, *TBL, *TIMZON, *USRIDX, *USRPRF, *USRQ, *USRSPC, *VLDL, *WSCST | Required, Positional 2 |
MBR | Member, if data base file | Name, *NONE, *FIRST | Optional, Positional 3 |
AUT | Authority | Single values: *NONE, *ALL, *CHANGE, *USE, *EXCLUDE, *AUTLMGT Other values (up to 10 repetitions): *OBJALTER, *OBJEXIST, *OBJMGT, *OBJOPR, *OBJREF, *ADD, *DLT, *EXECUTE, *READ, *UPD |
Optional, Positional 4 |
Top |
Specifies the object to be checked.
This is a required parameter.
Qualifier 1: Object
Qualifier 2: Library
Top |
Specifies the object type of the object to be checked.
To see a complete list of object types when prompting this command, position the cursor on the field for this parameter and press F4 (Prompt). For a description of the object types, see "Object types" in the CL concepts and reference topic in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.
This is a required parameter.
Top |
Specifies the file member, if a member of a database file is to be checked.
Note: The logical file member, and the physical file members on which it is based are checked.
Top |
Specifies the authority to be checked or specifies an authorization list to be checked. This parameter can be specified as a single value or as a list of one or more elements.
Single values
Note: You must use the object type of *AUTL when you specify *AUTLMGT authority.
Other values (up to 10 repetitions)
Top |
Example 1: Checking for Existence of a Program
CHKOBJ OBJ(LIB1/PROG1) OBJTYPE(*PGM)
This command checks for the existence of a program named PROG1 in library LIB1. Your authorities to PROG1 are not checked.
Example 2: Checking for User's Authority to File
CHKOBJ OBJ(SOURCE1) OBJTYPE(*FILE) MBR(MBR3) AUT(*CHANGE)
This command checks for the existence of file SOURCE1 and for the existence of member MBR3 in file SOURCE1. It also checks to see if you have change (*CHANGE) authority to file SOURCE1.
Example 3: Checking for Your Authority to Program
CHKOBJ OBJ(LIB1/PROG1) OBJTYPE(*PGM) AUT(*CHANGE)
This command checks the existence of program PROG1 in library LIB1. It also checks to see if you have change (*CHANGE) authority to PROG1.
Example 4: Checking User's Authority to a Logical File Member
CHKOBJ OBJ(FILEA) OBJTYPE(*FILE) MBR(MBR1) AUT(*USE)
This command checks your authority to use logical file member MBR1, and each physical file member on which MBR1 is based.
Example 5: Checking User's Add and Delete Authority
CHKOBJ OBJ(FILEA) OBJTYPE(*FILE) MBR(MBR1) AUT(*ADD *DLT) MONMSG MSGID(CPF9802) EXEC(GOTO ERROR1)
These two commands (CHKOBJ and MONMSG) are used to verify that you have both add (*ADD) and delete (*DLT) authorities for logical file FILEA and each of the physical file members on which the logical file member MBR1 in the logical file FILEA is based. If you do not have data authority for FILEA and each of the physical file members on which FILEA is based, escape message CPF9802 is sent to the program, and control in the program is passed to the command that has the label ERROR1.
Top |
*ESCAPE Messages
Top |