A NOVALUE condition happens when a variable is used without first having been explicitly assigned a value.

The default handling for the NOVALUE condition is to ignore it. So for example, assume the following script:

/* DROP "MyVar" and then reference it */
DROP MyVar
SAY MyVar
This displays MYVAR since the value of a variable is its name upper-cased, when it has not yet been assigned a value.

But if you would like to be informed when you're referencing a variable that has not yet been given a value, then you can trap the NOVALUE condition. Consider the following script:

/* Trap NOVALUE, then DROP "MyVar" and reference it */
SIGNAL ON NOVALUE NAME MyHandler
DROP MyVar
SAY MyVar
EXIT

MyHandler:
   SAY 'MyVar was not assigned a value'
   RETURN
When REXX gets to the line SAY MyVar, it notices that MyVar does not have a value, and you have trapped NOVALUE. So, instead of executing the SAY instruction, REXX jumps to the label MyHandler.

Your handler can use the CONDITION() built-in function's 'D' option to fetch the name of the variable whose value has not been set. For example:

/* Trap NOVALUE, then DROP "MyVar" and reference it */
SIGNAL ON NOVALUE NAME MyHandler
DROP MyVar
SAY MyVar
EXIT

MyHandler:
   SAY CONDITION('D') 'was not assigned a value'
   RETURN

Note: Reginald's CONDITION() function has an additional option. CONDITION('M') will present a pop-up message box containing a message about the variable not being assigned a value, the name of the script in which NOVALUE was raised, the source line and line number upon which NOVALUE was raised, and a Help button to bring up a help page for that error. This is preferable to trying to create your own message to present to the person running your script.

A NOVALUE condition can be raised as a result of your script referencing a variable that has not yet been given a value. In this case, CONDITION('E') returns an error number of 66.

A NOVALUE condition can also be raised if you've issued an OPTIONS 'TRAP' instruction and are trapping NOVALUE, and then you call some other script which doesn't trap NOVALUE but references a variable that hasn't been assigned a value. In this case, CONDITION('E') returns an error number of 65. (This is a Reginald-only feature). CONDITION('D') will return an error message that reports the name of the script in which NOVALUE was raised, the line number where it occurred, and the variable's name. Here is an example handler that would differentiate between NOVALUE raised in your script versus another script that you called:

MyHandler:
   IF CONDITION('E') == '65' THEN DO
      PARSE VALUE CONDITION('D') WITH . '"' scriptname '"' . 'line ' linenum ': ' varname
      SAY 'The variable named "'|| varname ||'" in "'|| scriptname ||'" was not assigned a value at line' linenum
   END
   ELSE DO
      SAY CONDITION('D') 'was not assigned a value at line' SIGL
   END
   RETURN

Finally, A NOVALUE condition can be raised as a result of your script trying to fetch the value of an environment variable which has not been given a value. In this case, CONDITION('E') returns an error number of 80.5. (This is a Reginald-only feature). This may happen if you use the VALUE() or GETENV() built-ins.

Your handler can use CONDITION()'s 'D' option to fetch the name of the environment variable whose value has not been set.