Using Import Modules

An import module is a non-executable procedure that contains Maintain Data language code. You do not execute an import module as part of your application. Instead, you use it as a library of functions or classes. Using the MODULE IMPORT command, you can bring an import module into any procedure and use its functions and classes. An import module cannot be used for data source access.

If you edit an import module, you will notice that, just as with a procedure, it starts with the keyword MAINTAIN and ends with the keyword END. However, it does not contain a Top function.

You can use the following in an import module:

  • Functions
  • Classes
  • Variables

You cannot use the following in an import module:

  • Forms
  • Data sources (the syntax MAINTAIN FILE filename is not supported)
  • Commands that read or write data to a data source (NEXT, MATCH, and so on)
  • Stacks that contain columns from a data source (defined with the INFER or NEXT commands). You can, however, define stacks using Stack Of, DECLARE, or COMPUTE.
Note: When you move an import module into a procedure, the variables, functions, and classes in an import module become part of the name space of the procedure. For example, if you have a variable named COUNT in an import module and import it into a procedure, that procedure cannot define its own variable named COUNT.