If a name appears in a program and is not explicitly declared, it is implicitly declared. The scope of an implicit declaration is determined as if the name were declared in a DECLARE statement immediately following the PROCEDURE statement of the external procedure in which the name is used.
With the exception of files, entries, and built-in functions, implicit declaration has the same effect as if the name were declared in the outermost procedure. For files and built-in functions, implicit declaration has the same effect as if the names were declared in the logical package outside any procedures.
Some attributes for a name declared implicitly can be determined from the context in which the name appears. These cases, called contextual declarations, are:
Examples of contextual declaration are:
read file (PREQ) into (Q); allocate X in (S);
In these statements, PREQ is given the FILE attribute, and S is given the AREA attribute.
Implicit declarations that are not contextual declarations acquire all attributes by default, as described in Defaults for attributes. Because a contextual declaration cannot exist within the scope of an explicit declaration, it is impossible for the context of a name to add to the attributes established for that name in an explicit declaration.