$ListRep Lstr: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(47 intermediate revisions by 3 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Replace a $list item with a longstring</span>
<span class="pageSubtitle">Replace a $list item with a longstring</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListRep_Lstr function is the [[Replace (Stringlist function)]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListRep_Lstr function is <var>[[Replace (Stringlist function)|Replace]]</var>.</p>


This function replaces an existing $list item with a longstring. Generally, this $list would have been created with the [[$ListNew]] function.  
This function replaces an existing $list item with a longstring. Generally, this $list would have been created with the [[$ListNew]] function.  


The $ListRep_Lstr function accepts three arguments and returns a numeric result. It is a callable $function (see [[Calling Sirius Mods $functions]]).  
The <var>$ListRep_Lstr</var> function accepts three arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function.  


The first argument is a $list identifier. This is a required argument.  
The first argument is a $list identifier. This is a required argument.  
Line 15: Line 15:


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> [%RESULT =] $ListRep_Lstr(list_identifier, item_num, string)
<p class="syntax">[%RESULT =] $ListRep_Lstr(list_identifier, item_num, string)
<section end="syntax" /></p>
<p class="caption">$ListRep_Lstr Function
</p>
</p>
<p class="caption">%RESULT is set to 0 if the new item length is the same as the replaced item length, 1 if it is shorter, 2 if it is longer, or a negative number if an error has occurred.</p>


<p class="code">  
<p><var class="term">%result</var> is set to 0 if the new item length is the same as the replaced item length, 1 if it is shorter, 2 if it is longer, or a negative number if an error has occurred.</p>
-3 - No room to add item
 
        (if LISTFC $SirParm parameter not set)
===Error codes===
All other errors cause request cancellation
<p class="code">-3 - No room to add item
        (if LISTFC <var>$SirParm</var> parameter not set)
All other errors cause request cancellation
</p>
</p>
<p class="caption">$ListRep_Lstr Error Codes
</p>
Before ''[[Sirius Mods]]'' Version 6.6, it was a request cancelling error to try to replace a Stringlist item with a longstring longer than the size limit of a Stringlist item: 6124 bytes. This limitation was eliminated in ''[[Sirius Mods]]'' Version 6.6.


$ListRep_Lstr works almost exactly like [[$ListRep]] except:
==Usage notes==
<ul>
<li><var>$ListRep_Lstr</var> works almost exactly like [[$ListRep]] except:


<ol>
<ul>
<li>It accepts a longstring input. $ListRep_Lstr can be used with regular strings as well to pick up automatic request cancellation on programming errors.  
<li>It accepts a longstring input. <var>$ListRep_Lstr</var> can be used with regular strings as well to pick up automatic request cancellation on programming errors.  
<li>It cancels the request on any errors such as invalid $list identifier or invalid $list item number.  
<li>It cancels the request on any errors such as invalid $list identifier or invalid $list item number.  
<li>It does not have an item length argument (argument 4 in [[$ListRep]]).
<li>It does not have an item length argument (argument 4 in [[$ListRep]]).
</ol>
</ul>


$ListRep_Lstr is extremely efficient if the $list item size is not being changed (return value for $ListRep_Lstr of 0), fairly efficient when a $list item is being replaced with a shorter string (return value of 1) and can be fairly expensive when a $list item is being replaced with a longer string (return value of 2). The latter case can be expensive because such a $ListRep_Lstr can result in the splitting of a $list leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent [[$ListRem]]s makes this possible. Because of this, heavy use of $LISREP_LSTRs that increase $list item size (and [[$ListIns]] and [[$ListRem]]) can result in "sparse" $lists which place an unnecessary burden on the buffer pool and CCATEMP. $List compression can be done using the [[$List_Copy_Items]] function.  
<li><var>$ListRep_Lstr</var> is extremely efficient if the $list item size is not being changed (return value for <var>$ListRep_Lstr</var> of 0), fairly efficient when a $list item is being replaced with a shorter string (return value of 1) and can be fairly expensive when a $list item is being replaced with a longer string (return value of 2). The latter case can be expensive because such a <var>$ListRep_Lstr</var> can result in the splitting of a $list leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent [[$ListRem]]s makes this possible. Because of this, heavy use of $LISREP_LSTRs that increase $list item size (and [[$ListIns]] and [[$ListRem]]) can result in "sparse" $lists which place an unnecessary burden on the buffer pool and CCATEMP. $List compression can be done using the [[$List_Copy_Items]] function.  
 
</ul>
$ListRep_Lstr is available in Version 6.2 and later of the ''[[Sirius Mods]]''.<p>


==Products authorizing {{PAGENAMEE}}==
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[List of $functions|Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
 
</ul>
</ul>
   
   
</p>
<p class="caption">Products authorizing $ListRep_Lstr
</p>
[[Category:$Functions|$ListRep_Lstr]]
[[Category:$Functions|$ListRep_Lstr]]

Latest revision as of 22:51, 20 September 2018

Replace a $list item with a longstring

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListRep_Lstr function is Replace.

This function replaces an existing $list item with a longstring. Generally, this $list would have been created with the $ListNew function.

The $ListRep_Lstr function accepts three arguments and returns a numeric result. It is a callable $function.

The first argument is a $list identifier. This is a required argument.

The second argument is the item number which is to be replaced. This is a required argument.

The third argument is a string that is to replace the $list item indicated by the second argument. This is a required argument.

Syntax

[%RESULT =] $ListRep_Lstr(list_identifier, item_num, string)

%result is set to 0 if the new item length is the same as the replaced item length, 1 if it is shorter, 2 if it is longer, or a negative number if an error has occurred.

Error codes

-3 - No room to add item (if LISTFC $SirParm parameter not set) All other errors cause request cancellation

Usage notes

  • $ListRep_Lstr works almost exactly like $ListRep except:
    • It accepts a longstring input. $ListRep_Lstr can be used with regular strings as well to pick up automatic request cancellation on programming errors.
    • It cancels the request on any errors such as invalid $list identifier or invalid $list item number.
    • It does not have an item length argument (argument 4 in $ListRep).
  • $ListRep_Lstr is extremely efficient if the $list item size is not being changed (return value for $ListRep_Lstr of 0), fairly efficient when a $list item is being replaced with a shorter string (return value of 1) and can be fairly expensive when a $list item is being replaced with a longer string (return value of 2). The latter case can be expensive because such a $ListRep_Lstr can result in the splitting of a $list leaf page. Once a leaf page is split, it will not be merged back together, even if subsequent $ListRems makes this possible. Because of this, heavy use of $LISREP_LSTRs that increase $list item size (and $ListIns and $ListRem) can result in "sparse" $lists which place an unnecessary burden on the buffer pool and CCATEMP. $List compression can be done using the $List_Copy_Items function.

Products authorizing $ListRep_Lstr