$ListInfI: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
(12 intermediate revisions by 3 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="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListInfI function is <var>[[GetImage (Stringlist subroutine)|GetImage]]</var>.</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.  
Line 8: Line 8:
The <var>$ListInfI</var> function accepts three arguments and returns a numeric result. It is a [[Calling Sirius Mods $functions|callable]] $function.  
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">[%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>  
</p>


<p><var class="term">%result</var> is a number that indicates whether or not an error has occurred.</p>
<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>


===Error codes===
===Return codes===
<p class="code"> 0 - Data successfully copied
<p class="code"> 0 - Data successfully copied
-5 - Required argument not specified
-5 - Required argument not specified
Line 29: Line 37:


==Usage notes==
==Usage notes==
<ul>
One way to extract a $list item into an image called <code>HEADSTONE</code> is as follows:
<li>One way to extract a $list item into an image called 'HEADSTONE' is as follows :


<p class="code">%RC = $ListInfI(%LIST, %N, 'HEADSTONE')
<p class="code">%rc = $ListInfI(%list, %n, 'HEADSTONE') </p>
<p>
This is a more efficient way:
</p>
</p>
This is a more efficient way:
<p class="code">%rc = $ListInfI(%list, %n, %HEADSTONE:ID)
<p class="code">%RC = $ListInfI(%LIST, %N, %HEADSTONE:ID)
</p>
</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: 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.  
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>
<p>
Here is an even neater and equally efficient way of coding this: </p>
Here is an even neater and equally efficient way of coding this: </p>
<p class="code">%RC = $ListImg(%LIST, %HEADSTONE:FNAME)
<p class="code">%rc = $ListImg(%list, %HEADSTONE:FNAME)
  . . .  
  . . .  
%RC = $ListInfI(%LIST, %N)
%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>
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 in that it provides 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>.
</ul>


==Products authorizing {{PAGENAMEE}}==  
==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>[http://m204wiki.rocketsoftware.com/images/4/4a/JoclrNew.pdf Janus Open Client]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[http://m204wiki.rocketsoftware.com/images/1/17/JosrvrNew.pdf 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>


[[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