Specifies data attribute defaults in cases where attribute sets are incomplete.
DEFAULT simple-spec|factored-spec[,simple-spec|factored-spec]…;
where simple-spec is:
RANGE(letters[,letters]…)attribute-spec;
or
RANGE(*)[attribute-spec];
where letters is:
letter [letters]…
where factored-spec is:
(simple-spec|factored-spec[,simple-spec|factored-spec]…)[attribute-spec]
where attribute-spec is:
[attribute-list][VALUE(value-spec[,value-spec]…)
where attribute-list is a list of attributes separated by at least one space.
attribute[ attribute]…
where attribute is:
ALIGNED | AREA | AUTOMATIC | BASED | BIGENDIAN | BINARY | BIT | CHARACTER | CONTROLLED | DECIMAL | DEFINED | DIMENSION | ENTRY | EXTERNAL | FILE | FIXED | FLOAT | GRAPHIC | INITIAL | INTERNAL | LABEL | NATIVE | NONNATIVE | OFFSET | PARAMETER | PICTURE | POINTER | STATIC | VARYING | UNALIGNED | VARIABLE | WIDECHAR
where value-spec is:
CHARACTER(length)|BIT(length)|AREA(size)|numeric-spec
where numeric-spec is:
FIXED|FLOAT|BINARY|DECIMAL[(precision[,scale])]
Abbreviation(s):
A length or precision specification can be made only in the VALUE clause. They may not be specified with the attributes in attribute-list.
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.
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 example uses RANGE (letters) to set a matching sequence that is matched by the second of two declarations, whose storage class is STATIC.
DEFAULT RANGE(SCH) STATIC; DCL SBCHX CHAR ; /* not a match */ DCL SCHBX CHAR ; /* storage class will be STATIC */
The DEFAULT statement with an attribute expression is not supported. However, the Open PL/I compiler accepts the following construct:
DEFAULT (RANGE(simple-spec) & ^PARAMETER) [attribute-list];
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 has precision and scale of (10,2) in accordance with the DEFAULT statement specification, while the C_INTERNAL variable has a language default precision (5,0).