ILREF

This directive permits the definition of extension methods and extension operators that are outside of the current compilation unit.
Restriction: This directive is supported for JVM COBOL only.

Syntax:

>>-----.---ILREF--"parameter"---.--><
       +-NOILREF----------------+

Parameters:

.class filename
The .class file that contains the required extension methods and extension operators

Properties:

Default: NOILREF
IDE equivalent: Add a reference in the References folder of the project
$SET: Initial

Example:

The following example, run from the command line, loads the class defined within the class2.class file:
Note: The path and extension are not required, as the classpath is used to resolve these details. The name and package of the class defined in class2.class does not need to be the same as the name and directory of the class file, as it does with normal class loading.

On Windows:

cobol class1.cbl jvmgen ilref(class2);

On UNIX:

cob class1.cbl -C jvmgen -C ilref(class2)

Comments:

If the required class is within a .jar file, the .jar file must be on the classpath or specified in the JVMCLASSPATH Compiler directive. For example:

On Windows:

cobol -j class1.cbl jvmclasspath(myclasses.jar) ilref(class2.class);

On UNIX:

cob -j class1.cbl -C jvmclasspath(myclasses.jar -C ilref(class2.class)