IMPORT statement is used to import pre-compiled resources into a 4GL program.
File |
An identifier which refers to a valid file name without path or extension |
When you specify a file name, be careful with its case.
UNIX is case-sensitive, so it will treat files which names come in different cases as separate files.
Usage and examples
With IMPORT statement, 4gl developers can import:
IMPORT statement must be introduced at the beginning of a source file before all other sections including MAIN, FUNCTION, DEFINE, and GLOBALS:
IMPORT fgl_lib
MAIN
...
END MAIN
Every imported module or library needs its own IMPORT statement. If you want to import several modules, use several IMPORT statements:
IMPORT fgl_lib
IMPORT my_lib
MAIN
...
END MAIN
Usually in 4GL, if a program refers to a file, it needs the path to the file, its name and extension (they are given in quotation marks). However, with the IMPORT statement, the file name serves as the identifier which can be later used in the code:
IMPORT c_lib
MAIN
CALL c_func("Hello World") -- a function defined in c_lib
END MAIN
If the imported module calls any functions, you can call them from the importing 4gl source file without linking them explicitly to the program.
This chapter discusses importing 4gl modules and C libraries.
To get the necessary information about importing JAVA classes, please, refer to Lycia Java Interface.