PACKAGE

Purpose

Creates a name scope that can be shared by all contained declarations and procedures.

Syntax

package-name: PACKAGE EXPORTS (procedure);

Parameters

package-name
The name of the package.
EXPORTS

Indicates the procedures for export. Specify either all (EXPORTS(*)) or specific named procedures. Exported procedures are made known outside of the package. If no EXPORTS option is specified, EXPORTS(*) is assumed.

Description

A package contains declarations, default statements, and procedure blocks. Some or all of the level-1 procedures in the package can be exported and made known outside of the package as external procedures. A package can contain any number of procedures, and any or all procedures in a package can be exported.

The PACKAGE statement, if used, must be the first statement in a compilation unit. The form of the PACKAGE statement is:

package-name: PACKAGE : EXPORTS (entry_name, … )  OPTIONS (option, …)

Or

package-name: PACKAGE : EXPORTS (* ) OPTIONS (option, …)

Each level-1 entry name listed as an export is made external; if (*) is used, then all level-1 entry points are made external. The OPTIONS clause contains options that can applied to entry point names , for example BYVALUE. The FETCHABLE option is not allowed.

Example

MYPKG: PACKAGE EXPORTS (A, B);

   A: PROCEDURE;
   END;

   B: PROCEDURE;
   END;
 
   C: PROCEDURE;
   END;

END MYPKG;

In this example, MYPKG is the package name containing procedures A, B, and C. Procedures A and B will be external and C will be internal.

Restrictions

  • The RESERVES clause is not supported.
  • Condition prefixes are not supported.