$Setg Sys: Difference between revisions
m (1 revision) |
(Automatically generated page update) |
||
(38 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Setg_Sys}} | {{DISPLAYTITLE:$Setg_Sys}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Set system-wide global</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_Sys function is the <var>[[SetGlobal (System subroutine)|SetGlobal]]</var> <var>System</var> subroutine.</p> | ||
This function allows a user to set the value of a <var class="product">Model 204</var> "global variable" which has a system-wide scope. These are used for the value of the $GetG function or dummy string ("?&") substitution. The order in which the different scopes of global variables are searched can be controlled using <var>$SirParm</var> arguments: for $GETG, with 'GETGSYS', and for dummy strings, with 'DUMMYSYS'. | |||
This function allows a user to set the value of a | |||
The $Setg_Sys function accepts two arguments and returns zero, indicating success, or a number indicating the cause of error, if there is one. | The $Setg_Sys function accepts two arguments and returns zero, indicating success, or a number indicating the cause of error, if there is one. | ||
Line 16: | Line 14: | ||
System administrator privileges are required to invoke this $function. | System administrator privileges are required to invoke this $function. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = <span class="literal">$Setg_Sys</span>([<span class="term">glob_name</span>], [<span class="term">value</span>]) | ||
< | |||
< | |||
</p> | </p> | ||
<p class=" | |||
<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 | |||
1 - Not system administrator | |||
2 - Insufficient storage | |||
</p> | </p> | ||
==Usage notes== | |||
This function can be used to set a global variable which is used for all <var class="product">Model 204</var> users. The value can be set during <var class="product">Model 204</var> initialization (that is, in the CCAIN stream), so values can be calculated once, rather than coding it in the login proc of all subsystems, in which case it is calculated every time a user enters the subsystem, or rather than using some kind of "setup" subsystem that every user is forced into at user login time. For example, the following request can be run from CCAIN: | |||
<p class="code">BEGIN | |||
<p class="code"> BEGIN | %X FLOAT | ||
%X = $Setg_Sys('BOSS', 'Mr. Homer J. Simpson') | |||
END | |||
</p> | </p> | ||
Then the global variable BOSS can be used to obtain the name of the latest boss. | Then the global variable BOSS can be used to obtain the name of the latest boss. | ||
Line 40: | Line 38: | ||
Also, since there is one shared system global table for the entire system, a smaller GTBL value for each user can be achieved than if the global values are set with user global variables. | Also, since there is one shared system global table for the entire system, a smaller GTBL value for each user can be achieved than if the global values are set with user global variables. | ||
The order in which the different scopes of global variables are searched can be controlled using $SirParm parameters: for $GETG, with 'GETGSYS', and for dummy strings, with 'DUMMYSYS'. | The order in which the different scopes of global variables are searched can be controlled using <var>$SirParm</var> parameters: for $GETG, with 'GETGSYS', and for dummy strings, with 'DUMMYSYS'. | ||
Here is an example to show the effects of DUMMYSYS and GETGSYS; assume the following procedure is executed in the CCAIN input stream, and that there are no $Setg_Subsys invocations for the global variable named 'JUNK': | Here is an example to show the effects of DUMMYSYS and GETGSYS; assume the following procedure is executed in the CCAIN input stream, and that there are no $Setg_Subsys invocations for the global variable named 'JUNK': | ||
<p class="code"> BEGIN | <p class="code"> BEGIN | ||
%X FLOAT | %X FLOAT | ||
Line 49: | Line 48: | ||
and the procedure TESTIT contains the following requests: | and the procedure TESTIT contains the following requests: | ||
<p class="code"> BEGIN | <p class="code"> BEGIN | ||
%Y = $SETG('JUNK', 'GOODBYE') | %Y = $SETG('JUNK', 'GOODBYE') | ||
END | END | ||
BEGIN | BEGIN | ||
PRINT '?& | PRINT '?&JUNK' | ||
PRINT $GETG('JUNK') | PRINT $GETG('JUNK') | ||
END | END | ||
</p> | </p> | ||
Then here are various command streams, and their results: | Then here are various command streams, and their results: | ||
1. DUMMYSYS=0, GETGSYS=0: | |||
<p class="code"> BEGIN | <p class="code"> BEGIN | ||
%X FLOAT | %X FLOAT | ||
Line 73: | Line 74: | ||
GOODBYE | GOODBYE | ||
</p> | </p> | ||
1. DUMMYSYS=0, GETGSYS=1: | 1. DUMMYSYS=0, GETGSYS=1: | ||
Line 90: | Line 89: | ||
</p> | </p> | ||
1. DUMMYSYS=1, GETGSYS=0: | |||
<p class="code"> BEGIN | <p class="code"> BEGIN | ||
%X FLOAT | %X FLOAT | ||
Line 106: | Line 104: | ||
</p> | </p> | ||
1. DUMMYSYS=1, GETGSYS=1: | |||
<p class="code"> BEGIN | <p class="code"> BEGIN | ||
%X FLOAT | %X FLOAT | ||
Line 121: | Line 118: | ||
HELLO | HELLO | ||
</p> | </p> | ||
Retrieval of system global variables is highly efficient; updates, however, are not, so use this $function appropriately. | Retrieval of system global variables is highly efficient; updates, however, are not, so use this $function appropriately. | ||
The current values of system globals can be retrieved using $Setg_Sys_List | The current values of system globals can be retrieved using <var>$Setg_Sys_List</var>. | ||
See [[$SirParm]] for more information. | |||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | |||
<li>[[List of $functions|Sirius functions]] </li> | |||
<li>[[Janus Web Server]] </li> | |||
</ul> | </ul> | ||
<p> | |||
</p> | </p> | ||
[[Category:$Functions|$Setg_Sys]] | [[Category:$Functions|$Setg_Sys]] |
Latest revision as of 22:52, 20 September 2018
Set system-wide global
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Setg_Sys function is the SetGlobal System subroutine.
This function allows a user to set the value of a Model 204 "global variable" which has a system-wide scope. These are used for the value of the $GetG function or dummy string ("?&") substitution. The order in which the different scopes of global variables are searched can be controlled using $SirParm arguments: for $GETG, with 'GETGSYS', and for dummy strings, with 'DUMMYSYS'.
The $Setg_Sys function accepts two arguments and returns zero, indicating success, or a number indicating the cause of error, if there is one.
The first argument is the name of the global variable to be set. This is an optional argument; it defaults to the null string.
The second argument is the value to which the global variable is to be set. This is an optional argument; it defaults to the null string.
System administrator privileges are required to invoke this $function.
Syntax
%rc = $Setg_Sys([glob_name], [value])
%rc is set to 0 or to an error indicator.
Return codes
0 - No errors 1 - Not system administrator 2 - Insufficient storage
Usage notes
This function can be used to set a global variable which is used for all Model 204 users. The value can be set during Model 204 initialization (that is, in the CCAIN stream), so values can be calculated once, rather than coding it in the login proc of all subsystems, in which case it is calculated every time a user enters the subsystem, or rather than using some kind of "setup" subsystem that every user is forced into at user login time. For example, the following request can be run from CCAIN:
BEGIN %X FLOAT %X = $Setg_Sys('BOSS', 'Mr. Homer J. Simpson') END
Then the global variable BOSS can be used to obtain the name of the latest boss.
Also, since there is one shared system global table for the entire system, a smaller GTBL value for each user can be achieved than if the global values are set with user global variables.
The order in which the different scopes of global variables are searched can be controlled using $SirParm parameters: for $GETG, with 'GETGSYS', and for dummy strings, with 'DUMMYSYS'. Here is an example to show the effects of DUMMYSYS and GETGSYS; assume the following procedure is executed in the CCAIN input stream, and that there are no $Setg_Subsys invocations for the global variable named 'JUNK':
BEGIN %X FLOAT %X = $Setg_Sys('JUNK', 'HELLO') END
and the procedure TESTIT contains the following requests:
BEGIN %Y = $SETG('JUNK', 'GOODBYE') END BEGIN PRINT '?&JUNK' PRINT $GETG('JUNK') END
Then here are various command streams, and their results:
1. DUMMYSYS=0, GETGSYS=0:
BEGIN %X FLOAT %X = $SirParm('DUMMYSYS', 0) %X = $SirParm('GETGSYS', 0) END I TESTIT produces the following print lines: GOODBYE GOODBYE
1. DUMMYSYS=0, GETGSYS=1:
BEGIN %X FLOAT %X = $SirParm('DUMMYSYS', 0) %X = $SirParm('GETGSYS', 1) END I TESTIT produces the following print lines: GOODBYE HELLO
1. DUMMYSYS=1, GETGSYS=0:
BEGIN %X FLOAT %X = $SirParm('DUMMYSYS', 1) %X = $SirParm('GETGSYS', 0) END I TESTIT produces the following print lines: HELLO GOODBYE
1. DUMMYSYS=1, GETGSYS=1:
BEGIN %X FLOAT %X = $SirParm('DUMMYSYS', 1) %X = $SirParm('GETGSYS', 1) END I TESTIT produces the following print lines: HELLO HELLO
Retrieval of system global variables is highly efficient; updates, however, are not, so use this $function appropriately.
The current values of system globals can be retrieved using $Setg_Sys_List.
See $SirParm for more information.
Products authorizing $Setg_Sys