For a CGI application, you need not be aware in particular of interfaces (except environment variables) with a WWW Server. For an ISAPI application, however, HttpExtensionProc, invoked as a function by IIS, receives an interface (parameter) area to exchange data with IIS. Thus, to convert a CGI application to an ISAPI application, you need to modify the LINKAGE SECTION and the PROCEDURE DIVISION. Since this interface area is used by COBOL ISAPI Subroutines, you need to set the address in COBW3 that is to interface with COBOL ISAPI Subroutines. For example, modify the application as follows:
Description in a CGI application
WORKING-STORAGE SECTION. COPY COBW3. PROCEDURE DIVISION. MOVE LOW-VALUE TO COBW3.
Modified description in an ISAPI application
WORKING-STORAGE SECTION. COPY COBW3. LINKAGE SECTION. COPY ISAPICTX. PROCEDURE DIVISION WITH STDCALL USING ISAPI-CTX-CNT. MOVE LOW-VALUE TO COBW3. MOVE FUNCTION ADDR(ISAPI-CTX-CNT) TO COBW3-CONTEXT.
Return Code
The use of a return code is arbitrary in the main program of a CGI application. However, as described in "Interface Area with a Server", HttpExtensionProc of an ISAPI application is invoked as a function while IIS expects a return value from this function. Thus, for an ISAPI application, you need to set a return code in PROGRAM-STATUS. For example, modify the application as follows:
Description in a CGI application
END-PROC STOP RUN.
Modified description in an ISAPI application
END-PROC MOVE 1 TO PROGRAM-STATUS. EXIT PROGRAM.
You can set the following two return codes. Normally, set a normal end. If you set an abnormal end, the WWW Server assumes that an error occurred in the concerned application and sends a corresponding message to the WWW Browser.
Return code | Meaning |
---|---|
1 | Normal end |
4 | Abnormal end |