Skip to content

Variables and Constants

Daniel Long edited this page Sep 24, 2026 · 2 revisions

Variables and Constants

Variables

DCL-S counter INT(10);
DCL-S name VARCHAR(50) INZ('Default');
DCL-S rate PACKED(7:2) INZ(15.50);
DCL-S isActive IND INZ(*ON);

Named Constants

DCL-C MAX_SIZE 100;
DCL-C GREETING 'Hello';
DCL-C PI 3.14159;

Figurative Constants

Constant Description
*BLANKS Empty string / spaces
*ZEROS Numeric zero or string of zeros
*HIVAL Maximum value for the type
*LOVAL Minimum value for the type
*ON Boolean true / '1'
*OFF Boolean false / '0'
*NULL Null pointer
*ALL'x' Repeated character pattern

Assignment

total = price * qty;
total += tax;          // total = total + tax
count -= 1;
amount *= 1 + rate;    // amount = amount * (1 + rate)
share /= 3;
area **= 2;
name += '!';           // concatenation, for strings
EVAL(H) share /= 3;    // extenders work as with EVAL

+=, -=, *=, /= and **= take everything to their right as one operand. They work anywhere an assignment does: arrays, subfields, and fixed-format EVAL.

Clone this wiki locally