WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

IntControl 38 and 73 and WbErrorHandler Subroutine

Keywords:     IntControl 38 and 73 and WbErrorHandler Subroutine

Question:

I have a generic functions script that I include at the top of all of my other scripts. One thing that this generic script does for me is error trapping with e-mail notification. I use two IntControl functions for the error trap, 38 and 73. 38 records the fatal errors into a file that later gets processed by another script, while 73 traps the non-fatal errors and processes them immediately.

Recently I upgraded my Winbatch from 2002b to 2002g, after that it seems that the IntControl 73 isn't working anymore.

I DebugTraced a script and when it encountered a non-fatal error it did NOT gosub to the WBERRORHANDLER subroutine. It also did not record anything in the file specified by the IntControl 38 function. All it seemed to do is ignore the error and keep running the script.

This is not the way it worked before the upgrade to 2002g.

Was something changed in one or both of these two functions that prevents them from being used simultaneously?

The snippet below is the UDF that I use to activate or de-activate the ErrorHandler.

#DefineFunction ErrorHandler(Mode)
  if Mode==@On then
    ErrorMode(@Off)
    IntControl(38,1,"c:\wblog.txt",0,0)
    IntControl(73,2,0,0,0)
  endif
  if Mode==@Off then
    IntControl(73,0,0,0,0)
    IntControl(38,0,0,0,0)
    ErrorMode(@Normal)
  endif
  Return
#EndFunction

Answer:

In previous version the :WBERORHANDLER label incorrectly had global scope. It was not supposed to.

So your UDF/UDS needs its OWN :ERRORHANDLER label within the function definition.

What was happening was that the UDS could not find a WBERRORHANDLER label so it gave up on it and called a normal error.


Article ID:   W15152
File Created: 2002:09:05:13:50:06
Last Updated: 2002:09:05:13:50:06