$Web Restore List or $Web Rest List: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Restore_List or $Web_Rest_List}}
{{DISPLAYTITLE:$Web_Restore_List or $Web_Rest_List}}
<span class="pageSubtitle"><section begin="desc" />Restore saved $list<section end="desc" /></span>
<span class="pageSubtitle">Restore saved $list</span>


$Web_Restore_List restores a Sirius $list that had been saved in the same or an earlier session (with $Web_Save_List) to another $list. $WEB_REST_LIST is a synonym for <var>$Web_Restore_List</var>.
<var>$Web_Restore_List</var> restores a Sirius $list that had been saved in the same or an earlier session (with <var>$Web_Save_List</var>) to another $list. <var>$Web_Rest_List</var> is a synonym for <var>$Web_Restore_List</var>.


$Web_Restore_List is a [[Calling_Sirius_Mods_$functions|callable]] $function.  
<var>$Web_Restore_List</var> is a [[Calling_Sirius_Mods_$functions|callable]] $function.  


$Web_Restore_List accepts three arguments, the first two required, and it returns a numeric return code indicating the nature of any error.
<var>$Web_Restore_List</var> accepts three arguments, the first two required, and it returns a numeric return code indicating the nature of any error.


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /><span class="term">%rc</span> = $Web_Restore_List( listid, id, opts )
<p class="syntax"><span class="term">%rc</span> = <span class="literal">$Web_Restore_List</span>(<span class="term"> listid, id, opts</span> )
<section end="syntax" /></p>
</p>


===Syntax terms===
===Syntax terms===
Line 35: Line 35:
</table>
</table>


The default behavior of $WEB_REST_LIST is as if MOVE were specified.  
The default behavior of <var>$Web_Rest_List</var> is as if MOVE were specified.  
This default behavior can be changed on a thread basis by setting the <var>[[SRSPARM parameter|SRSPARM]]</var> parameter.
This default behavior can be changed on a thread basis by setting the <var>[[SRSPARM parameter|SRSPARM]]</var> parameter.
</td></tr></table>
</td></tr></table>
Line 53: Line 53:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li>$Web_Restore_List 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 $list 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><var>$Web_Restore_List</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 $list 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_List</var> must be issued under the same userid under which the <var>$Web_Save_List</var> was issued. This userid ''can'' be the WEBUSER userid.  
<li>A <var>$Web_Restore_List</var> must be issued under the same userid under which the <var>$Web_Save_List</var> was issued. This userid ''can'' be the WEBUSER userid.  
Line 65: Line 65:


==Examples==
==Examples==
In the following example, the ID for a previously saved $list is retrieved from an invisible form field. If the ID exists and the $list restored, the call to computationally expensive subroutine COMPLEX is skipped. Otherwise, the parameters for a very complex subroutine called COMPLEX are retrieved from form fields and the $list is rebuilt. Later in the code, the $list associated with $list identifier %LIST could be saved with [[$Web_Save_List]], whether it had been restored with <var>$Web_Restore_List</var> or built by subroutine COMPLEX.  
In the following example, the ID for a previously saved $list is retrieved from an invisible form field. If the ID exists and the $list restored, the call to computationally expensive subroutine <code>COMPLEX</code> is skipped. Otherwise, the parameters for a very complex subroutine called <code>COMPLEX</code> are retrieved from form fields and the $list is rebuilt. Later in the code, the $list associated with $list identifier %LIST could be saved with <var>$Web_Save_List</var>, whether it had been restored with <var>$Web_Restore_List</var> or built by subroutine <code>COMPLEX</code>.  
<p class="code">* Get the ID and try to restore the $list
<p class="code">* Get the ID and try to restore the $list
%ID = $Web_Form_Parm('FINDID')
%ID = $Web_Form_Parm('FINDID')
IF %ID NE '' THEN
IF %ID NE <nowiki>''</nowiki> THEN
   %RC = $Web_Restore_List(%LIST, %ID)
   %RC = $Web_Restore_List(%LIST, %ID)
   IF NOT %RC THEN
   IF NOT %RC THEN

Latest revision as of 21:35, 5 June 2013

Restore saved $list

$Web_Restore_List restores a Sirius $list that had been saved in the same or an earlier session (with $Web_Save_List) to another $list. $Web_Rest_List is a synonym for $Web_Restore_List.

$Web_Restore_List is a callable $function.

$Web_Restore_List accepts three arguments, the first two required, and it returns a numeric return code indicating the nature of any error.

Syntax

%rc = $Web_Restore_List( listid, id, opts )

Syntax terms

%rc A numeric status code.
listid The identifier of the $list to receive the saved $list. This identifier is probably the output from a $ListNew call. This argument is required. The current contents of the this $list are replaced by the contents of the saved $list.
id The 16-byte identifier of the saved record set that was returned by a previous $Web_Save_List call. This argument is required.
opts A blank delimited set of options that affects the function's behavior. This argument is optional; it can contain the following options:
MOVE Does a move-style restore, that is, the pointers to the source record set or $list are simply moved to the restored version, so the source saved record set or $list is no longer accessible after the call. This is more efficient than a COPY style save, but it does produce a potentially problematic side-effect.
COPY 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.

The default behavior of $Web_Rest_List is as if MOVE were specified. This default behavior can be changed on a thread basis by setting the SRSPARM parameter.

Status codes

Code Meaning
0 No error
1 Not a valid $list identifier
2 Identifier not found

Usage notes

  • $Web_Restore_List can be used on non-Janus Web Server threads by Janus Web Server customers. In fact, a $list 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_List must be issued under the same userid under which the $Web_Save_List was issued. This userid can be the WEBUSER userid.
  • If $Web_Restore_List is successful, the original contents of the $list are lost.
  • The primary purpose of $Web_Restore_List is to avoid redoing the complex processing required to build a large $list. There are many cases, however, where the original saved $list might be gone, either because of a timeout or an Online being cycled. Web applications that use $Web_Restore_List should be prepared to rebuild the $list if the $Web_Restore_List fails.
  • For more information about saved record sets and $lists, see "Janus Web Server Saved Record Set Support" and $Web_Save_List.

Examples

In the following example, the ID for a previously saved $list is retrieved from an invisible form field. If the ID exists and the $list restored, the call to computationally expensive subroutine COMPLEX is skipped. Otherwise, the parameters for a very complex subroutine called COMPLEX are retrieved from form fields and the $list is rebuilt. Later in the code, the $list associated with $list identifier %LIST could be saved with $Web_Save_List, whether it had been restored with $Web_Restore_List or built by subroutine COMPLEX.

* Get the ID and try to restore the $list %ID = $Web_Form_Parm('FINDID') IF %ID NE '' THEN %RC = $Web_Restore_List(%LIST, %ID) IF NOT %RC THEN JUMP TO GOTL1 END IF END IF * Couldn't restore it, rebuild $list %START = $Web_Form_Parm('FINDSTART') %END = $Web_Form_Parm('FINDEND') CALL COMPLEX(%LIST, %START, %END) GOTL1: