SQL iQuery Script Built-in Functions

Retrieve Data from a Data Area


The DTAARA() built-in function returns the content of a data area (*DTAARA) object. The data area and location within the data area are specified. The data from the data area is returned, usually into a Session Variable. This built-in function is similar to the USRSPC built-in function which works similarly but with user spaces.


The DTAARA built-in function returns the contents of the data area specified on the first parameter, using the optional starting position and length parameters to extract the data.


  1. The qualified name of a data area whose content is retrieved. This can be in the form: library/dtaara or simply dtaara without a qualified library name.
  2. The starting position within the data area.
  3. The Length of the data to be returned.

A user space object type is *DTAARA that can be created using the CRTDTAARA CL command.

eval &INVNBR = dtaara(QGPL/NEXTINV, 1,7);
#msg The Next Invoice Number is &INVNBR

The output written to the joblog is:

The Next Invoice Number is 1280086