Giovanni's logo
Assign a session ID
this means Version 2
power search
blue line

A persistent CGI, each time it is called, must compute a unique session identifier to be used as a handle to recall it back on the next user transaction. Click here to know more about persistent CGI requirements.

A random integer generation function may help in computing such unique session ID. Click to see how to compute a random integer.

Mel's service program includes also function getSessionID. This function returns a 15-character string made of

  • the six characters of the job number
  • nine random digits.
 /copy mysrclib/qrpglesrc,hspecs
 /copy mysrclib/qrpglesrc,hspecsbnd
 * Variables common to all CGIs
 /copy mysrclib/qrpglesrc,prototypeb
 /copy mysrclib/qrpglesrc,usec
 /copy mysrclib/qrpglesrc,variables3
 *          ... etc. ...
 * Example of computing a Session ID
C                   eval      sessionid = getsessionid