The use declaration allows you to easily reference data areas and functions in parts that are separately generated. A program, for instance, can issue a use declaration that allows for easy reference to a data table, library, or form group, but only if those parts are visible to the program part. For details on visibility, see References to parts.
In most cases, you can reference data areas and functions from another part regardless of whether a use declaration is in effect. For example, if you are writing a program and do not have a use declaration for a library part called myLib, you can access the library variable called myVar as follows:
myLib.myVar
If you include the library name in a use declaration, however, you can reference the variable as follows:
myVar
The previous, short form of the reference is valid only if the symbol myVar is unique for every variable and structure item that is global to the program. (If the symbol is not unique, an error occurs.) Also, the symbol myVar refers to an item in the library only if a local variable or parameter does not have the same name. (A local data area takes precedence over a same-named, program-global data area.)
A use declaration is required in these situations:
Each name specified in the use declaration may be qualified by a package name, library name, or both.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.