This example shows how to change and retrieve a data area.
The following is an example of using the Change Data Area (CHGDTAARA) and Retrieve Data Area (RTVDTAARA) commands for character substring operations.
This example:
To do this, the following commands would be entered:
DCL VAR(&CLVAR1) TYPE(*CHAR) LEN(5) . CRTDTAARA DTAARA(MYLIB/DA1) TYPE(*CHAR) LEN(10) + VALUE('ABCD5678IJ') . . . CHGDTAARA DTAARA((MYLIB/DA1) (5 4)) VALUE('EFG') RTVDTAARA DTAARA((MYLIB/DA1) (5 5)) RTNVAR(&CLVAR1)
The variable &CLVAR1 now contains 'EFG I'.