$Web Save Recset: Difference between revisions
m (→Syntax) |
|||
(25 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Save_Recset}} | {{DISPLAYTITLE:$Web_Save_Recset}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Save set of records</span> | ||
$Web_Save_Recset saves a | <var>$Web_Save_Recset</var> saves a <var class="product">Model 204</var> list or foundset so it can be restored in the same or a later session (with <var>[[$Web_Restore_Recset]]</var>). | ||
<var>$Web_Save_Recset</var> accepts three arguments, the first one required, and it returns a string containing a 16-byte identifier (all displayable characters) for the saved record set, or it returns a null indicating that the record set could not be saved. The returned identifier must be passed to <var>$Web_Restore_Recset</var> to restore the saved record set. | |||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%id</span> = <span class="literal">$Web_Save_Recset</span>( <span class="term">name</span>, [<span class="term">timeout</span>], [<span class="term">rcvar</span>], [<span class="term">opts</span>] ) | ||
< | </p> | ||
===Syntax terms=== | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>name</th> | <tr><th>name</th> | ||
Line 16: | Line 17: | ||
<td>The maximum length of time that the record set will be saved. If ''timeout'' is greater than the value of the SRSMAXTO system parameter, the SRSMAXTO value will be used for the maximum timeout. If the timeout parameter is not specified or is 0, the record set will timeout after the number of seconds specified by the SRSDEFTO system parameter.</td></tr> | <td>The maximum length of time that the record set will be saved. If ''timeout'' is greater than the value of the SRSMAXTO system parameter, the SRSMAXTO value will be used for the maximum timeout. If the timeout parameter is not specified or is 0, the record set will timeout after the number of seconds specified by the SRSDEFTO system parameter.</td></tr> | ||
<tr><th>rcvar</th> | <tr><th>rcvar</th> | ||
<td>A variable to receive a return code indicating the exact nature of the error if $Web_Save_Recset returns a null. Possible values for ''rcvar'' are | <td>A variable to receive a return code indicating the exact nature of the error if <var>$Web_Save_Recset</var> returns a null. Possible values for ''rcvar'' are | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>0</th> | <tr><th>0</th> | ||
Line 27: | Line 28: | ||
<td>Group too large. This can only happen if SRSMAX is very small, like 1 or 2.</td></tr> | <td>Group too large. This can only happen if SRSMAX is very small, like 1 or 2.</td></tr> | ||
<tr><th>4</th> | <tr><th>4</th> | ||
<td>Can't SATTACH PST. This means that the | <td>Can't SATTACH PST. This means that the <var class="product">Model 204</var> NSUBTKS system parameter should be increased.</td></tr> | ||
</td></tr></table> | <tr><th>5</th> | ||
<td>No free session blocks</td></tr> | |||
<tr><th>6</th> | |||
<td>User limit exceeded</td></tr> | |||
<tr><th>7</th> | |||
<td>COPY type save requested for exclusively locked recordset, or saved recordset would conflict with other locks held by user</td></tr> | |||
<tr><th>8</th> | |||
<td>CCATEMP full (request cancelled)</td></tr> | |||
</table> | |||
<tr><th>opts</th> | <tr><th>opts</th> | ||
<td>A blank-delimited set of options that affects the function's behavior. This argument is optional, and it can contain the following options: | <td>A blank-delimited set of options that affects the function's behavior. This argument is optional, and it can contain the following options: | ||
Line 49: | Line 58: | ||
<td>Do a ''copy''-style save, that is, copy the contents of the source record set to the saved version, so the source record set is not modified after the save. This is less efficient than a MOVE style save, but it does avoid a potentially problematic side-effect. | <td>Do a ''copy''-style save, that is, copy the contents of the source record set to the saved version, so the source record set is not modified after the save. This is less efficient than a MOVE style save, but it does avoid a potentially problematic side-effect. | ||
</td></tr></table> | </td></tr></table> | ||
'''Note:''' The default behavior of $Web_Save_Recset is as if STEAL, USTEAL, and MOVE were specified. You can use the system parameter <var>[[SRSPARM parameter|SRSPARM]]</var> to change this default. | '''Note:''' The default behavior of <var>$Web_Save_Recset</var> is as if STEAL, USTEAL, and MOVE were specified. You can use the system parameter <var>[[SRSPARM parameter|SRSPARM]]</var> to change this default. | ||
</td></tr> | </td></tr> | ||
</table> | </table> | ||
$Web_Save_Recset will not save a sorted set. It '''will''' save both lists and foundsets with any kind of enqueueing | ==Usage notes== | ||
<ul> | |||
<li><var>$Web_Save_Recset</var> will not save a sorted set. It '''will''' save both lists and foundsets with any kind of enqueueing — share locks (normal FIND statement), unlocked (FIND WITHOUT LOCKS or FDWOL), and exclusively locked (FIND AND RESERVE or FDR). The enqueue on the record set is held by the saved record set PST, until the record set is discarded because of timeout or restored via <var>$Web_Restore_Recset</var>. The list or foundset to be saved can be associated with a group rather than a file. | |||
$Web_Save_Recset can be used on non- | <li><var>$Web_Save_Recset</var> can be used on non-<var class="product">[[Janus Web Server]]</var> threads by <var class="product">[[Janus Web Server]]</var> customers. In fact, a record set can be saved on one type of thread (say a <var class="product">[[Janus Web Server]]</var> thread) and restored on another (say a VTAM 3270 thread). | ||
$Web_Save_Recset returns a 16-byte identifier made up of displayable characters. This identifier is required to restore the record set. In a web application, this means that the identifier should be stashed in a cookie or an invisible form field for retrieval by a procedure that would issue a $Web_Restore_Recset. | <li><var>$Web_Save_Recset</var> returns a 16-byte identifier made up of displayable characters. This identifier is required to restore the record set. In a web application, this means that the identifier should be stashed in a cookie or an invisible form field for retrieval by a procedure that would issue a <var>$Web_Restore_Recset</var>. | ||
</ul> | |||
<p class="code"> | ==Examples== | ||
<ol> | |||
<li>In the following example, a range find is done and the results are saved via <var>$Web_Save_Recset</var>. The identifier is then saved in a cookie using the <var>$Web_Set_Cookie</var> function. | |||
<p class="code">* Do a nasty range find | |||
F: FIND ALL RECORDS FOR WHICH | |||
SDATE IS IN RANGE FROM 19960101 TO 19961231 | |||
END FIND | |||
* Save the results for later | |||
%ID = $Web_Save_Recset('F') | |||
* Save ID in a cookie | |||
%RC = $Web_Set_Cookie('FINDID', %ID) | |||
</p> | </p> | ||
In the | <li>In the following example, the result of a find is placed on a list and then saved via <var>$Web_Save_Recset</var>. | ||
<p class="code">* Place results onto a list | |||
<p class="code"> | |||
PLACE RECORDS IN NASTYFIND ON SAVELIST | |||
* Save the results for later | |||
%ID = $Web_Save_Recset('LIST SAVELIST') | |||
</p> | </p> | ||
</ol> | |||
==See also== | |||
<ul> | |||
<li><var>[[$Web_Restore_Recset]]</var> | |||
</ul> | |||
[[Category:Janus Web Server $functions|$Web_Save_Recset]] | [[Category:Janus Web Server $functions|$Web_Save_Recset]] |
Latest revision as of 13:48, 26 June 2013
Save set of records
$Web_Save_Recset saves a Model 204 list or foundset so it can be restored in the same or a later session (with $Web_Restore_Recset).
$Web_Save_Recset accepts three arguments, the first one required, and it returns a string containing a 16-byte identifier (all displayable characters) for the saved record set, or it returns a null indicating that the record set could not be saved. The returned identifier must be passed to $Web_Restore_Recset to restore the saved record set.
Syntax
%id = $Web_Save_Recset( name, [timeout], [rcvar], [opts] )
Syntax terms
name | A string containing the name of the list or foundset to be saved. The name of a foundset is the label for the FIND statement associated with the foundset. name can contain the word "LIST," which means that the name must match the name of a list, not a foundset. | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
timeout | The maximum length of time that the record set will be saved. If timeout is greater than the value of the SRSMAXTO system parameter, the SRSMAXTO value will be used for the maximum timeout. If the timeout parameter is not specified or is 0, the record set will timeout after the number of seconds specified by the SRSDEFTO system parameter. | ||||||||||||||||||
rcvar | A variable to receive a return code indicating the exact nature of the error if $Web_Save_Recset returns a null. Possible values for rcvar are
| ||||||||||||||||||
opts | A blank-delimited set of options that affects the function's behavior. This argument is optional, and it can contain the following options:
Note: The default behavior of $Web_Save_Recset is as if STEAL, USTEAL, and MOVE were specified. You can use the system parameter SRSPARM to change this default. |
Usage notes
- $Web_Save_Recset will not save a sorted set. It will save both lists and foundsets with any kind of enqueueing — share locks (normal FIND statement), unlocked (FIND WITHOUT LOCKS or FDWOL), and exclusively locked (FIND AND RESERVE or FDR). The enqueue on the record set is held by the saved record set PST, until the record set is discarded because of timeout or restored via $Web_Restore_Recset. The list or foundset to be saved can be associated with a group rather than a file.
- $Web_Save_Recset can be used on non-Janus Web Server threads by Janus Web Server customers. In fact, a record set can be saved on one type of thread (say a Janus Web Server thread) and restored on another (say a VTAM 3270 thread).
- $Web_Save_Recset returns a 16-byte identifier made up of displayable characters. This identifier is required to restore the record set. In a web application, this means that the identifier should be stashed in a cookie or an invisible form field for retrieval by a procedure that would issue a $Web_Restore_Recset.
Examples
- In the following example, a range find is done and the results are saved via $Web_Save_Recset. The identifier is then saved in a cookie using the $Web_Set_Cookie function.
* Do a nasty range find F: FIND ALL RECORDS FOR WHICH SDATE IS IN RANGE FROM 19960101 TO 19961231 END FIND * Save the results for later %ID = $Web_Save_Recset('F') * Save ID in a cookie %RC = $Web_Set_Cookie('FINDID', %ID)
- In the following example, the result of a find is placed on a list and then saved via $Web_Save_Recset.
* Place results onto a list PLACE RECORDS IN NASTYFIND ON SAVELIST * Save the results for later %ID = $Web_Save_Recset('LIST SAVELIST')