$Web Restore Recset or $Web Rest Recset: Difference between revisions
m (1 revision) |
m (→Syntax) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:<var>$Web_Restore_Recset</var> or $Web_Rest_Recset}} | {{DISPLAYTITLE:<var>$Web_Restore_Recset</var> or $Web_Rest_Recset}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Restore saved set of records</span> | ||
Line 10: | Line 10: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Restore_Recset</span>(<span class="term"> name, id, opts</span> ) | ||
< | </p> | ||
===Syntax terms=== | ===Syntax terms=== | ||
Line 27: | Line 27: | ||
<td>Does a ''copy''-style save, that is, the contents of the source record set or $list are copied to the restored version, so the source saved record set or $list is still accessible after the call. This is less efficient than a MOVE style save, but it does avoid a potentially problematic side-effect. | <td>Does a ''copy''-style save, that is, the contents of the source record set or $list are copied to the restored version, so the source saved record set or $list is still accessible after the call. This is less efficient than a MOVE style save, but it does avoid a potentially problematic side-effect. | ||
</td></tr></table> | </td></tr></table> | ||
The default behavior of $ | The default behavior of <var>$Web_Rest_Recset</var> is as if MOVE were specified. This default behavior can be changed on a thread basis, however, by setting the <var>[[SRSPARM parameter|SRSPARM]]</var> parameter. | ||
</td></tr></table> | </td></tr></table> | ||
Line 52: | Line 52: | ||
The target list or foundset inherits the record locking characteristics of the saved record set which inherited its characteristics from the saved list or foundset. This means that <var>$Web_Restore_Recset</var> makes it possible to restore a record set with different locking characteristics than what the name or label would automatically have. For example, if a saved record set was originally built with an FDR (FIND AND RESERVE) but restored to a label for an FDWOL, the found set associated with the label would still be enqueued in exclusive mode. Similarly, if a saved record set was originally built with a PLACE RECORDS but restored to a label for a FIND, the foundset for the label would be unenqueued. Again, because <var class="product">Model 204</var> LIST manipulation statements assume that LIST is unlocked, <var>$Web_Restore_Recset</var> will not allow an enqueued found set to be restored to a LIST. </p> | The target list or foundset inherits the record locking characteristics of the saved record set which inherited its characteristics from the saved list or foundset. This means that <var>$Web_Restore_Recset</var> makes it possible to restore a record set with different locking characteristics than what the name or label would automatically have. For example, if a saved record set was originally built with an FDR (FIND AND RESERVE) but restored to a label for an FDWOL, the found set associated with the label would still be enqueued in exclusive mode. Similarly, if a saved record set was originally built with a PLACE RECORDS but restored to a label for a FIND, the foundset for the label would be unenqueued. Again, because <var class="product">Model 204</var> LIST manipulation statements assume that LIST is unlocked, <var>$Web_Restore_Recset</var> will not allow an enqueued found set to be restored to a LIST. </p> | ||
<li><var>$Web_Restore_Recset</var> can be used on non-<var class="product">[[Janus Web Server]]</var> threads by <var class="product"> | <li><var>$Web_Restore_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). | ||
<li>A <var>$Web_Restore_Recset</var> must be issued under the same userid under which the <var>$Web_Save_Recset</var> was issued. This userid ''can'' be the WEBUSER userid. | <li>A <var>$Web_Restore_Recset</var> must be issued under the same userid under which the <var>$Web_Save_Recset</var> was issued. This userid ''can'' be the WEBUSER userid. | ||
Line 64: | Line 64: | ||
%ID = $Web_Form_Parm('FINDID') | %ID = $Web_Form_Parm('FINDID') | ||
IF %ID NE '' THEN | IF %ID NE <nowiki>''</nowiki> THEN | ||
%RC = $Web_Restore_Recset('F1', %ID) | %RC = $Web_Restore_Recset('F1', %ID) | ||
IF NOT %RC THEN | IF NOT %RC THEN | ||
Line 81: | Line 81: | ||
</p> | </p> | ||
<p> | <p> | ||
In the above example, the ID for a previous range find is retrieved from an invisible form field. If the ID exists and the record set is restored, the expensive FIND statement is skipped. Otherwise, the parameters for the FIND are retrieved from (possibly invisible) form fields and the FIND is redone. Later in the code, the record set associated with label F1 could be saved with [[$Web_Save_Recset]], whether it had been restored with <var>$Web_Restore_Recset</var> or built with the FIND. </p> | In the above example, the ID for a previous range find is retrieved from an invisible form field. If the ID exists and the record set is restored, the expensive FIND statement is skipped. Otherwise, the parameters for the FIND are retrieved from (possibly invisible) form fields and the FIND is redone. Later in the code, the record set associated with label F1 could be saved with <var>[[$Web_Save_Recset]]</var>, whether it had been restored with <var>$Web_Restore_Recset</var> or built with the FIND. </p> | ||
==See also== | ==See also== |
Latest revision as of 21:38, 5 June 2013
Restore saved set of records
$Web_Restore_Recset restores a Model 204 record list or foundset that had been saved in the same or an earlier session (with $Web_Save_Recset) to another list or foundset. $Web_Rest_Recset is a synonym for $Web_Restore_Recset.
$Web_Restore_Recset is a callable $function.
$Web_Restore_Recset accepts three arguments, the first two required, and it returns a numeric return code indicating the nature of any error.
Syntax
%rc = $Web_Restore_Recset( name, id, opts )
Syntax terms
name | A string containing the name of the list or foundset to which the saved record set is to be restored. This argument is required. name can contain the word "LIST," which means that the name must match the name of a list, not a foundset. This argument is required. | ||||
---|---|---|---|---|---|
id | The 16-byte identifier of the saved record set that was returned by a previous $Web_Save_Recset call. | ||||
opts | A blank delimited set of options that affects the function's behavior. This argument is optional, and it can contain the following options:
The default behavior of $Web_Rest_Recset is as if MOVE were specified. This default behavior can be changed on a thread basis, however, by setting the SRSPARM parameter. |
Return codes
Code | Meaning |
---|---|
0 | No error |
1 | Not a valid found set or list |
2 | Identifier not found |
3 | File or group mismatch |
Usage notes
- $Web_Restore_Recset must be given a target list or foundset that matches file for file the file or group for which a $Web_Save_Recset had been done. That is, if both $Web_Save_Recset and $Web_Restore_Recset were passed record sets associated with files, the files must be identical. If one was a file and another a group, the group must contain a single member that matches the single file. If both were passed group record sets, the groups must be composed of the same members. There is no requirement that groups match in other characteristics. For example, one group could be a PERM group the other a TEMP group or even an adhoc group.
- A record set that was saved from a list can be restored to a list or a foundset (FIND label). Similarly, a record set that was saved from an unlocked foundset can be restored to either a list or foundset. A record set saved from a locked found set, either share or exclusive, cannot be restored to a LIST.
The target list or foundset inherits the record locking characteristics of the saved record set which inherited its characteristics from the saved list or foundset. This means that $Web_Restore_Recset makes it possible to restore a record set with different locking characteristics than what the name or label would automatically have. For example, if a saved record set was originally built with an FDR (FIND AND RESERVE) but restored to a label for an FDWOL, the found set associated with the label would still be enqueued in exclusive mode. Similarly, if a saved record set was originally built with a PLACE RECORDS but restored to a label for a FIND, the foundset for the label would be unenqueued. Again, because Model 204 LIST manipulation statements assume that LIST is unlocked, $Web_Restore_Recset will not allow an enqueued found set to be restored to a LIST.
- $Web_Restore_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).
- A $Web_Restore_Recset must be issued under the same userid under which the $Web_Save_Recset was issued. This userid can be the WEBUSER userid.
- If $Web_Restore_Recset is successful, the original contents of the list or foundset are lost unless the COPY option is in effect.
Examples
The primary purpose of $Web_Restore_Recset is to avoid re-doing a complex or expensive FIND. There are many cases, however, where the original saved record set might be gone, either because of a timeout or an Online being cycled. Web applications that use $Web_Restore_Recset should be prepared to redo a FIND if the $Web_Restore_Recset fails.
* Get the ID and try to restore the record set %ID = $Web_Form_Parm('FINDID') IF %ID NE '' THEN %RC = $Web_Restore_Recset('F1', %ID) IF NOT %RC THEN JUMP TO GOTF1 END IF END FIND %START = $Web_Form_Parm('FINDSTART') %END = $Web_Form_Parm('FINDEND') F1: FIND ALL RECORDS FOR WHICH SDATE IS IN RANGE %START TO %END END FIND GOTF1:
In the above example, the ID for a previous range find is retrieved from an invisible form field. If the ID exists and the record set is restored, the expensive FIND statement is skipped. Otherwise, the parameters for the FIND are retrieved from (possibly invisible) form fields and the FIND is redone. Later in the code, the record set associated with label F1 could be saved with $Web_Save_Recset, whether it had been restored with $Web_Restore_Recset or built with the FIND.