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 about handling data areas in other (non-CL) languages, refer to the appropriate high-level language (HLL) reference manual.