Linking an Application Program to the API Library

Before an application program can communicate with the API library, it must establish a link with the API library. The application program does this by calling the LINK_APPL_PROGRAM procedure. When the link is established, a message is sent to Operations Sentinel specifying the job number of the application program, the name of the application program, and the message LINKED TO API.

This is the declared exported procedure:

PROCEDURE LINK_APPL_PROGRAM(LINKREQUEST);
EBCDIC ARRAY LINKREQUEST[0];
LIBRARY SPIAPISUPP;

Initialize the array LINKREQUEST with the following input parameters:

LINKREQUEST 			Description
LINKREQUEST[0] 		Application program mix number (length=5 characters)
LINKREQUEST[5] 		Heartbeat timer interval in minutes (length=2
									characters, -1 indicates no timer)
LINKREQUEST[7] 		Application program name (length=72 characters)

Refer to 7.2.6 for an explanation of the Heartbeat Timer.

Procedure Call Example

In this example the mix number is "12345", the heartbeat timer is 5 minutes, and the application name is "SAMPLE/APPL". The application identifier is returned in the LINKREQUEST array, and the program copies it to the array APPL_ID for subsequent use.

REPLACE LINKREQUEST[0] BY "12345","05","SAMPLE/APPL";
LINK_APPL_PROGRAM(LINKREQUEST);
REPLACE APPL_ID[0] BY LINKREQUEST[0] FOR 6;

Results

This procedure returns the 6-digit identification number to the application program. The program uses this identification number in subsequent calls to the API.

If the Operations Sentinel server is available, the API library sends the LINKED TO API message containing the mix number and name of the application program to the Operations Sentinel server.