$Setg Subsys List: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle">Get list of subsystem-wide globals</span>
<span class="pageSubtitle">Get list of subsystem-wide globals</span>


<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is the [[ListOfGlobals (System/Subsystem function)]].</p>
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is <var>[[GlobalList (PersistentObjectInfo function)|GlobalList]]</var>.</p>


This function returns names and values from the current set of subsystem global variables. It may be useful in debugging situations.  
This function returns names and values from the current set of subsystem global variables. It may be useful in debugging situations.  
Line 26: Line 26:
<p class="code"> 0 - No errors
<p class="code"> 0 - No errors
-3 - No room to create $list items
-3 - No room to create $list items
        (if LISTFC <var>$SirParm</var> parameter not set)
    (if LISTFC <var>$SirParm</var> parameter not set)
-6 - $List identifier invalid
-6 - $List identifier invalid
  3 - Subsystem name missing
  3 - Subsystem name missing
Line 32: Line 32:


==Usage notes==
==Usage notes==
This function can be used for debugging, to retrieve values of selected global variables for selected subsystems. The names of subsystems and global variables can be specified using the following wildcard characters:
<ul>
<li>This function can be used for debugging, to retrieve values of selected global variables for selected subsystems. The names of subsystems and global variables can be specified using the following wildcard characters:


<table class="syntaxTable">
<table>
<tr><th>*</th>
<tr><th>*</th>
<td>Matches any number of characters including none</td></tr>
<td>Matches any number of characters including none</td></tr>
Line 44: Line 45:
</td></tr></table>
</td></tr></table>


The format of the items created by $Setg_Subsys_List is as follows; '''ss''' is the length of the separator string, '''gg''' is the length of the global name, '''vv''' is the length of the global value:
<li>The format of the items created by <var>$Setg_Subsys_List</var> is as follows:


<p class="code">Length Description
<table>
&#45;----- --------------------------------------
<tr class="head"><th>Length</th> <th>Description</th></tr>
10 Subsystem name, padded on right by blanks
<tr><th><var>10</var></th> <td>Subsystem name, padded on right by blanks</td></tr>
gg Global name
<tr><th>gg</th> <td>Global name</td></tr>
ss Separator string
<tr><th>ss</th> <td>Separator string</td></tr>
vv Global value
<tr><th>vv</th> <td>Global value</td></tr>
</p>
</table>
</ul>


==Example==
==Example==

Revision as of 21:06, 19 July 2013

Get list of subsystem-wide globals

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is GlobalList.

This function returns names and values from the current set of subsystem global variables. It may be useful in debugging situations.

The $Setg_Subsys_List function accepts four arguments and returns zero, indicating success, or a number indicating the cause of error, if there is one.

The first argument identifies the $list to which items for the subsystem globals will be added. This is a required argument.

The second argument is the string which is used to separate the global name from its value in each item of the output $list. This is an optional argument; if omitted, or if the null string is supplied, it defaults to a single byte with value X'00'. This separator value (X'00') can be particularly useful for sorting the output $list, as shown in the example below.

The third argument specifys the subsystem(s) whose global variables are to be examined for placement on the output $list. This argument may contain pattern matching characters. This is a required argument, and it may not be the null string.

The fourth argument is a pattern string; all global variables in the selected subsystem(s) matching this pattern are placed on the output $list. This is an optional argument; if omitted, all variables in the subsystems specified by the third argument are placed on the output $list.

Syntax

%rc = $Setg_Subsys_List(list_id, [sep], subsys_pat, [glob_pat])

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

Return codes

0 - No errors -3 - No room to create $list items (if LISTFC $SirParm parameter not set) -6 - $List identifier invalid 3 - Subsystem name missing

Usage notes

  • This function can be used for debugging, to retrieve values of selected global variables for selected subsystems. The names of subsystems and global variables can be specified using the following wildcard characters:
    * Matches any number of characters including none
    ? Matches any single character
    " Indicates that the next character must be treated literally even if it is a wildcard character.
  • The format of the items created by $Setg_Subsys_List is as follows:
    Length Description
    10 Subsystem name, padded on right by blanks
    gg Global name
    ss Separator string
    vv Global value

Example

The following request displays information about the global variables whose names start with the string 'DATE' in the subsystems whose names contain either the string 'AB' or with the string 'CD'. The display is sorted by subsystem name and global variable name; X'00' as the separator ensures this sort order.

BEGIN %I FLOAT %I2 FLOAT %L FLOAT %L2 FLOAT %X FLOAT %SEP STRING LEN 1 %S1 STRING LEN 255 %L = $ListNew %SEP = $X2C('00') %X = $Setg_Subsys_List(%L, %SEP, '*AB*') * Append more globals to $list: %X = $Setg_Subsys_List(%L, %SEP, '*CD*') %L2 = $ListSort(%L, '1,10,A 11,255,A') PRINT 'Subsystem Global' AND '/ Value' AT 33 %S1 = '----------' PRINT %S1 AND %S1 WITH %S1 AND ' ' - AND %S1 WITH %S1 FOR %X FROM 1 TO $ListCnt(%L2) %S1 = $ListInf(%L2, %X, 11) %I = $INDEX(%S1, %SEP) IF %I EQ 0 THEN %I = 256 END IF %I2 = %I IF %I LT 21 THEN %S1 = $PADR($SUBSTR(%S1, 1, %I - 1), ' ', 20) %I2 = 21 END IF PRINT $ListInf(%L2, %X, 1, 10) AND - $SUBSTR(%S1, 1, %I2 - 1) AND '/' - AND $ListInf(%L2, %X, 11 + %I) END FOR END

Products authorizing $Setg_Subsys_List