ADAPL allows three different data types:

integer: whole decimal numbers (e.g. 10, -350)
numeric: decimal numbers (e.g. 3.5, -E30)
text: character strings (e.g. 'Word', 'a')

The ranges of these data types depend on the host operating system. Under MS-DOS, the following values apply:

integer

Ranges from -2147483648 up to and including +2147483647.

numeric

Ranges from -1.7*10308 (-17 followed by 307 zeros) to +1.7*10308.

text

Can hold up to 65000 bytes, but never more than the number of bytes reserved for the text variable, like so for instance: text MyText[1000]. A text variable of undetermined length can be declared by reserving zero bytes for it, e.g. MyOtherText[0].

Note that under DOS, one character is represented by one byte, but in Unicode UTF-8 character sets under Windows, letters with a diacritical character and exotic letters are usually represented by two (or sometimes three) bytes. So declare your text variables at least twice the length of the number of characters they're supposed to hold, if a variable is going to hold data from records.

Also note that if you fill a text variable of undetermined length with a string longer than 1024 characters during compilation already (so you've hardcoded a long string assignment in the adapl), you'll get a "Token buffer overflow" error on compilation. This won't happen when you fill the variable with a long string during run time, so as a work-around to hard-coding the long string you can put the fixed long string in a single-lined text file, put line number 1 in front of it and read that line of text via the ADAPL text$ function during run time.

You will often be saving these data as variables. A variable is simply a piece of memory to which you have given a name, making it easy to manipulate its content. You can give assignments to ADAPL such as 'put a value in the piece of memory with this name'. At a later stage, you can change the value, or use it in a calculation. When you indicate that you want to use a variable, you also indicate how much (maximum) and what type of information you want to save in it. It is not necessary to state to which piece of memory you want to refer - Collections does that for you.

You may also want to refer literally to a value. For example, if you want to use the number '10' , you type that number literally. We call this kind of literal value a constant. Whereas a variable may regularly change in value, the value of a constant stays the same.

The data type of a constant is determined by a notation and by the context in which it occurs. The data type of a variable is determined by a declaration. In an ADAPL program, you have to indicate the data type of a variable in advance.

If necessary, Collections will automatically convert variable values and results of instructions to a data type with fewer restrictions, in the order INTEGER > NUMERIC > TEXT. To convert variables in the other direction you can use the functions VAL() and INT().

An expression is an arithmetical expression such as a=b+10. The data type of the result of an expression depends on the data types of the parts of the expression. If different data types are used in an expression, the result will assume the least restrictive type.

In contrast with a numeric, an integer is a whole number. That makes an integer particularly suitable for counters and numbers. Numerics are not 100% exact, but do have a certain precision. The bigger the number, the less the precision. A numeric can therefore handle bigger numbers than an integer.

See also

Declaring local variables

Constants and variables