|
SWSTOKEN FunctionRelated Topics
The SWSTOKEN built-in function provides a means of saving and restoring transaction-oriented data using a server-created token value. Transaction data can be saved before generating an outbound response to a Web transaction, and then be restored (using the token value) when the next transaction arrives. The token service allows you to create complex, inter-active Web transactions which need a scratch-pad area to save state information between Web transaction boundaries. All tokens have a timeout associated with them at creation time. If the token is not accessed within the timeout period the Server automatically deletes the token (along with the associated data).
SWSTOKEN SyntaxThe basic syntax of the SWSTOKEN function is: var = SWSTOKEN( func, arg2, arg3, arg 4 ) The first argument, func, to the SWSTOKEN function specifies the sub-function to be performed. The values which may be coded for the func argument are:
CREATE ServiceThe sub-function creates a new token value and saves data associated with the token. The data can later be retrieved or updated, using the token value. Syntax ExampleThe create service is invoked by coding: newtok = SWSVALUE('CREATE',data,timeout,userdata) The arguments to the CREATE service call are:
Return ValueThe token CREATE service always returns the 24-byte token value. A run-time error is generated if the token cannot be created.
GET ServiceThe sub-function retrieves the data associated with a previously created token. Syntax ExampleThe get service is invoked by coding: data = SWSVALUE('GET',token) The arguments to the GET service call are:
Return ValueThe token GET service returns the data associated with the token when it was created. The length of the data returned is always equal to the length of the data associated with the token when it was created. If the input token value is unknown the function returns a NULL string. This can occur because another application has caused the token to be explicitly deleted or because the token timeout period has expired.
PUT ServiceThe sub-function updates the data associated with a previously created token. Syntax ExampleThe PUT service is invoked by coding: rc = SWSVALUE('PUT',token,newdata) The arguments to the PUT service call are:
Return ValueThe token PUT service returns one of the following numeric values:
REPLACE ServiceThe sub-function replaces the data associated with a previously created token. Syntax ExampleThe REPLACE service is invoked by coding: rc = SWSVALUE('REPLACE',token,newdata) The arguments to the REPLACE service call are:
Return ValueThe token REPLACE service returns one of the following numeric values:
DELETE ServiceThe sub-function deletes a token and associated data and removes is from the system. Syntax ExampleThe DELETE service is invoked by coding: rc = SWSVALUE('DELETE',token) The arguments to the DELETE service call are:
Return ValueThe token DELETE service returns one of the following numeric values:
|