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.

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

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

WORKING-STORAGE SECTION.<br />

COPY COBW3.<br />

* COPY COBW3<strong>SAF</strong>.<br />

LINKAGE SECTION.<br />

01 <strong>SAF</strong>CTX POINTER.<br />

PROCEDURE DIVISION USING <strong>SAF</strong>CTX.<br />

MOVE LOW-VALUE TO COBW3.<br />

* MOVE LOW-VALUE TO COBW3<strong>SAF</strong><br />

SET COBW3-CONTEXT TO <strong>SAF</strong>CTX.<br />

* SET COBW3-<strong>SAF</strong>-CONTEXT TO <strong>SAF</strong>CTX.<br />

Note: Delete the comment indicators when using a <strong>SAF</strong> specific function.<br />

Environment Variable Operations<br />

An environment variable block is assigned to each process. Since CGI applications<br />

run as separate processes, each is responsible <strong>for</strong> its own environment variables and<br />

it will not interfere with other processes. However, an <strong>SAF</strong> application runs as<br />

several threads in NES process. Thus, the <strong>SAF</strong> application may affect NES or other<br />

applications if it modifies environment variables. Thus, it is necessary to make<br />

alterations in order to remove the use of environment variables when converting an<br />

application from CGI to <strong>SAF</strong>.<br />

It is not safe to assume that the current folder is unchanged when a <strong>SAF</strong> application<br />

is called. Thus, the user must pay attention to functions that use the current folder<br />

in the background, <strong>for</strong> example, a file operation specifying a relative path from the<br />

current folder. To avoid trouble, the following methods are recommended:<br />

• Specifying a file in an absolute path<br />

Contents of the CGI application<br />

MOVE "RESPONSE.HTM" TO COBW3-HTML-FILENAME.<br />

CALL "COBW3_PUT_HTML" USING COBW3.<br />

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

MOVE "C:\COBOL\<strong>SAF</strong>\RESPONSE.HTM" TO COBW3-HTML-FILENAME.<br />

CALL "COBW3_PUT_HTML" USING COBW3.<br />

• Specifying a file position using the physical path corresponding to the virtual path<br />

Use COBW3_GET_REQUEST_INFO to acquire the physical path corresponding to<br />

the virtual path.<br />

Contents of the CGI application<br />

MOVE "RESPONSE.HTM" TO COBW3-HTML-FILENAME.<br />

CALL "COBW3_PUT_HTML" USING COBW3.

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

Saved successfully!

Ooh no, something went wrong!