$Session_Create
Create a new session
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Session_Create function is the SetSession subroutine.
$Session_Create creates a new session, and it returns a zero, indicating success, or a number indicating the cause of error, if there is one.
Syntax
%rc = $Session_Create(sesid, [owner], [timeout], [opts])
sesid | The ID to be given to the new session. This is a required argument. | ||||
---|---|---|---|---|---|
owner | The userid that will own this session. An owner value of asterisk (*) 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. | ||||
timeout | 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 SESDEFTO parameter value. This optional argument defaults to -1, that is the SESDEFTO parameter value. | ||||
opts | A blank-delimited set of options to control the create process. The options are:
|
Return codes
%rc is set to 0 or to an error indicator.
0 - No errors 1 - Session id already exists for user 2 - Online session limit exceeded 3 - User session limit exceeded
Example
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)