$Setg Subsys List: Difference between revisions
m (1 revision) |
(Automatically generated page update) |
||
(22 intermediate revisions by 3 users not shown) | |||
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=" | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is the <var>[[ListOfGlobals (Subsystem function)|ListOfGlobals]]</var> <var>Subsystem</var> 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 17: | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = <span class="literal">$Setg_Subsys_List</span>(<span class="term">list_id</span>, [<span class="term">sep</span>], <span class="term">subsys_pat</span>, [<span class="term">glob_pat</span>]) | ||
< | |||
< | |||
</p> | </p> | ||
<p class="code"> | <p> | ||
<var class="term">%rc</var> is set to 0 or to an error indicator.</p> | |||
===Return codes=== | |||
<p class="code"> 0 - No errors | |||
-3 - No room to create $list items | |||
(if LISTFC <var>$SirParm</var> parameter not set) | |||
-6 - $List identifier invalid | |||
3 - Subsystem name missing | |||
</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: | ==Usage notes== | ||
<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 | <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> | ||
<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. | ||
</td></tr></table> | </td></tr></table> | ||
The format of the items created by $Setg_Subsys_List is as follows | <li>The format of the items created by <var>$Setg_Subsys_List</var> is as follows: | ||
< | <table> | ||
<tr class="head"><th>Length</th> <th>Description</th></tr> | |||
<tr><th><var>10</var></th> <td>Subsystem name, padded on right by blanks</td></tr> | |||
<tr><th>gg</th> <td>Global name</td></tr> | |||
<tr><th>ss</th> <td>Separator string</td></tr> | |||
<tr><th>vv</th> <td>Global value</td></tr> | |||
</ | </table> | ||
</ul> | |||
==Example== | |||
<p class="code"> BEGIN | 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 | |||
%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 | |||
</p> | </p> | ||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | |||
<li>[[Sirius functions]] | <li>[[List of $functions|Sirius functions]]</li> | ||
<li>[[Janus Web | <li>[[Janus Web Server]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$Setg_Subsys_List]] | [[Category:$Functions|$Setg_Subsys_List]] |
Latest revision as of 22:52, 20 September 2018
Get list of subsystem-wide globals
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Subsys_List function is the ListOfGlobals 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:
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