Contents - Index


WARNING Procedure

 

The WARNING procedure can be used only within an internal function or procedure.  The WARNING procedure generates a warning message that is placed in the warning message queue and displayed when calculations are completed.  Note that a warning message generated in this manner is always displayed no matter what the setting of the 'Display Warning Messages' checkbox in the Options tab of the Preferences dialog or whether or not a $Warnings On directive is provided.  The WARNING procedure is similar to the ERROR procedure which halts calculations when some user-specified error condition is encountered.  The WARNING procedure has the following format: 

 

   CALL WARNING(X)

 

         or

 

   CALL WARNING('My warning message XXXF1',X)

 

        or

 

  CALL WARNING('My warning message')

 

The warning string is optional, but if it is provided, it must be a string constant or a string variable.  

 

If a warning string is provided, the variable X is optional.  X is the value of the parameter which initiates the warning.  If a warning string is not provided, EES will generate the following generic warning message.

 

"A warning message was issued due to the value XXX in YYY."

 

Here XXX is the parameter value provided in the WARNING call statement and YYY is the function or procedure name in which the Call WARNING statement appears.

 

If a warning string is provided, EES will display that string, inserting the value of X in place of the characters XXX.  If a formatting option, such as A3, F1 or E4 follows the XXX, as in the example above, the value of X will be accordingly formatted, otherwise a default format will be applied.  If no format is supplied, automatic format is assumed. 

 

Note: To insert a string, rather than a numerical value, use $ as the formatting option following the XXX, for example,

 

    CALL WARNING('My error string is XXX$',X$)

   

The WARNING procedure will most likely be used with an IF - THEN - ELSE  statement as in the following example.

 

     Function abc(X,Y)

       G:=X+Y

       If (G<=0) Then Call warning('The sum of X and Y should be greater than zero.  The sum was XXXA1 ',G)

       abc:=G

     End

 

     g=abc(3,-4)

 

 

(Note:  use a semicolon instead of a comma as the list separator when using the European numerical format).