$ListNewA: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Create array of empty $lists<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Create array of empty $lists<section end="desc" /></span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListNewA function is [[to be entered]].</p>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $ListNewA function, but the feature is implemented in a much more natural way with [[Collections]].</p>


This function creates an array of empty $lists.  
This function creates an array of empty $lists.  
Line 9: Line 9:
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> [%RC =] $ListNewA(%array, option, start_dim1, size_dim1, -
<p class="syntax"><section begin="syntax" /> [%RC =] $ListNewA(%array, option, start_dim1, size_dim1, -
start_dim2, size_dim2, start_dim3, size_dim3)
              start_dim2, size_dim2, start_dim3, size_dim3)
<section end="syntax" /></p>
<section end="syntax" /></p>
<p class="caption">$ListNewA Function
<p class="caption">$ListNewA Function
Line 16: Line 16:


<ul>
<ul>
<li>The first argument is the array which will contain the identifiers of the $lists which are created. This is a required argument.  
<li>The first argument is the array which will contain the identifiers of the $lists which are created. This is a required argument.  
<li>The second argument, if set to the string &OSQ.NOREL&CSQ., indicates that the contents of the $lists are not to be emptied when a RELEASE ALL RECORDS statement is executed. This is an optional argument.  
<li>The second argument, if set to the string <tt>NOREL</tt>, indicates that the contents of the $lists are not to be emptied when a RELEASE ALL RECORDS statement is executed. This is an optional argument.  
<li>The third argument is the start index for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is 1. It must be between 1 and the size of the first dimension of the array.  
<li>The third argument is the start index for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is 1. It must be between 1 and the size of the first dimension of the array.  
<li>The fourth argument is the number of indices for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is the number of indices in the first dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.  
<li>The fourth argument is the number of indices for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is the number of indices in the first dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.  
Line 26: Line 25:
<li>The eighth argument is the number of indices for the created $list identifiers in the third dimension of the array. This is an optional argument; its default is the number of indices in the third dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.
<li>The eighth argument is the number of indices for the created $list identifiers in the third dimension of the array. This is an optional argument; its default is the number of indices in the third dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.
</ul>
</ul>
<p class="code">  
<p class="code">  
  0 - No errors
  0 - No errors
Line 32: Line 32:
<p class="caption">$ListNewA return codes
<p class="caption">$ListNewA return codes
</p>
</p>


All invocations of a particular call to $ListNewA will always set the same values to those elements of the array that are being set. Each time that call is executed, any previous $lists in those elements created by that call are deleted, and a new list is created.  
All invocations of a particular call to $ListNewA will always set the same values to those elements of the array that are being set. Each time that call is executed, any previous $lists in those elements created by that call are deleted, and a new list is created.  


 
$ListNewA performs the same processing as [[$ListNew]], but it allows the creation of multiple lists in one call, and it allows you to manage the lists in an array. For example:
$ListNewA performs the same processing as $LISTNEW, but it allows the creation of multiple lists in one call, and it allows you to manage the lists in an array. For example:
<p class="code"> B
<p class="code"> B
  %I FLOAT
  %I FLOAT
Line 46: Line 44:
  %Y = $ListNewA(%L, , 1, %X)
  %Y = $ListNewA(%L, , 1, %X)
  IF %Y NE 0 THEN
  IF %Y NE 0 THEN
PRINT 'Error ' %X ' creating ' %X 'lists'
    PRINT 'Error ' %X ' creating ' %X 'lists'
STOP
    STOP
  END IF
  END IF
  FOR %I FROM 1 TO %X
  FOR %I FROM 1 TO %X
%Y = $ProcOpn($READ('Enter proc name'))
    %Y = $ProcOpn($READ('Enter proc name'))
%Y = $ProcDat(%L(%I))
    %Y = $ProcDat(%L(%I))
  END FOR
  END FOR
  PRINT 'Here are the procs, last requested first:'
  PRINT 'Here are the procs, last requested first:'
  FOR %I FROM %X TO 1 BY -1
  FOR %I FROM %X TO 1 BY -1
PRINT ' '
    PRINT ' '
PRINT 'Proc number ' %I
    PRINT 'Proc number ' %I
FOR %Y FROM 1 TO $ListCnt(%L(%I))
    FOR %Y FROM 1 TO $ListCnt(%L(%I))
PRINT $ListInf(%L(%I), %Y)
      PRINT $ListInf(%L(%I), %Y)
END FOR
    END FOR
  END FOR
  END FOR
</p>
</p>
<p class="code">  
<p class="code">  
<ul class="smallAndTightList">
<ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Sirius functions]]</li>
Line 73: Line 71:
<li>[[Japanese functions]]</li>
<li>[[Japanese functions]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
</p>
</p>
<p class="caption">Products authorizing $ListNewA
<p class="caption">Products authorizing $ListNewA
</p>
</p>


[[Category:$Functions|$ListNewA]]
[[Category:$Functions|$ListNewA]]

Revision as of 15:42, 10 February 2011

<section begin="desc" />Create array of empty $lists<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is no direct OO equivalent for the $ListNewA function, but the feature is implemented in a much more natural way with Collections.

This function creates an array of empty $lists.

The $ListNewA function accepts eight arguments and returns a numeric result. It is a callable $function (:hdref refid=callfun.).

Syntax

<section begin="syntax" /> [%RC =] $ListNewA(%array, option, start_dim1, size_dim1, - start_dim2, size_dim2, start_dim3, size_dim3) <section end="syntax" />

$ListNewA Function

%RC is set to 0 or to an error indicator.

  • The first argument is the array which will contain the identifiers of the $lists which are created. This is a required argument.
  • The second argument, if set to the string NOREL, indicates that the contents of the $lists are not to be emptied when a RELEASE ALL RECORDS statement is executed. This is an optional argument.
  • The third argument is the start index for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is 1. It must be between 1 and the size of the first dimension of the array.
  • The fourth argument is the number of indices for the created $list identifiers in the first dimension of the array. This is an optional argument; its default is the number of indices in the first dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.
  • The fifth argument is the start index for the created $list identifiers in the second dimension of the array. This is an optional argument; its default is 1. It must be between 1 and the size of the second dimension of the array.
  • The sixth argument is the number of indices for the created $list identifiers in the second dimension of the array. This is an optional argument; its default is the number of indices in the second dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.
  • The seventh argument is the start index for the created $list identifiers in the third dimension of the array. This is an optional argument; its default is 1. It must be between 1 and the size of the third dimension of the array.
  • The eighth argument is the number of indices for the created $list identifiers in the third dimension of the array. This is an optional argument; its default is the number of indices in the third dimension of the array minus the start index, minus 1 (that is, all of the indices starting with the start index). It must be between 1 and this default value.

0 - No errors 1 - Invalid array bound

$ListNewA return codes

All invocations of a particular call to $ListNewA will always set the same values to those elements of the array that are being set. Each time that call is executed, any previous $lists in those elements created by that call are deleted, and a new list is created.

$ListNewA performs the same processing as $ListNew, but it allows the creation of multiple lists in one call, and it allows you to manage the lists in an array. For example:

B %I FLOAT %X FLOAT %Y FLOAT %L FLOAT ARRAY(10) %X = $READ('Number of procs to display, up to 10') %Y = $ListNewA(%L, , 1, %X) IF %Y NE 0 THEN PRINT 'Error ' %X ' creating ' %X 'lists' STOP END IF FOR %I FROM 1 TO %X %Y = $ProcOpn($READ('Enter proc name')) %Y = $ProcDat(%L(%I)) END FOR PRINT 'Here are the procs, last requested first:' FOR %I FROM %X TO 1 BY -1 PRINT ' ' PRINT 'Proc number ' %I FOR %Y FROM 1 TO $ListCnt(%L(%I)) PRINT $ListInf(%L(%I), %Y) END FOR END FOR

Products authorizing $ListNewA