Rick

Here's a start.  It will create a table with error numbers and messages

-- errmsgs.rmd
-- Populates a table with error messages by number
-- Albert Berry 1999/06/24

-- Run this if you haven't created the table yet
-- Just change < to >
SET ERROR VARIABLE errvar
SELECT errnum INTO vm_errnum INDICATOR vm_i1 FROM errmsgs WHERE LIMIT=1
SET VAR vm_err = .errvar
IF vm_err = 0 THEN
  DROP TABLE errmsgs
ENDIF
CREATE TABLE `errmsgs`  (`errnum` INTEGER  ,  `errmsg` TEXT 240 )
SET VAR verrnum INTEGER = 1
SET MESSSAGES OFF
SET ERROR MESSAGES OFF
SET NULL -0-
WHILE verrnum < 3200 THEN
  OUTPUT messages.$$$
  SHOW ERROR verrnum
  OUTPUT SCREEN
  LOAD errmsgs FROM messages.$$$ AS FORMATTED USING errmsg 1 240
  UPDATE errmsgs SET errnum = .verrnum WHERE COUNT = LAST
  SET VAR verrnum = (.verrnum + 1)
ENDWHILE
SET NULL ' '
SET ERROR MESSAGES ON
SET MESSAGES ON
RETURN


I can't say I've seen anyone post anything to the tune of the detail you want.
Then only thing I could say is it would be a monumental task.

Best Bet would be for every eep/rmd/app you would have to create something like this:

--myfile.rmd
SET ERROR VARIABLE  errvar
SET VAR errcap INTEGER = NULL
SET VAR vm_fileerrname TEXT =  'myfile.rmd'
SET VAR vm_linenum INTEGER = 1
SET VAR errcondition INTEGER = NULL
--ACTUAL LINE OF code --Select statement or something
SET VAR errcap = .errvar
IF errcap <> 0 THEN
  SET VAR errcondition = 1
  GOTO errhandler
  LABEL keeprunnin
ENDIF
--Now increment for next line of code
SET VAR vm_linenum = (.vm_linenum + 1)
--ACTUAL LINE OF code --Select statement or something
SET VAR errcap = .errvar
IF errcap <> 0 THEN
  SET VAR errcondition = 2  --present a special choice
  GOTO errhandler
  LABEL keeprunnin
ENDIF
--Now increment for next line of code
SET VAR vm_linenum = (.vm_linenum + 1)
--Do next Line and so on

--If the routine gets to this next part then it will jump to end
--and Exit Normally
GOTO xitnormal
LABEL errhandler
SELECT errmsg INTO vm_errmsg INDICATOR vm_i1 FROM errmsgs +
WHERE errnum = .errcap
IF errvar <> 0 THEN
  SET VAR vm_errmsg = 'Unlisted Error'
ENDIF
SET VAR vm_msg1 TEXT = ('F= ' + .vm_fileerrname)
SET VAR vm_msg2 TEXT = ('Err#= ' + (CTXT(.eercap)))
SET VAR vm_msg3 TEXT = ('Msg= ' + .vm_errmsg)
SET VAR vm_msg TEXT = (.vm_msg1 + ' ' + .vm_msg2 + ' ' + .vm_msg3)
PAUSE FOR 5 USING .vm_msg AT CENTER CENTER
SWITCH (.errcondition)
  CASE 1
    GOTO keeprunnin
    BREAK
  CASE 2
    --present some kind of choice??
    BREAK
  CASE 3
    --exit but do something first
    BREAK
ENDSW
LABEL xitnormal
RETURN


Jim

Trinity Business Technologies wrote:
Victor,

  I was looking for an error handling routine that will provide most of the
following information:

  *  Error number.
  *  Error message.
  *  Error description.
  *  Command file in which error occurred.
  *  Line number at which the error occurred.
  *  Line of code that caused the error.

Thanks,

Rick Brown


  

Reply via email to