$ListInfI: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(37 intermediate revisions by 4 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Retrieve $list item into image</span>
<span class="pageSubtitle">Retrieve $list item into image</span>


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


This function copies data from a specified $list item to an image.  
This function copies data from a specified $list item to an image.  


The <var>$ListInfI</var> function accepts three arguments and returns a numeric result. It is a callable $function (see [[Calling Sirius Mods $functions]]).  
The <var>$ListInfI</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.
==Syntax==
<p class="syntax">[%result =] $ListInfI(list_identifier, item_num, image_id)
</p>


The second argument is the number of the item in the $list. This is a required argument.  
<table>
<tr><th>%result</th>
<td>A number that indicates whether or not an error has occurred. See [[#Return codes|Return codes]], below. </td></tr>


The third argument can either be a string containing the name of an image or any image item from the required image. This is an optional argument if a image has been associated with the $list with a [[$ListImg]] function. Otherwise, it is a required argument.
<tr><th>list_identifier</th>
<td>A $list identifier. This is a required argument. </td></tr>


==Syntax==
<tr><th>item_num</th>
<p class="syntax"><section begin="syntax" /> [%RESULT =] $ListInfI(list_identifier, item_num, image_id)
<td>The number of the item in the <var class="term">list_identifier</var> $list. This is a required argument. </td></tr>  
<section end="syntax" /></p>
<p class="caption">$ListInfI Function
</p>
<p class="caption">%RESULT is a number that indicates whether or not an error has occurred.</p>


One way to extract a $list item into an image called 'HEADSTONE' is as follows :
<tr><th>image_id</th>
<td>A string containing the name of an image (or, as shown below in the "Usage notes" section, an identifier of an image item from the image).
<p>
This is an optional argument if an image is associated with the $list by a <var>[[$ListImg]]</var> function. Otherwise, it is a required argument. </p></td></tr>
</table>


<p class="code"> %RC = $ListInfI(%LIST, %N, 'HEADSTONE')
===Return codes===
</p>
<p class="code"> 0 - Data successfully copied
A more efficient way of doing this would be
-5 - Required argument not specified
<p class="code"> %RC = $ListInfI(%LIST, %N, %HEADSTONE:ID)
-6 - $List identifier invalid
-7 - Item number not found in $list
-8 - Image not found or not active
</p>
</p>


The specific image item is irrelevant (as long as it is valid) in this call but is more efficient than specifying the image name in quotes because in the first example, the image name must be hashed and looked up (in NTBL) in each invocation of <var>$ListInfI</var> while in the second example, the hashing of the image name and lookup happens only once; at compile time.
==Usage notes==
One way to extract a $list item into an image called <code>HEADSTONE</code> is as follows:


An even neater and equally efficient way of coding this would be
<p class="code">%rc = $ListInfI(%list, %n, 'HEADSTONE') </p>
<p class="code">  
<p>
%RC = $ListImg(%LIST, %HEADSTONE:FNAME)
This is a more efficient way:
. . . . . .
%RC = $ListInfI(%LIST, %N)
</p>
</p>
 
<p class="code">%rc = $ListInfI(%list, %n, %HEADSTONE:ID)
In this last example, [[$ListImg]] associates the image with the $list, eliminating the need to specify the image name on the <var>$ListInfI</var>. This association is also useful in many other function calls in that it provides a structure to be associated with the $list that is useful for column oriented functions such as [[$ListFindI and $ListFindI_Up|$ListFindI]] and [[$ListSort and $ListSrt|$ListSrt]].
 
<p class="code">
  0 - Data successfully copied
-5 - Required argument not specified
-6 - $List identifier invalid
-7 - Item number not found in $list
-8 - Image not found or not active
</p>
</p>
<p class="caption">$ListInfI Error Codes
<p>
The specific image item is irrelevant (as long as it is valid) in this call, but is more efficient than specifying the quoted image name: In the first example, the image name must be hashed and looked up (in NTBL) in each invocation of <var>$ListInfI</var>, while in the second example, the hashing of the image name and lookup happens only once, and that is at compile time. </p>
<p>
Here is an even neater and equally efficient way of coding this: </p>
<p class="code">%rc = $ListImg(%list, %HEADSTONE:FNAME)
. . .
%rc = $ListInfI(%list, %n) </p>
<p>
In this last example, <var>[[$ListImg]]</var> associates the image with the $list, eliminating the need to specify the image name on the <var>$ListInfI</var>. This association is also useful in many other function calls by providing a structure to be associated with the $list that is useful for column-oriented functions such as <var>[[$ListFindI and $ListFindI_Up|$ListFindI]]</var> and <var>[[$ListSort and $ListSrt|$ListSrt]]</var>. </p>
<p>
<b>NOTE:</b> <var>[[$lists]]</var> items shorter than the target image do not modify the image contents beyond the <var>[[$lists]]</var> item length. As such, if <var>[[$ListInfI]]</var> is used with varying length Stringlist items, the images can contain "leftover" data after a <var>[[$ListInfI]]</var>. If this is a concern, a Prepare Image should be done before each <var>[[$ListInfI]]</var> invocation.
</p>
</p>
<p class="code">
 
==Products authorizing {{PAGENAMEE}}==  
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[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 $ListInfI
</p>


[[Category:$Functions|$ListInfI]]
[[Category:$Functions|$ListInfI]]

Latest revision as of 17:52, 11 January 2022

Retrieve $list item into image

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

This function copies data from a specified $list item to an image.

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

Syntax

[%result =] $ListInfI(list_identifier, item_num, image_id)

%result A number that indicates whether or not an error has occurred. See Return codes, below.
list_identifier A $list identifier. This is a required argument.
item_num The number of the item in the list_identifier $list. This is a required argument.
image_id A string containing the name of an image (or, as shown below in the "Usage notes" section, an identifier of an image item from the image).

This is an optional argument if an image is associated with the $list by a $ListImg function. Otherwise, it is a required argument.

Return codes

0 - Data successfully copied -5 - Required argument not specified -6 - $List identifier invalid -7 - Item number not found in $list -8 - Image not found or not active

Usage notes

One way to extract a $list item into an image called HEADSTONE is as follows:

%rc = $ListInfI(%list, %n, 'HEADSTONE')

This is a more efficient way:

%rc = $ListInfI(%list, %n, %HEADSTONE:ID)

The specific image item is irrelevant (as long as it is valid) in this call, but is more efficient than specifying the quoted image name: In the first example, the image name must be hashed and looked up (in NTBL) in each invocation of $ListInfI, while in the second example, the hashing of the image name and lookup happens only once, and that is at compile time.

Here is an even neater and equally efficient way of coding this:

%rc = $ListImg(%list, %HEADSTONE:FNAME) . . . %rc = $ListInfI(%list, %n)

In this last example, $ListImg associates the image with the $list, eliminating the need to specify the image name on the $ListInfI. This association is also useful in many other function calls by providing a structure to be associated with the $list that is useful for column-oriented functions such as $ListFindI and $ListSrt.

NOTE: $lists items shorter than the target image do not modify the image contents beyond the $lists item length. As such, if $ListInfI is used with varying length Stringlist items, the images can contain "leftover" data after a $ListInfI. If this is a concern, a Prepare Image should be done before each $ListInfI invocation.

Products authorizing $ListInfI