Example: Retrieve data area DA1

This example shows how to retrieve a data area and copy it into a variable.

The following example of the Retrieve Data Area (RTVDTAARA) command places the specified contents of a 5-character data area into a 3-character variable. This example:

To do this, the following commands would be entered:

CRTDTAARA DTAARA(MYLIB/DA1) TYPE(*CHAR) LEN(5) VALUE(ABCDE)
.
.
.
DCL VAR(&CLVAR1) TYPE(*CHAR) LEN(3)
RTVDTAARA DTAARA(MYLIB/DA1 (3 3)) RTNVAR(&CLVAR1)

&CLVAR1 now contains 'CDE'.

Related information
Retrieve Data Area (RTVDTAARA) command