Matching the Object Name

The system matches import objects to export objects only if they have the same name. In general, the name matching is based on the identifier specified in the import or export declaration. However, there are a couple of exceptions to this rule.

Importing Procedures with a Different ACTUALNAME

ALGOL client programs can declare import objects under one name, and cause them to match export projects with a different name, by including an ACTUALNAME clause in the import declaration. For example:

PROCEDURE READIT;
  LIBRARY LIB1(ACTUALNAME = “READLINE”);

Because of the ACTUALNAME assignment, the system looks for a matching export object named READLINE instead of READIT.

Importing Data with a Different ACTUALNAME

For data objects, the ACTUALNAME assignment can be included in the LIBRARY declaration. The following example matches imports object M with export object GG:

LIBRARY L (LIBACCESS = BYFUNCTION, FUNCTIONNAME = “MYSUPPORT”)
   [ INTEGER M (READWRITE, ACTUALNAME = “GG”) ];

Changing the ACTUALNAME Outside the Import Declaration

You can also change the actual name of an imported procedure or data item outside the declaration, by using the SETACTUALNAME function. For example:

I := SETACTUALNAME (READIT, “READLINE”);

The SETACTUALNAME function makes the requested change, if possible; otherwise, SETACTUALNAME returns a value indicating why the actual name could not be changed. One reason SETACTUALNAME can fail is that the actual name of an import object cannot be changed while the client process is linked to the library from which the object is imported.

Exporting Objects with a Different ACTUALNAME

Similarly, ALGOL library programs can declare export objects under one name, and cause them to match import objects with a different name, by including an AS clause in the export declaration. For example, the following export declaration causes an object named PROC_READ to be exported under the name READLINE:

EXPORT PROC_READ AS “READLINE”;

Interlanguage Communication

One of the main uses of the ACTUALNAME clause, SETACTUALNAME function, and AS clause is to facilitate interlanguage communication. For example, identifiers in COBOL74 can include hyphens (-), whereas identifiers in ALGOL cannot. If a COBOL74 library exports an object with a name that includes a hyphen, an ALGOL client program cannot declare an import object with exactly the same name. Instead, the ALGOL client program can declare the import object with an identifier that is valid in ALGOL, and use an ACTUALNAME clause to specify the name used in the COBOL74 library.

COBOL Programs: Name of Exported PROCEDURE DIVISION

As discussed under Creating Server Library Programs earlier in this section, most COBOL74 programs can be called as libraries. However, these programs do not include export lists or declarations of export objects. Instead, the PROCEDURE DIVISION of the program is always the single export object. If the program contains a PROGRAM-ID comment and the CCI option FEDLEVEL is equal to 5, the first word of this comment is used as the name of the library export object. If no PROGRAM-ID comment appears, or if the FEDLEVEL is not equal to 5, the name of the export object is PROCEDUREDIVISION.

In COBOL85 library programs, which export nested programs as library procedures, the export name is specified by the PROGRAM-ID paragraph in the IDENTIFICATION DIVISION of each nested program.