DTAARA keyword

The syntax of the DTAARA keyword is different in free-form and fixed-form specifications.
Free-form standalone field or subfield
DTAARA{(name)}.

See Free-form DTAARA keyword for a field or subfield.

Free-form data structure
DTAARA{{(name)} {*AUTO} {*USRCTL}}.

See Free-form DTAARA keyword for a data structure.

Fixed-form
DTAARA{({*VAR:} data_area_name)}.

See Fixed-form DTAARA keyword.

Note: Start of changeAn unquoted name is handled differently in free-form and fixed-form definitions. Consider the DTAAARA(name) keyword. If it is in a free-form definition, name is assumed to be the name of a named constant or variable, where the named constant or variable holds the name of the data area at runtime. If it is in a fixed-form definition, *LIBL/NAME is assumed to be the name of the data area at runtime.End of change

The DTAARA keyword is used to associate a standalone field, data structure, data-structure subfield or data-area data structure with an external data area. The DTAARA keyword has the same function as the *DTAARA DEFINE operation code (see *DTAARA DEFINE).

The DTAARA keyword can only be used in the main source section. It cannot be used in a subprocedure.

You can create three kinds of data areas:

You can also create a DDM data area (type *DDM) that points to a data area on a remote system of one of the three types above.

Start of changeOnly character, numeric (excluding float numeric), and indicator types are allowed to be associated with data areas. The actual data area on the system must be of the same type as the field in the program, with the same length and decimal positions. Indicator fields can be associated with either a logical data area or a character data area. If you want to store other types in a data area, you can use a data structure for the data area, and code the subfields of any type, except pointers. Pointers cannot be stored in data areas.End of change

Specifying the name of a data area in a literal or variable

You can specify the value in any of the following forms:
  dtaaraname
  libname/dtaaraname
  *LIBL/dtaaraname
Note:
  1. You cannot specify *CURLIB as the library name.
  2. If you specify a data area name without a library name, *LIBL is used.
  3. Start of changeThe name must be in the correct case. For example, if the data area name is in a variable, and the variable has the value 'qtemp/mydta', the data area will not be found. Instead, it should have the value 'QTEMP/MYDTA'. End of change
Attention: Start of changeIf you specify a variable for the name of a data area data structure, then this variable must have the value set before the program starts. This can be done by initializing the variable, passing the variable as an entry parameter, or sharing the variable with another program through the IMPORT and EXPORT keywords.End of change