Global Code(3.1)

Global Code can be either APL code, as entered in the APL Code Editor; or UFDL code, as entered in the Ultra Format Language Editor. Global APL Code is called packages and is referred to through the name under which it was saved. Correspondingly, Global UFDL Code is called modules.

Using Global APL Code

Before Global APL Code can be used in the Analysis and Aggregation agents, it must be imported:

import apl.<foldername>.<APL Code configurationname>

The package is the name under which the Global APL code was saved. Note that single function blocks from within a package may not be imported - the whole package must be imported.

Note that function names are resolved first in the imported scope, and second in the local scope.

The import statement may also be used to include UFDL modules, that is, UDR types (see the section below, Using Global UFDL Code).

Using Global UFDL Code

Lookup of type names is slightly different in APL than in Ultra definitions. In APL, the module must either be explicitly specified or imported.

The explicit specified module import is done by:

import ultra.<folder>.<module>;

The module is the name under which the Ultra format was saved.

The modules of any entries in the UDR types section of the Analysis agent are implicitly imported. For instance, if the input type myUDR(myFolder.module1) is configured, the complete module myFolder.module1 is imported.

Example - Using global UFDL code

/* APL code without import statement */
consume {
 myFolder.module1.MyUDR newUDR = 
 udrCreate( myFolder.module1.MyUDR );
 newUDR.number = input.seqNum;
 newUDR.sub = udrCreate( myFolder.module1.MySubUDR );
 newUDR.sub.subNum = 17;
udrRoute( newUDR );
}
/* APL code with import statement */
import ultra.myFolder.module1;
consume {
 MyUDR newUDR = udrCreate( MyUDR );
 newUDR.number = input.seqNum;
 newUDR.sub = udrCreate( MySubUDR );
 newUDR.sub.subNum = 17;
udrRoute( newUDR );
}