Retrieve Data Area Data (DTAARA) UDTF



        DATA_AREA => 'data-area-name', 
        STARTPOS => 1 (1 to 2000),
POSITIONS => -1 (1 to 2000) );
DTAARA( DATA_AREA => 'library/data-area', 
        STARTPOS => 1 (1 to 2000),
POSITIONS => -1 (1 to 2000) );

The Retrieve Data Area Data (DTAARA) User Defined Table Function returns one row containing the data area's content along with its attributes.


Note: If the parameter keywords are NOT specified, users can call the DTAARA UDTF with positional parameters. To simplify use, the data area name may be specified as the first parameter. For example, in the following 3 statement, the data area MYAREA exists and QGPL is on the library list at the time it is run:

  1. dtaara('qgpl/myarea') 
  2. dtaara('myarea')
  3. dtaara('QGPL', 'MYAREA')

All three variations produce an identical result. When this style is used, it is recommended to use the full parameter list (option 3) to make the statement more clear, but it is not required.


The library name of the data area. If unspecified, *LIBL is used.


The name of the data area whose content is returned. Any valid data area name may be specified, along with *LDA, *GDA and *PDA. When one of those three special values is specified, the library parameter is ignored. This is a required parameter. NOTE: When the 2nd form the UDTF is used, a fully qualified data area name can be specified, or a simple, unqualified name may be specified.


Default: 1

The first position within the data area to return. If this parameter is not specified, position 1 is used.


Default: -1 or NULL

The length of the data area to be returned, starting with the STARTPOS value and continuing for the number of bytes specified for this parameter. If this parameter is not specified, the data from the STARTPOS through the end of the data area is returned.  


  DCL-S OldParms CHAR(1024);
EXEC SQL select data_area_value FROM TABLE(iQuery.DTAARA('*LDA')) da INTO :OldParms;

ResultSet Columns

Column Data Type Description
The name of the data area.
VARCHAR(10) The library name where the data area is located.
VARCHAR(5) The data area type, such as *CHAR, *DEC, or *LGL
INT The data area length.
DECPOS INT For Data Area Type *DEC, this column contains the number of decimal positions, otherwise it is null.
The current value stored in the data area. Note that if the STARTPOS or POSITIONS parameters are specified, the result is returned left-justified in this column.