package

The EGL package statement assigns a name to a collection of related parts.

All EGL source files should contain a package statement. Any number of files can belong to the same package, therefore a package can contain multiple package statements (one for each source file). If you do not specify a package statement in a file, the file is stored directly in the source folder and is said to be in the default package. Parts in the default package cannot be shared by parts in other packages or projects. For this reason, avoid using the default package by always specifying a package statement.

Two parts with the same name cannot be defined in the same package. You should also avoid using the same package name under different projects or different folders.

Syntax

Syntax diagram for package statement
packageName
See "Naming conventions" in this topic for more information about how to name your package.

Naming conventions

By convention, you make your package name unique by prefacing it with an inversion of the Internet domain name for your organization. For example, the IBM® domain name is ibm.com®, and the EGL packages begin with "com.ibm." The package name (a sequence of identifiers separated by periods) serves to identify the folders for package files, as in the following example:
  com.CompanyB.Customer

Each name corresponds to a subfolder, so the directory structure for the previous example is financialProjects\EGLSource\com\CompanyB\Customer. When EGL creates directories in the Java™ Resources directory, it changes all names to lower case. This is because EGL is not case sensitive, but Java is.

Example

The following example shows the beginning and end of a library file. Because the CustomerRecord declaration lies outside the Library part, its scope is global to the package (see Scope).
package com.companyb.customer;

Record CustomerRecord type SQLRecord 
{ keyItems=["customerNumber"] }
	customerNumber INT;   // key item
	customerName STRING;
	customerBalance DECIMAL(9,2);
end

Library CustomerLib

  myCustomer CustomerRecord;

  getCustomer()
  ...
  end  // end function

end // end libary

Feedback