DEFAULT simple-spec|factored-spec[,simple-spec|factored-spec]…;
RANGE(letter[:letter][,letter[:letter]…)attribute-spec;
RANGE(*)[attribute-spec];
(simple-spec|factored-spec[,simple-spec|factored-spec]…)[attribute-spec]
[attribute-list][VALUE(value-spec[,value-spec]…)
where attribute-list is a list of attributes separated by at least one space.
attribute[ attribute]…
ALIGNED | AREA | AUTOMATIC | BASED | BINARY | BIT | CHARACTER | CONTROLLED | DECIMAL | DEFINED | DIMENSION | ENTRY | EXTERNAL | FILE | FIXED | FLOAT | INITIAL | INTERNAL | LABEL | OFFSET | PICTURE | POINTER | STATIC | VARYING | UNALIGNED | VARIABLE
CHARACTER(length)|BIT(length)|AREA(size)|numeric-spec
FIXED|FLOAT|BINARY|DECIMAL[(precision[,scale])]
DEFAULT RANGE (l:m) FLOAT; DECLARE (low, medium) BINARY; /*In this case both variables, low and medium, will be declared as FLOAT BINARY(23).*/ DFT RANGE (*) STATIC; DECLARE (x,y) FIXED BINARY(15) INITIAL (0); DECLARE t FLOAT DECIMAL AUTOMATIC; /* In this example both x and y will have STATIC storage class, while t will have AUTOMATIC storage class due to its explicit storage class declaration. */ DEFAULT RANGE (t) VALUE (CHARACTER(6)); DCL tony CHAR; DCL tiger CHAR(20);
This statement specifies that all character variables whose name begins with the letter t have the length of 10 characters. Here, tony will have length 6, while tiger will have its explicitly specified length of 20.
Description
Specifies data attribute defaults in cases where declared attribute sets are incomplete. Any attributes not suppled by the DEFAULT statement for any incomplete explicit, contextual, or implicit declarations are supplied by the Open PL/I default rules. (See the section Compiler-supplied Defaults in the chapter Declarations and Attributes.)
Structure elements are given default attributes according to the name of the element, not the qualified structure element name. The DEFAULT statement cannot be used to declare a structure.
You can use more than one DEFAULT statement within a block. The scope of a DEFAULT statement includes the block in which it occurs and all nested blocks, except those which include another DEFAULT statement with the same range or which are contained in a block having a DEFAULT statement with the same range.
Note the following special case of a DEFAULT statement that is used to restore language-specified defaults in the containing block:
in the previous example, the CL_INDEX in the MAIN routine will have precision and scale of (10,2) in accordance with the DEFAULT statement specification, while the C_INTERNAL variable will have a language default precision (5,0).