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.

COBOL program (<strong>SAF</strong>MAIN.cob)<br />

Chapter 6. Samples 91<br />

000010*---------------------------------------------------------*<br />

000020* All Rights Reserved, Copyright© FUJITSU LIMITED 2000-2002 *<br />

000030* *<br />

000040* Filename: <strong>SAF</strong>MAIN.cob *<br />

000050* Abstract: Example demonstrating the <strong>SAF</strong> subroutine *<br />

000060*---------------------------------------------------------*<br />

000070 identification division.<br />

000080 program-id. <strong>SAF</strong>-MAIN.<br />

000090 environment division.<br />

000100 data division.<br />

000110 working-storage section.<br />

000120 copy COBW3.<br />

000130*<br />

000140 01 HTMLFilename pic X(64).<br />

000150 01 pathName pic X(256).<br />

000160 01 pathSize pic 9(05).<br />

000170 01 copyStartPos pic 9(05).<br />

000171 01 leftLength pic 9(05).<br />

000180 01 AccessCount pic 9(05).<br />

000190*<br />

000200 linkage section.<br />

000210 01 safCtx pointer<br />

000220*<br />

000230 procedure division using safCtx.<br />

000240*<br />

000250 SafSample1-Start.<br />

000260*<br />

000270* Initialize the work area <strong>for</strong> the <strong>SAF</strong> subroutine<br />

000280 move low-value to COBW3.<br />

000290 set COBW3-CONTEXT to safCtx.<br />

000300*<br />

000310* Initialize the <strong>SAF</strong> subroutine work environment and obtain<br />

000320* a Web parameter.<br />

000330 call "COBW3_INIT" using COBW3.<br />

000340*<br />

000350 move space to pathName.<br />

000360*<br />

000370 move "Your Access Counter" to COBW3-COOKIE-NAME.<br />

000380 call "COBW3_GET_COOKIE" using COBW3.<br />

000390 if program-status not = zero then<br />

000400 move "<strong>SAF</strong>ERROR.htm" to HTMLFilename<br />

000410 per<strong>for</strong>moutputScreenProc<br />

000420 else if COBW3-SEARCH-FLAG-NON then<br />

000430 move 1 to COBW3-COOKIE-VALUE<br />

000440 per<strong>for</strong>m entryAccessCounterProc<br />

000450 move "<strong>SAF</strong>RPLY1.htm" to HTMLFilename<br />

000460 per<strong>for</strong>m outputscreenProc<br />

000470 else<br />

000480 per<strong>for</strong>m outputContinuousScreenProc.<br />

000490 end-if.<br />

000500*<br />

000510 Finish-Pos.<br />

000520*<br />

000530* Release the resource obtained by the <strong>SAF</strong> subroutine<br />

000540 call "COBW3_FREE” using COBW3.<br />

000550*<br />

000560 SafSample1-End.<br />

000570*<br />

000580 exit program.<br />

000590*<br />

000600 outputContinuousScreenProc section.<br />

000610* Registration of various conversion data<br />

000620* Get the Cookie data <strong>for</strong> AccessCounter<br />

000630 compute AccessCounter = function NUMVAL(COBW3-COOKIE-VALUE).<br />

000640 add 1 to AccessCounter.<br />

000650 move AccessCounter to COBW3-COOKIE-VALUE.<br />

000660 move zero to COBW3-COOKIE-VALUE-LENGTH.<br />

000670*

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

Saved successfully!

Ooh no, something went wrong!