This function is called only once by IIS when the DLL is unloaded and so can be used for termination processing that is common to Web applications. However, the timing to unload the DLL depends on each condition. The DLL is unloaded during termination processing or, in some cases, only by forced unloading. Therefore, this aspect should be considered carefully before writing initialization in the termination processing or GetExtensionVersion. The program with this entry name can be omitted.
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. "TerminateExtension".
Note
Write the program name correctly, paying attention to the upper-case/lower-case characters. It is case sensitive when used with ISAPI. If the program name is not correct, this function will not be called.
ENVIRONMENT DIVISION
None
DATA DIVISION
Include the library file to be used in the interface with IIS in the linkage section using the COPY statement as follows:
LINKAGE SECTION. COPY ISAPIFLG.
This library file (ISAPIFLG.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-FLAG.
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 "Normal end" is usually set. If the "Abnormal end" is set, the WWW Server assumes that an error occurred in the relevant application.
Return code | Meaning |
---|---|
1 | Normal end |
0 | Abnormal end |
To set the normal end, for example, enter as follows:
MOVE 1 TO PROGRAM-STATUS. EXIT PROGRAM.
The sample of this program will look like the following:
IDENTIFICATION DIVISION. PROGRAM-ID. "TerminateExtension". ENVIRONMENT DIVISION. DATA DIVISION. LINKAGE SECTION. COPY ISAPIFLG. PROCEDURE DIVISION WITH STDCALL LINKAGE USING ISAPI-FLAG. * * Write processing as required. * MOVE 1 TO PROGRAM-STATUS. EXIT PROGRAM.