CL Command Reference - CRTDTAARA
CL Command List > CRTDTAARA Reference
Description:
The Create Data Area (CRTDTAARA) command creates a data area and stores it in a specified library. It also specifies the attributes of the data. The data area can also be initialized to a specific value.
Data areas are used to communicate and store data used by several programs either within a job or between jobs. A program can use the value of a data area by using the Retrieve Data Area (RTVDTAARA) command.
If a data area is not used by more than one job at a time, it can be explicitly allocated to the appropriate job. If a data area is used by two or more jobs at the same time, it is protected from simultaneous changes occurring from different jobs. A data area is changed by using the Change Data Area (CHGDTAARA) command. The system does not allow two commands to change the same data area at the same time.
A data area is updated in auxiliary storage any time it is changed. This ensures that the changes are not lost in the event of a program or system failure.
The CRTDTAARA command can optionally create a distributed data management (DDM) data area. This is done by specifying *DDM for the TYPE parameter. The DDM data area is used as a reference data area by programs to access data areas located on a remote (target) system in the DDM network. Programs on the local (source) system reference a remote data area by the DDM data area¡¯s name, not by the remote data area¡¯s name. The DDM data area name can be the same as the remote data area name).
The DDM data area on the source system contains the name of the remote data area and the name of the remote (target) system on which the remote data area is located.
The DDM data area can be used with the RTVDTAARA and CHGDTAARA commands to retrieve and update data areas on remote systems.
Restrictions:
1. To use this command, the user must have object operational and add authority for the library in which the data area is placed.
2. This command is conditionally threadsafe. The following restrictions apply:
a. Creating DDM data areas in a job that allows multiple threads is not threadsafe.
b. Creating DDM data areas will fail when more than one thread is active in a job.
Examples:
Example 1: Creating a Data Area with a Value of Zero
CRTDTAARA DTAARA(TOTSALES) TYPE(*DEC) LEN(15 2)
VALUE(0) TEXT(¡¯Total sales accumulator¡¯)
This command creates a data area named TOTSALES and stores it in the current library specified for the thread. TOTSALES has the following data attributes: it is a 15-position numeric data area with two decimal positions and with an initial value of 0.
Example 2: Creating a Data Area Initialized to Blanks
CRTDTAARA DTAARA(CUSTOMER) TYPE(*CHAR) LEN(148)
TEXT(¡¯Customer name area¡¯)
This command creates the data area named CUSTOMER. It can contain as many as 148 characters in the character string. Because no initial value is specified, the data area is initialized to blanks.
Example 3: Creating a DDM Data Area to Access a Data Area at Another System
CRTDTAARA DTAARA(SOURCE/SALES) TYPE(*DDM)
RMTDTAARA(REMOTE/SALES) RMTLOCNAME(NEWYORK)
This command creates a DDM data area named SALES, and stores it in the SOURCE library on the source system. This DDM data area uses the remote location named NEWYORK to access a remote data area named SALES stored in the REMOTE library on a system in New York.