DTAARA{({*VAR:} data_area_name)}

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.

Only character and numeric types (excluding float numeric) 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.

If data_area_name is not specified, then the name specified in positions 7-21 is also the name of the external data area. If neither the parameter nor the data-structure name is specified, then the default is *LDA.

If *VAR is not specified, the data_area_name parameter can be either a name or a literal. If a name is specified, the name of the parameter of DTAARA is used as the name of the data area. For example, DTAARA(MYDTA) means that the data area *LIBL/MYDTA will be used at runtime. It must be a valid data area name, including *LDA (for the local data area) and *PDA (for the program initialization parameters data area). If a literal is specified, the value of the literal is used as the name of the data area. For example, DTAARA('LIB/DTA') will use data area DTA in library LIB, at runtime.

If *VAR is specified, the value of data_area_name is used as the data area name. This value can be:

You can specify the value in any of the following forms:

  dtaaraname
  libname/dtaaraname
  *LIBL/dtaaraname
Notes:
  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. The name must be in the correct case. For example, if you specify DTAARA(*VAR:dtaname) and variable dtaname has the value 'qtemp/mydta', the data area will not be found. Instead, it should have the value 'QTEMP/MYDTA'.
Attention!

If DTAARA(*VAR) keyword is used with a UDS data area, and the name is a variable, 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.

When the DTAARA keyword is specified, the IN, OUT, and UNLOCK operation codes can be used on the data area.



[ Top of Page | Previous Page | Next Page | Contents | Index ]