Command reference / object
RTVDTAARA
Retrieve Data Area
Used in a CL program or REXX procedure to copy all or part of a data area into a variable. Only the data area's value is retrieved, not its other attributes, and the data area need not exist when the CL program is compiled. A local data area (*LDA) is 1024 bytes and is tied to the job. A group data area (*GDA) is 512 bytes and exists only in group jobs. A program initialization parameter data area (*PDA) is 2000 bytes and exists only in prestart jobs. Other data areas are locked during retrieval, and can be explicitly allocated with ALCOBJ when shared and updated in several steps. The QSYS2.DATA_AREA_INFO table function and view return similar information.
Allowed environments: *BPGM, *IPGM, *BREXX, *IREXX.
Use within a CL program.
Positional parameters: 2.
Restrictions
- Requires *USE authority on the data area and *EXECUTE authority on its library. No authority is needed to retrieve a local or group data area.
- Conditionally threadsafe: retrieving DDM data areas is not threadsafe in a job that allows multiple threads, and fails when more than one thread is active.
Parameters
DTAARA
Data area specification
Names the data area whose value is retrieved. Element 1 is *LDA, *GDA, *PDA, or a qualified name. Element 2 selects *ALL or a substring given by start position and length, each 1-2000.
*LDA- The local data area is retrieved.
*GDA- The group data area is retrieved. Valid only if the job is a group job.
*PDA- The program initialization parameter data area is retrieved. Valid only if the job is a prestart job.
*ALL- The entire data area is retrieved.
*LIBL- All libraries in the thread's library list are searched until a match is found.
*CURLIB- The thread's current library is used, or QGPL if none is set.
Elements in order
Data area
Data area
Suggested / special values:
*LDA, *GDA, *PDA
Qualified parts (object, then library; write LIBRARY/OBJECT)
Data area
Data area
Library
Library
Suggested / special values:
*LIBL, *CURLIB
Substring
Substring
Suggested / special values:
*ALL
Elements in order
Substring starting position
Substring starting position
Substring length
Substring length
RTNVAR
CL variable for returned value
Names the CL variable that receives the contents of the data area. No type conversion is performed, so the variable type must be compatible with the data area type.
Examples
RTVDTAARA DTAARA(DA1) RTNVAR(&CLVAR1)
Retrieves all of character data area DA1 (value ABC) into &CLVAR1, which is padded on the right with blanks to length 5.
RTVDTAARA DTAARA(DA2) RTNVAR(&CLVAR2)
Retrieves decimal data area DA2 (12.39) into a decimal variable with one decimal place, giving 0012.3. Fractional digits are truncated, not rounded.
Generated from os/cl/catalog/RTVDTAARA.json and os/cl/help/RTVDTAARA.json.