Describe computational data, program-control data, and program characteristics.
|
AREA BINARY BIT CHARACTER COMPLEX DECIMAL DIMENSION ENTRY |
FILE FIXED FLOAT FORMAT GRAPHIC HANDLE LABEL NONVARYING |
OFFSET ORDINAL PICTURE POINTER PRECISION REAL RETURNS SIGNED |
STRUCTURE TASK TYPE UNSIGNED UNION VARYING VARYINGZ WIDECHAR |
Describe nondata elements (for example, built-in functions) or provide additional description for elements that have other data attributes.
|
ABNORMAL ALIGNED ASSIGNABLE AUTOMATIC BASED BIGENDIAN BUFFERED BUILTIN BYADDR BYVALUE CONDITION CONNECTED CONTROLLED |
DEFINED DIRECT ENVIRONMENT EXCLUSIVE EXTERNAL GENERIC HEXADEC IEEE INITIAL INPUT INTERNAL KEYED |
LIKE LIST LITTLEENDIAN NONASSIGNABLE NONCONNECTED NORMAL OPTIONAL OPTIONS OUTPUT PARAMETER POSITION |
PRINT RECORD SEQUENTIAL STATIC STREAM UNALIGNED UNBUFFERED UPDATE VALUE VARIABLE |
For example, the keyword CHARACTER is a data attribute for the string type of computational data. The keyword FILE is a data attribute for the file type of program-control data. The INTERNAL scope attribute specifies that the data item is known only within its declaring block.
The details on using keywords and expressions to specify the attributes are in Data declarations. Briefly, you specify attributes:
Table 7 and Table 8 help you correlate PL/I’s variety of attributes with its variety of computational and program-control data types. The tables show that the constants and the named constants can only have the indicated data and scope attributes (Table 7). Variables can specify additional attributes (Table 8).
In the example,
Area = (Radius**2)*3.1416;
the constant 3.1416 is given the attributes:
(See the "Coded arithmetic" row, and "Data Attributes" and "Scope Attributes" columns of Table 7.)
The constant 1.0 (a decimal fixed-point constant) is different from the constants 1 (another decimal fixed-point constant), '1'B (a bit constant), '1' (a character constant), 1B (binary fixed-point constant), or 1E0 (a decimal floating-point constant).
In the following example, the variable Pi has the programmer-defined data attributes of FIXED and DECIMAL with a PRECISION of five digits, four to the right of the decimal point.
declare Pi fixed decimal(5,4) initial(3.1416);
Because this DECLARE statement contains no other attributes for Pi, PL/I applies the defaults for the remaining attributes:
(See the coded arithmetic row of Table 8.)
|
Constant Type |
||
|---|---|---|
|
REAL | imaginary FLOAT | FIXED BINARY | DECIMAL PRECISION SIGNED |
internal |
|
|
REAL | COMPLEX FLOAT | FIXED BINARY | DECIMAL PRECISION VALUE SIGNED | UNSIGNED |
internal |
|
|
BIT | CHARACTER | GRAPHIC | WIDECHAR (length) |
internal |
|
|
BIT | CHARACTER | GRAPHIC | WIDECHAR [(length)] NONVARYING VALUE |
internal |
|
|
Named locator |
POINTER | OFFSET | HANDLE VALUE |
internal |
|
Named picture |
PICTURE REAL | COMPLEX VALUE |
internal |
|
FILE ENVIRONMENT STREAM | RECORD INPUT | OUTPUT | UPDATE SEQUENTIAL | DIRECT BUFFERED | UNBUFFEREDNote 4 KEYED |
INTERNAL | EXTERNAL |
|
|
ENTRY [RETURNS] |
INTERNAL | EXTERNAL |
|
|
FormatNote 5 |
FORMAT |
internal |
|
LABEL |
internal |
|
|
Notes:
|
||
|
Variable Type |
Data Attributes |
Alignment Attributes |
Scope Attributes |
Storage Attributes |
|---|---|---|---|---|
|
AREA(size) |
ALIGNED |
INTERNAL | EXTERNAL (INTERNAL is mandatory for AUTOMATIC BASED DEFINED PARAMETER) |
AUTOMATIC | STATIC | BASED | CONTROLLED (AUTOMATIC is the default for INTERNAL; STATIC is the default for EXTERNAL) Defined variable: DEFINED [POSITION] Parameter: PARAMETER [CONNECTED | NONCONNECTED] [CONTROLLED] [INITIAL [CALL]] [VARIABLE] [NORMAL | ABNORMAL] ASSIGNABLE | NONASSIGNABLE |
|
|
REAL | COMPLEX FLOAT | FIXED BINARY | DECIMAL PRECISION [SIGNED | UNSIGNED] |
ALIGNED | UNALIGNED |
|||
|
ENTRY [RETURNS] [LIMITED] |
||||
|
FILE |
||||
|
FORMAT |
||||
|
LABEL |
||||
|
POINTER | HANDLE | {OFFSET [(area-variable)]} |
||||
|
ORDINAL |
||||
|
Picture |
PICTURE REAL | COMPLEX |
ALIGNED | UNALIGNED |
||
|
BIT | CHARACTER | GRAPHIC | WIDECHAR [(length)] [ VARYING | VARYINGZ | NONVARYING] |
||||
|
TASK |
ALIGNED | UNALIGNED |
|||
| Arrays: DIMENSION can be added to the declaration of any variable. Refer to Arrays for more information. | ||||
Structures and unions:
|
||||
|
Notes:
|
||||