Note: An 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.
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:
- *CHAR Character
- *DEC Numeric
- *LGL Logical
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.
Only 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.
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: - You cannot specify *CURLIB as the library name.
- If you specify a data area name without a library name, *LIBL is used.
- The 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'.
Attention: If 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.