Command reference / object
ALCOBJ
Allocate Object
Reserves one or more objects, or a list of them, for use later in the job or thread. If an object needed by the job was not allocated with this command, allocation is attempted automatically when it is used. Job-scoped locks are released when the job ends and thread-scoped locks when the thread ends. Use DLCOBJ to deallocate.
Allowed environments: *ALL.
Positional parameters: 2.
Restrictions
- Cannot allocate a *DEVD device description for an APPC or INTRA device.
- Only physical, logical, distributed, and DDM database files can be allocated.
- The object must exist on the system.
- The user needs *OBJOPR authority on the object and *EXECUTE authority on its library.
- If allocation fails, none of the locks are granted and a message is sent; MONMSG can detect the result.
Parameters
OBJ
Object specifications
Names the objects to allocate, each with its object type, lock state, and member name for database files. Up to 50 values. Required.
*LIBL- Search the thread's library list until a match is found.
*CURLIB- Use the thread's current library, or QGPL if none is set.
*SHRRD- Shared for read.
*SHRNUP- Shared, no update.
*SHRUPD- Shared for update.
*EXCLRD- Exclusive, allow read.
*EXCL- Exclusive, no read.
*FIRST- Allocates the first member of the database file.
Elements in order
Object
Object
Qualified parts (object, then library; write LIBRARY/OBJECT)
Object
Object
Library
Library
Suggested / special values:
*LIBL, *CURLIB
Object type
Object type
Allowed values:
*AUTL, *BNDDIR, *CLD, *CRQD, *CSI, *CSPMAP, *CSPTBL, *DEVD, *DTAARA, *DTADCT, *DTAQ, *FCT, *FILE, *FNTRSC, *FNTTBL, *FORMDF, *IMGCLG, *IPXD, *LIB, *LOCALE, *MEDDFN, *MENU, *MGTCOL, *MODULE, *MSGQ, *NODL, *NTBD, *NWSCFG, *NWSD, *OVL, *PAGDFN, *PAGSEG, *PDFMAP, *PDG, *PGM, *PNLGRP, *PSFCFG, *QMFORM, *QMQRY, *QRYDFN, *SBSD, *SCHIDX, *SQLPKG, *SQLXSR, *SRVPGM, *SSND, *S36, *TIMZON, *USRIDX, *USRQ, *USRSPC, *VLDL, *WSCST
Lock state
Lock state
Allowed values:
*SHRRD, *SHRNUP, *SHRUPD, *EXCLRD, *EXCL
Member, if data base file
Member, if data base file
Suggested / special values:
*FIRST
WAIT
Wait time
Seconds the program waits for the objects to be allocated. If allocation times out, a message is sent that MONMSG can detect. Valid values are 0 through 32767.
Suggested / special values:
*CLS
*CLS- Uses the default wait time in the class description used by the routing step.
SCOPE
Lock scope
Sets the scope of the lock request: job, thread, or lock space.
Allowed values:
*JOB, *THREAD, *LCKSPC
*JOB- The lock is scoped to the job.
*THREAD- The lock is scoped to the thread.
*LCKSPC- The lock is scoped to the lock space attached to the current thread, or to the job if none is attached.
CONFLICT
Lock conflict action
Sets the action taken on a lock conflict. Only supported for database files; ignored for other objects.
Allowed values:
*NORQSRLS, *RQSRLS
*NORQSRLS- No requests are sent to jobs or threads holding conflicting locks.
*RQSRLS- Sends a release request to system code in jobs or threads holding conflicting locks. Only implicitly acquired locks can be released.
MIRROR
Mirror
Sets whether the command runs on the target node when the object is replicated by Db2 mirror. Supported for database files, data areas, user spaces, and user indexes; ignored for other objects.
Allowed values:
*YES, *NO
*YES- The command runs on both the source and target nodes.
*NO- The command runs only on the source node; the request is not replicated.
Examples
ALCOBJ OBJ((LIBB/FILEA *FILE *EXCL MEMBERA)) SCOPE(*JOB) WAIT(60)
Exclusively allocates member MEMBERA of file FILEA in library LIBB to the job, waiting up to 60 seconds for it to become available.
ALCOBJ OBJ((LIBY/DATAAREAX *DTAARA *EXCL )) SCOPE(*THREAD)
Exclusively allocates data area DATAAREAX in library LIBY to the requesting thread.
Generated from os/cl/catalog/ALCOBJ.json and os/cl/help/ALCOBJ.json.