22.09.2013 Views

NetCOBOL for SPARC Architecture SAF Subroutines User's Guide

NetCOBOL for SPARC Architecture SAF Subroutines User's Guide

NetCOBOL for SPARC Architecture SAF Subroutines User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

122 Appendix D. CGI To <strong>SAF</strong> <strong>Subroutines</strong> Conversion <strong>Guide</strong><br />

Operations of CGI Environment Variables<br />

A CGI application can reference the "CGI environment variables" using the<br />

environment variable operation function of COBOL. On the contrary, an <strong>SAF</strong><br />

application cannot reference them. Thus, it uses three subroutines shown below:<br />

• COBW3_RECEIVE _HEADER<br />

This subroutine acquires an HTTP header.<br />

• COBW3_GET_REQUEST_INFO<br />

This subroutine acquires various types of in<strong>for</strong>mation related to a request.<br />

• COBW3_GET_AUTHORIZE<br />

This subroutine acquires authorization in<strong>for</strong>mation.<br />

In addition, a CGI application can set or reference Cookie data using the<br />

environment variable operation function of COBOL. An <strong>SAF</strong> application cannot<br />

handle Cookie data using the environment variable operation function of COBOL.<br />

Use the subroutines <strong>for</strong> handling Cookie data shown below.<br />

• COBW3_SET_COOKIE, etc.<br />

This subroutine registers Cookie data.<br />

• COBW3_DEL_COOKIE, etc.<br />

This subroutine deletes registered Cookie data.<br />

• COBW3_INIT_COOKIE<br />

This subroutine initializes Cookie data to be sent to the client.<br />

• COBW3_GET_COOKIE, etc.<br />

This subroutine acquires Cookie data contained in a request.<br />

For example, modify processing <strong>for</strong> acquiring in<strong>for</strong>mation from the HTTP header as<br />

shown below.<br />

Contents of the CGI application<br />

DISPLAY "HTTP_USER_AGENT” UPON Environment-variable-name.<br />

ACCEPT Browser-in<strong>for</strong>mation FROM Value-of-the-environment-variable<br />

ON EXCEPTION<br />

MOVE "Error" TO Browser-in<strong>for</strong>mation<br />

END-ACCEPT.<br />

Modified contents of the <strong>SAF</strong> application<br />

MOVE "User-agent" TO COBW3-HEADER-NAME.<br />

CALL "COBW3_RECEIVE_HEADER" USING COBW3.<br />

IF COBW3-STATUS = ZERO THEN<br />

MOVE COBW3-HEADER-VALUE TO Browser-in<strong>for</strong>mation<br />

ELSE<br />

MOVE "Error" TO Browser-in<strong>for</strong>mation<br />

END-IF.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!