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

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.

Type
*ELEM
Required
Yes
Case
Uppercase
*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

Type
*QUAL
Required
No
Case
Uppercase

Suggested / special values: *LDA, *GDA, *PDA

Qualified parts (object, then library; write LIBRARY/OBJECT)

Data area Data area

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

Substring Substring

Type
*ELEM
Required
No
Default
*ALL
Case
Uppercase

Suggested / special values: *ALL

Elements in order

Substring starting position Substring starting position

Type
*INT4
Required
No
Range
1 to 2000
Case
Uppercase

Substring length Substring length

Type
*INT4
Required
No
Range
1 to 2000
Case
Uppercase

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.

Type
*CHAR
Required
Yes
Length
2000
Case
Uppercase
Returns
CL variable

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.

IBM command documentation

Generated from os/cl/catalog/RTVDTAARA.json and os/cl/help/RTVDTAARA.json.