$Session_Create
<section begin="desc" />Create a new session<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Create function is to be entered.
$Session_Create creates a new session, accepts four arguments and returns a zero, indicating success, or a number indicating the cause of error, if there is one.
The first argument is the ID to be given to the new session. This is a required argument.
The second argument is the userid that will own this session. An owner of "*" means that the session is public, that is available to all users. Only a system administrator can create a non-public session for a user other than itself. This optional argument defaults to the creating user's userid.
The third argument is the time after a $Session_Close (or logout) after which the session is considered timed-out, that is eligible for deletion. A value of -1 means use the SRSDEFTO parameter value. This optional argument defaults to -1, that is the SRSDEFTO parameter value.
The fourth argument is a blank delimited set of options to control the create process. The options are:
OPEN | Automatically open the session upon creating it. This is the default behavior. |
---|---|
NOOPEN | Don't automatically open the session upon creating it. This is not the default behavior but might be useful if creating a session for another user or creating many sessions at once. |
Syntax
<section begin="syntax" /> %RC = $Session_Create(sesid, owner, timeout, opts) <section end="syntax" />
0 - No errors 1 - Session id already exists for user 2 - Online session limit exceeded 3 - User session limit exceeded
The following example creates a session called "GROUCHO" followed by a timestamp then sets a cookie for a web application so that the session can be easily located on subsequent web requests.
%SESID = 'GROUCHO' WITH $SirTime %RC = $Session_Create(%SESID, , 3600) %RC = $WEB_SET_COOKIE('SESID', %SESID)