$Setg

From m204wiki
Revision as of 19:12, 7 August 2018 by JAL (talk | contribs) (add <var>'s)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The $Setg function performs two tasks. It attempts to create or change an entry in the global variable table and also informs the user if the operation was successful. $Setg returns a 1 (true) if the global variable was not stored due to lack of space. It returns a 0 (false) if the variable was successfully stored.

$Setg takes two arguments. The first argument contains the name of the global variable; the second argument contains the value. Previously stored variables with the same name are deleted first.

Example

The following statement attempts to store a global variable with a name of GLOB and with a value equal to the character string returned from the $Read. A message is to be printed if the operation was not successful.

IF $SETG('GLOB',$READ('ENTER GLOBAL VALUE')) THEN PRINT 'HELP' END IF

See also

Refer to Global features for a detailed explanation of global variables and examples of the $Setg function within a request.