GetExtensionVersion is called only once when an ISAPI application is loaded into IIS. The next HttpExtensionProc is called only after processing of the program with this entry name has completed. Therefore, this program can be used for initialization that is common to the ISAPI application to be created.
For example, GetExtensionVersion can be used for initializing external data. However, as explained later, the timing to perform termination processing is not definite and so do not use this function to perform processing that needs termination processing.
A program with this entry name must be created.
The following explains the precautions to be taken when creating a program with this entry name.
IDENTIFICATION DIVISION
Write the program name in the PROGRAM-ID paragraph as shown below:
PROGRAM-ID. "GetExtensionVersion".
Note
Write the program name correctly, paying attention to the upper-case/lower-case characters, as this name is case sensitive, when used with ISAPI. If the program name is not correct, the application will not run.
ENVIRONMENT DIVISION
None
DATA DIVISION
Include the library file (copy file) to be used to interface with IIS in the LINKAGE SECTION using the COPY statement as follows:
LINKAGE SECTION. COPY ISAPIINF.
This library file (ISAPIINF.cbl) is stored in the folder in which COBOL is installed.
PROCEDURE DIVISION
Write the following to fit to the calling interface from IIS.
PROCEDURE DIVISION WITH STDCALL LINKAGE USING ISAPI-INFO.
Return code
A return code to IIS when this function is completed needs to be set. The following two return code values are available, and the value "Normal end" is usually set.
Note
Note that, if the value "Abnormal end" is set, the next HttpExtensionProc is not called.
Return code | Meaning |
---|---|
1 | Normal end |
0 | Abnormal end |
To set "Normal end", for example, enter as follows:
MOVE 1 TO PROGRAM-STATUS. EXIT PROGRAM.
On the basis of the above, the sample of this program will look like the following:
IDENTIFICATION DIVISION PROGRAM-ID. "GetExtensionVersion". ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION COPY ISAPIINF. PROCEDURE DIVISION WITH STDCALL LINKAGE USING ISAPI-INFO. * * Write processing as required. * MOVE 1 TO PROGRAM-STATUS. EXIT PROGRAM.