$Setg Subsys List: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Get list of subsystem-wide globals<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Get list of subsystem-wide globals<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is [[ | <p class="warning">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> | ||
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 17: | Line 15: | ||
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. | 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== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> %RC = $Setg_Subsys_List(list_id, sep, subsys_pat, glob_pat) | <p class="syntax"><section begin="syntax" /> %RC = $Setg_Subsys_List(list_id, sep, subsys_pat, glob_pat) | ||
Line 23: | Line 22: | ||
</p> | </p> | ||
<p class="caption">%RC is set to 0 or to an error indicator.</p> | <p class="caption">%RC is set to 0 or to an error indicator.</p> | ||
<p class="code"> | <p class="code"> | ||
0 - No errors | |||
-3 - No room to create $list items | -3 - No room to create $list items | ||
(if LISTFC $SirParm parameter not set) | |||
-6 - $List identifier invalid | -6 - $List identifier invalid | ||
3 - Subsystem name missing | |||
</p> | </p> | ||
<p class="caption">$Setg_Subsys_List return codes | <p class="caption">$Setg_Subsys_List return codes | ||
</p> | </p> | ||
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 class="syntaxTable"> | ||
<tr><th>*</th> | <tr><th>*</th> | ||
Line 44: | Line 44: | ||
</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: | |||
<p class="code"> Length Description | <p class="code"> Length Description | ||
------ ----------------------------------------- | ------ ----------------------------------------- | ||
Line 54: | Line 53: | ||
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. | 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. | ||
<p class="code"> BEGIN | <p class="code"> 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 | END | ||
</p> | </p> | ||
This $function is new in Version 5.5 of the ''[[Sirius Mods]]''. | |||
<ul class="smallAndTightList"> | |||
<li>[[Sirius $Functions]] | |||
<ul> | <li>[[Janus Web Servert]] | ||
<li> | |||
<li> | |||
</ul> | </ul> | ||
<p class="caption">Products authorizing $Setg_Subsys_List | <p class="caption">Products authorizing $Setg_Subsys_List | ||
</p> | </p> | ||
[[Category:$Functions|$Setg_Subsys_List]] | [[Category:$Functions|$Setg_Subsys_List]] |
Revision as of 18:21, 8 February 2011
<section begin="desc" />Get list of subsystem-wide globals<section end="desc" />
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
<section begin="syntax" /> %RC = $Setg_Subsys_List(list_id, sep, subsys_pat, glob_pat) <section end="syntax" />
0 - No errors -3 - No room to create $list items (if LISTFC $SirParm parameter not set) -6 - $List identifier invalid 3 - Subsystem name missing
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
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.
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
This $function is new in Version 5.5 of the Sirius Mods.