$Setg

From m204wiki
(Redirected from $SETG)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.