$Setg

From m204wiki
Revision as of 19:50, 2 January 2014 by JAL (talk | contribs)
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

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