Example: Retrieve data area DA2

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

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

To do this, the following commands would be entered:

CRTDTAARA DTAARA(MYLIB/DA2) TYPE(*DEC) LEN(5 2) VALUE(12.39)
.
.
.
DCL  VAR(&CLVAR2) TYPE(*DEC) LEN(5 1)
RTVDTAARA DTAARA(MYLIB/DA2) RTNVAR(&CLVAR2)

&CLVAR2 now contains 0012.3 (fractional truncation occurred).

Related information
Retrieve Data Area (RTVDTAARA) command