Import and use statements

Use the EGL import and use statements to expand the visibility of code elements.
EGL import and use statements are commonly used in these situations:

For more information, see import and use/

Implicit import and use

You can refer directly to any of the parts that EGL defines without having to import them, and you can refer directly to functions in system libraries or EGL-defined enumerations without having to use them. These parts are therefore described as implicitly imported and used.

For example, you can call the sysLib.writeStdOut() system function without referring to the library because of this implicit use:
writeStdOut("Progam complete.");

Example

You might want to access customer information in your accounts receivable (AR) package using the data definitions and functions from your customer relations management (CRM) package. To call the function getCustomer() from the library CustomerLib in the package com.companyb.crmpackage, you can use the following code:
package com.companyb.arpackage;

import com.companyb.crmpackage.*;  // home of CustomerLib library

program CustomerTest type BasicProgram
use CustomerLib;             // add these functions to my scope

  function main()
    getCustomer();  
  end

end
The following aspects of the example are significant:
  • The line import com.companyb.crmpackage.*; tells EGL to include the entire CRMPackage in the scope of the current logic part. Only the parts you reference will be added to the code.
  • If you comment out the use statement, you cannot generate the program unless you add the library name to the function name, as in CustomerLib.getCustomer().
  • If, later in the CustomerTest program, you define a local getCustomer() function, EGL invokes that function in preference to the function of the same name in com.companyb.crmpackage.CustomerLib. Similarly, if you have libraries named CustomerLib in both the ARPackage and CRMPackage, EGL uses the local (ARPackage) version.

Feedback