Unlike variables, data areas are objects and must be created before
they can be used.
A data area can be created as:
- A character string that can be as long as 2000 characters.
- A decimal value with different attributes, depending on whether it is
used only in a CL program or procedure or also with other high-level language
programs or procedures. For CL procedures and programs, the data area can
have as many as 15 digits to the left of the decimal point and as many as
9 digits to the right, but only 15 digits total. For other languages, the
data area can have as many as 15 digits to the left of the decimal point and
as many as 9 to the right, for a total of up to 24 digits.
- A logical value '0' or '1', where '0' can mean off, false,
or no; and '1' can mean on, true, or yes.
When you create a data area, you can also specify an initial value
for the data area. If you do not specify one, the following is assumed:
- 0 for decimal.
- Blanks for character.
- '0' for logical.
To create a data area, use the Create Data Area (CRTDTAARA) command.
In the following example, a data area is created to pass a customer number
from one program to another:
CRTDTAARA DTAARA(CUST) TYPE(*DEC) +
LEN(5 0) TEXT('Next customer number')