Giovanni's logo
Increment and Edit Page Counter (Number of times a page is visited)
questo significa Versione 2
indice analitico
M
power search
blue line
You may maintain and retrieve a counter for the number of times a CGI program of yours is accessed (a page is visited) by using Mel's service program subprocedure CountP

Read through to learn how to do it.



1. File CGICOUNT
File CGICOUNT is used to optionally score accesses to given CGI pages. You implicitly duplicate it from library cgidev2 to your object (production) library when you use command setcgilib.

2. Subprocedure countP
Use this procedure to increment and to retrieve the number of times a given page was accessed.

Example:
/copy mysrclib/qrpglesrc,prototypeb
/copy mysrclib/qrpglesrc,usec
/copy mysrclib/qrpglesrc,variables(1, or 2, or 3)
            ... etc. ...
 * Get updated counter for program "mylib/hello1" into field "counter"
C                   eval      rc = docmd('OVRDBF FILE(CGICOUNT) +
C                             TOFILE(mylib/CGICOUNT) +
C                             SECURE(*YES)')
C                   eval      counter=countp('mylib     HELLO1     ')