Data area locking and allocation

Locking and allocating a data area helps to ensure that the data area is not accessed by more than one job at a time.

The Change Data Area (CHGDTAARA) command uses a *SHRUPD (shared for update) lock on the data area during command processing. The Retrieve Data Area (RTVDTAARA) and Display Data Area (DSPDTAARA) commands use a *SHRRD (shared for read) lock on the data area during command processing. If you are performing more than one operation on a data area, you may want to use the Allocate Object (ALCOBJ) command to prevent other users from accessing the data area until your operations are completed. For example, if the data area contains a value that is read and incremented by jobs running at the same time, the ALCOBJ command can be used to protect the value in both the read and update operations.

For information on handling data areas in other (non-CL) languages, refer to the appropriate HLL reference manual.

Related concepts
Objects and libraries
Related information
Create Data Area (CRTDTAARA) command
Retrieve Data Area (RTVDTAARA) command
Display Data Area (DSPDTAARA) command