DATA_AREA_INFO table function

The DATA_AREA_INFO table function returns a row for the specified data area, including a data area in QTEMP or the *LDA, *PDA, or *GDA data areas.

The values returned are closely related to the values returned by the Retrieve Data Area (RTVDTAARA) CL command and the Retrieve Data Area (QWCRDTAA) API.

Authorization: The caller must have:
  • *EXECUTE authority to the library containing the data area, and
  • *USE authority to the data area.

For a DDM data area, the caller must be able to connect to the remote system.

To return information for a data area on a remote system, the caller must have:
  • *EXECUTE authority to the library containing the data area, and
  • *USE authority to the data area.
Read syntax diagramSkip visual syntax diagram DATA_AREA_INFO ( DATA_AREA_NAME =>  data-area-name ,DATA_AREA_LIBRARY => data-area-library,IGNORE_ERRORS => ignore-errors )
The schema is QSYS2.
data-area-name
A character or graphic string expression that identifies the data area.
Can contain the following special values:
*GDA
Group data area.
*LDA
Local data area.
*PDA
Program initialization parameter data area.
data-area-library
A character or graphic string expression that identifies the library containing the data area. If data-area-library is not specified, *LIBL is used. If data-area-name is one of the special values, data-area-library is ignored.
Can contain the following special values:
*CURLIB
The current library is used.
*LIBL
The library list is used.
ignore-errors
A character or graphic string expression that identifies what to do when an error is encountered.
NO
An error is returned. This is the default.
YES
A warning is returned.
A partial row is returned when an error is encountered. Columns other than the data area name (and the library name if explicitly specified as an input parameter) will be null.

The result of the function is a table containing one row with the format shown in the following table. All the columns are nullable.

Table 1. DATA_AREA_INFO table function
Column Name Data Type Description
DATA_AREA_LIBRARY VARCHAR(10) Library containing the data area.

Contains the null value if this request is for *GDA, *LDA, or *PDA.

DATA_AREA_NAME VARCHAR(10) Name of the data area.
DATA_AREA_TYPE VARCHAR(5) The type of data area.
*CHAR
A character data area.
*DEC
A decimal data area.
*LGL
A logical data area.
LENGTH INTEGER Specifies the length of the data area.
  • For a character data area, it is the maximum number of characters.
  • For a decimal data area it is the total number of digits, including decimal positions.
  • For a logical data area, it is always 1.
DECIMAL_POSITIONS INTEGER Specifies the number of digits to the right of the decimal point for a decimal data area.

Contains the null value if not a decimal data area.

DATA_AREA_VALUE VARCHAR(2000) The value currently assigned to the data area.

For a decimal data area, the SQL default decimal point is used. See Decimal point.

DATA_AREA_BINARY_VALUE VARBINARY(2000) The value currently assigned to the data area as binary data.

Example

  • Return the current value of the TESTDATA data area. Use the library list to locate the data area.
    SELECT DATA_AREA_VALUE FROM TABLE(QSYS2.DATA_AREA_INFO(
                                                DATA_AREA_NAME => 'TESTDATA',
                                                DATA_AREA_LIBRARY => '*LIBL'));