$ListAdj: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:$ListAdj}} <span class="pageSubtitle"><section begin="desc" />Adjust length of $list item<section end="desc" /></span> <p class="warning">Most Sirius $functions h...")
 
(Automatically generated page update)
 
(49 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$ListAdj}}
{{DISPLAYTITLE:$ListAdj}}
<span class="pageSubtitle"><section begin="desc" />Adjust length of $list item<section end="desc" /></span>
<span class="pageSubtitle">Adjust length of $list item</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListAdj function is [[to be entered]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $ListAdj function as the Stringlist replacement for $lists are natively longstring capable.</p>


This function adjusts the length of a $list item. Generally, this $list would have been created with the $ListNew function.  
This function adjusts the length of a $list item. Generally, this $list would have been created with the [[$ListNew]] function.  


The $ListAdj function accepts three arguments and returns a numeric result. It is a callable $function (:hdref refid=callfun.).  
The <var>$ListAdj</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 12: Line 12:
The second argument is a $list item number. This is a required argument.  
The second argument is a $list item number. This is a required argument.  


The third argument is a number that indicates the new length of the $list item. This is a required argument. Its minimum valid value is 0; the maximum value is 6124 under ''[[Sirius Mods]]'' Version 6.5 and earlier, and it is 2**31-1 under ''[[Sirius Mods]]'' Version 6.6 and later. If this value is smaller than the current length of the $list item, the $list item is truncated. If this value is larger than the current length of the $list item, the $list item is padded with blanks to the indicated length.
The third argument is a number that indicates the new length of the $list item. This is a required argument. Its minimum valid value is 0; the maximum value is 6124 under <var class="product">[[Sirius Mods]]</var> Version 6.5 and earlier, and it is 2**31-1 under <var class="product">[[Sirius Mods]]</var> Version 6.6 and later. If this value is smaller than the current length of the $list item, the $list item is truncated. If this value is larger than the current length of the $list item, the $list item is padded with blanks to the indicated length.
 
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> [%RESULT =] $ListAdj(list_identifier, itemnum, length)
<p class="syntax">[%RESULT =] $ListAdj(list_identifier, itemnum, length)
<section end="syntax" /></p>
<p class="caption">$ListAdj Function
</p>
<p class="caption">%RESULT is set to 0 if the new item length is the same as the old item length, 1 if it is less, 2 if it is greater, or a negative number if an error has occurred.</p>
<p class="code">
-3 - No room to add item
(if LISTFC $SirParm parameter not set)
All other errors cause request cancellation
</p>
<p class="caption">$ListAdj Error Codes
</p>
</p>


<p><var class="term">%result</var> is set to 0 if the new item length is the same as the old item length, 1 if it is less, 2 if it is greater, or a negative number if an error has occurred.</p>


The following example illustrates how $ListAdj can be used to add an asterisk to the end of a $list item:
===Error codes===
<p class="code"> %LEN = $ListILn(%LIST, %NUM)
<p class="code">-3 - No room to add item
%RC = $ListAdj(%LIST, %NUM, %LEN + 1)
      (if LISTFC <var>$SirParm</var> parameter not set)
%RC = $ListOvl(%LIST, %NUM, %LEN + 1, '*')
All other errors cause request cancellation
</p>
</p>


==Usage notes==
<ul>
<li><var>$ListAdj</var> is extremely efficient if the $list item size is not being changed (return value for <var>$ListAdj</var> of 0), fairly efficient when a $list item is being shortened (return value of 1) and can be fairly expensive when a $list item is being lengthened (return value of 2). The latter case can be expensive because such a <var>$ListAdj</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 $LISTREMs (or $LISTADJs) makes this possible.
<p>
Because split leaf pages remain split, heavy use of $LISADJ calls that increase $list item size (and <var>$ListIns</var> and $ListRem) can result in "sparse&amp;CQ. $lists which place an unnecessary burden on the buffer pool and CCATEMP. It can also result in an inability to add an item to the end of the $list (via $ListAdd) because of a full pointer page, even though the $list is nowhere near the theoretical capacity for a $list. $List compression can be done using the <var>[[$List_Copy_Items]]</var> function. </p>
</ul>


$ListAdj is extremely efficient if the $list item size is not being changed (return value for $ListAdj of 0), fairly efficient when a $list item is being shortened (return value of 1) and can be fairly expensive when a $list item is being lengthened (return value of 2). The latter case can be expensive because such a $ListAdj 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 (or $LISTADJs) makes this possible.
==Example==
The following example illustrates how <var>$ListAdj</var> can be used to add an asterisk to the end of a $list item:


Because split leaf pages remain split, heavy use of $LISADJ calls that increase $list item size (and $ListIns and $ListRem) can result in "sparse&CQ. $lists which place an unnecessary burden on the buffer pool and CCATEMP. It can also result in an inability to add an item to the end of the $list (via $ListAdd) because of a full pointer page, even though the $list is nowhere near the theoretical capacity for a $list. $List compression can be done using the $List_Copy_Items function, documented in :hdref refid=listcit..<p>
<p class="code">%LEN = $ListILn(%LIST, %NUM)
%RC = $ListAdj(%LIST, %NUM, %LEN + 1)
%RC = $ListOvl(%LIST, %NUM, %LEN + 1, '*')
</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 $ListAdj
</p>
[[Category:$Functions|$ListAdj]]
[[Category:$Functions|$ListAdj]]

Latest revision as of 22:51, 20 September 2018

Adjust length of $list item

Note: Many $functions have been deprecated in favor of Object Oriented methods. There is no OO equivalent for the $ListAdj function as the Stringlist replacement for $lists are natively longstring capable.

This function adjusts the length of a $list item. Generally, this $list would have been created with the $ListNew function.

The $ListAdj 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 a $list item number. This is a required argument.

The third argument is a number that indicates the new length of the $list item. This is a required argument. Its minimum valid value is 0; the maximum value is 6124 under Sirius Mods Version 6.5 and earlier, and it is 2**31-1 under Sirius Mods Version 6.6 and later. If this value is smaller than the current length of the $list item, the $list item is truncated. If this value is larger than the current length of the $list item, the $list item is padded with blanks to the indicated length.

Syntax

[%RESULT =] $ListAdj(list_identifier, itemnum, length)

%result is set to 0 if the new item length is the same as the old item length, 1 if it is less, 2 if it is greater, 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

  • $ListAdj is extremely efficient if the $list item size is not being changed (return value for $ListAdj of 0), fairly efficient when a $list item is being shortened (return value of 1) and can be fairly expensive when a $list item is being lengthened (return value of 2). The latter case can be expensive because such a $ListAdj 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 (or $LISTADJs) makes this possible.

    Because split leaf pages remain split, heavy use of $LISADJ calls that increase $list item size (and $ListIns and $ListRem) can result in "sparse&CQ. $lists which place an unnecessary burden on the buffer pool and CCATEMP. It can also result in an inability to add an item to the end of the $list (via $ListAdd) because of a full pointer page, even though the $list is nowhere near the theoretical capacity for a $list. $List compression can be done using the $List_Copy_Items function.

Example

The following example illustrates how $ListAdj can be used to add an asterisk to the end of a $list item:

%LEN = $ListILn(%LIST, %NUM) %RC = $ListAdj(%LIST, %NUM, %LEN + 1) %RC = $ListOvl(%LIST, %NUM, %LEN + 1, '*')

Products authorizing $ListAdj