Data used in a PL/I program can be classified as either computational data or program-control data:
Arithmetic data is either coded arithmetic data or numeric picture data.
Coded arithmetic data items are rational numbers. They have the data attributes of base (BINARY or DECIMAL), scale (FLOAT or FIXED), precision (significant digits and decimal-point placement), and mode (REAL or COMPLEX).
Numeric picture data is numeric data that is held in character form and is discussed under Numeric character data.
A string is a sequence of contiguous characters, bits, widechars or graphics that are treated as a single data item.
For example:
Area = (Radius**2) * 3.1416;
Area and Radius are coded arithmetic variables of computational data. The numbers 2 and 3.1416 are coded arithmetic constants of computational data.
If the number 3.1416 is used in more than one place in the program, or if it requires specific data or precision attributes, you should declare it as a named constant. Thus, the above statement can be coded as:
dcl Pi FIXED DECIMAL (5,4) VALUE(3.1416); area = (radius**2) * Pi;
Constants for program-control data have a value that is determined by the compiler. In the following example, the name loop represents a label constant of program-control data. The value of loop is the address of the statement A=2*B;.
loop: A=2*B;
C=B+6;To work with a data item, PL/I needs to know the type of data and how to process it. Attributes provide this information. The kinds of attributes are data attributes and nondata attributes.