Free-form DTAARA keyword for a data structure
The parameters of the DTAARA keyword for
a free-form data structure definition are
- *AUTO
- The data structure is a data area data structure. If *AUTO is specified, and you want to use the data area with the IN, OUT, or UNLOCK operation codes, you must also specify the *USRCTL parameter.
- *USRCTL
- The data structure is a user-controlled data area, meaning that it can be used with the IN, OUT, or UNLOCK operation codes. If the *AUTO parameter is not specified, *USRCTL is the default. If the data structure does not have a name, the data structure can only be affected when the operand of the IN, OUT, or UNLOCK operation is *DTAARA, meaning that the operation will work with all the user-controlled data areas in the module.
- data area name
- The name parameter can be a literal, named constant, or variable. See Specifying the name of a data area in a literal or variable for more information. If the name parameter is specified, it must be the last parameter. If the name parameter is not specified, the data structure name is used. If the data structure name is also not specified, the *LDA data area is used at runtime.
Examples
In the following example, the data area is defined only with
the *AUTO parameter, so it is a data area data structure.
It cannot be used with the IN, OUT, or UNLOCK operation codes.
The name is not specified, so data area *LIBL/MYDTAARA is used
at runtime.
DCL-DS info DTAARA(*AUTO);
company CHAR(50);
city CHAR(25);
END-DS;
In the following example, the data area is defined with
both the *AUTO and *USRCTL parameters, so it is a data area data structure
that can also be used with the IN, OUT, or UNLOCK operation codes.
The name parameter is specified, so data area 'MYLIB/MYDTAARA' will
be used at runtime.
DCL-DS info DTAARA(*AUTO : *USRCTL : 'MYLIB/MYDTAARA');
company CHAR(50);
city CHAR(25);
END-DS;
In the following example, the data area is defined
without a name.
The DTAARA keyword is specified with
only the *AUTO parameter.
Since the data area name is not specified in either
the data structure name or the
DTAARA keyword, the *LDA data area is used at runtime.
DCL-DS *N DTAARA(*AUTO);
company CHAR(50);
city CHAR(25);
END-DS;
In the following example, the data structure
does not have a name, and the *AUTO parameter
is not used for the DTAARA keyword.
The IN operation specifies *DTAARA, so data area
MYLIB/MYDTAARA will be read into the unnamed data area
when the IN operation is used at runtime.
After the IN operation, subfield subf
will hold the contents of the data area.
DCL-DS *N DTAARA('MYDTAARA');
subf CHAR(50);
END-DS;
IN *DTAARA;
DSPLY subf;