IMPORT Statement

Import libraries, parameters, variables, and schema, function, and module definitions from another CCL file into a project, module, or another IMPORT file.

Syntax

IMPORT 'fileName';

Component

fileName

The absolute or relative path of the CCL text file you are importing.

The relative path is relative to the file location of the file that contains the IMPORT statement.

Usage

Only the following CCL statements are valid in an imported file. Any other statements in the file generate compiler error messages.
  • IMPORT
  • CREATE MODULE
  • DECLARE
  • CREATE SCHEMA
  • CREATE LIBRARY

Any definitions used in an import file must be either defined in the file or imported by the file. Once imported, these definitions belong to the scope into which they are imported. You can use these definitions only in statements that follow the IMPORT statement.

Import files can be nested within other import files using the IMPORT statement. For example, if file A imports file B, and the project imports file A, then the project has access to every definition within A, which includes all of the definitions within B.

Import cycles are not allowed and are detected by the compiler. For example, if file B imports file A, and file A imports file B, the compiler generates an error message indicating that a cyclical dependency exists between files A and B. Importing the same file twice in a single scope is also not allowed, and results in an error message.
Note: You cannot successfully compile your project if you cannot compile the import file, or if the IMPORT statement attempts to import an invalid file (an improper file format or the file cannot be found).

Example

This example imports and uses two schemas.

//Defines Schema1
//Imported using relative paths
IMPORT '../schemas/import1.ccl';

//Defines Schema2
//Imported using absolute paths
IMPORT '~/project/schemas/import2.ccl'; [For UNIX-based systems]
IMPORT 'C:/project/schemas/import2.ccl': [For Windows-based systems]

CREATE INPUT STREAM stream1 SCHEMA Schema1;
CREATE INPUT STREAM stream2 SCHEMA Schema2;