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

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.

Type
*ELEM
Required
Yes
List limit
50
Case
Uppercase
*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

Type
*QUAL
Required
No
Case
Uppercase
Qualified parts (object, then library; write LIBRARY/OBJECT)

Object Object

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

Object type Object type

Type
*CHAR
Required
Yes
Length
7
Case
Uppercase

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

Type
*CHAR
Required
Yes
Length
7
Case
Uppercase

Allowed values: *SHRRD, *SHRNUP, *SHRUPD, *EXCLRD, *EXCL

Member, if data base file Member, if data base file

Type
*NAME
Required
No
Default
*FIRST
Length
10
Case
Uppercase

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.

Type
*INT4
Required
No
Default
*CLS
Case
Uppercase

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.

Type
*CHAR
Required
No
Default
*JOB
Length
7
Case
Uppercase

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.

Type
*CHAR
Required
No
Default
*NORQSRLS
Length
9
Case
Uppercase

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.

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

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.

IBM command documentation

Generated from os/cl/catalog/ALCOBJ.json and os/cl/help/ALCOBJ.json.