David Losiewicz · Jun 23, 2016

Enable $$$GeneralError Macro

I am testing application code and want to simulate error conditions. 

I am trying to use the following to define a custom error with a class method.

$SYSTEM.Status.Error($$$GeneralError,"Any text here")

My class method code looks like this....

set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")

Class compile fails because the $$$GeneralError is unknown. 

ERROR: DBMS.Reports.TaskPage.1(5) : MPP5610 : Referenced macro not defined: 'GeneralError'
 TEXT: set RunStatus=$System.Status.Error($$$GeneralError,"DXL Testing Run Error")

I expect I need to include something to enable the Macro.  

Any suggestions are apprecated. 

0 916
Discussion (5)0
Log in or sign up to continue

I believe that you need to include %occErrors in your macro source code.

#include %occErrors

should take care of it.

I got something working using logic like this.....

    set RunStatus=$System.Status.Error(83,"DXL Testing Run Error")

    set RunStatus=$System.Status.Error(5001,"DXL Testing Run Error")

The correct way to do this is:

set RunStatus=$System.Status.Error($$$ERRORCODE($$$GeneralError),"DXL Testing Run Error")

So use $$$ERRORCODE which can convert the error code to the number correctly.

Unless I've misunderstood the context, it's simpler to use the ERROR macro:

$$$ERROR($$$GeneralError,"DXL Testing Run Error")

You don't need to get GeneralError, because of how ERROR (like ERRORCODE) is defined.

You are right, I had missed this was creating a %Status and thought they just needed the error code. To create a %Status value I would always use the $$$ERROR macro as you suggest.