$Setg Subsys List: Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 39: Line 39:
<tr><th>?</th>
<tr><th>?</th>
<td>Matches any single character</td></tr>
<td>Matches any single character</td></tr>
<tr><th>"</th>
<tr><th>"</th>
<td>Indicates that the next character must be treated literally even if it is a wildcard character.
<td>Indicates that the next character must be treated literally even if it is a wildcard character.
Line 45: Line 46:
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:
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:


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


For 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.
==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.
<p class="code">BEGIN
<p class="code">BEGIN
   %I FLOAT
   %I FLOAT

Revision as of 22:26, 12 April 2013

Get list of subsystem-wide globals

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).

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; ss is the length of the separator string, gg is the length of the global name, vv is the length of the global value:

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