Gee Alastair, I love that expression "Gone Walkabout"!

A few months ago, David Blocker sent me a copy of a program originally
written by Oma Cox to create a table of error numbers and messages.  I
did attempt to run it, but it didn't work.  When I looked a little
closer at the code, I noticed it had been designed to run in an earlier
version of Rbase (I believe it was pre-6.5).  Running it in 7.0
(whatever version we were using when I received the code), didn't result
in a correct table being created.  

I, too would love to be able to generate such a table.  I'm surprised
that it isn't coded into the Rbase Help features somehow.  I often feel
like the classroom dunce when trying to figure these out.  I
particularly would find it helpful in writing code to be able to turn
off certain error messages if I knew what the numbers were for them.  I
now do it by trial and error...running the code, seeing what messages I
get and turning off the ones I need to after I get the number from the
system when the error is actually generated.  

Paula Stuart
[EMAIL PROTECTED]
 


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alastair
Burr
Sent: Wednesday, December 29, 2004 1:29 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: error 2583


Paula's first post on this subject prompted me to look again at the old
"Error Database" that was available with one of the older versions.
After all this time it's perhaps not too surprising that it has gone
walkabout and I can't find it. If anybody has a copy I'd be grateful for
a copy (off-list).

However, I don't think that the database produced by the code offered in
the reply below is quite as accurate as might be supposed:

As far as I can tell, a small minority of the Error Messages contain
CR/LF characters which mean that the loading of the data back from the
output file is not accurate in those cases. It also produces [Warning]
and other messages.

I spent a while yesterday trying to get back all the data and hoping to
be able to link the messages to the causes that were in the original
Error Database. Unfortunately it seems that those "cause messages" are
not there.

I came up with the code that follows. It's not the most elegant process
but it seems to work. If anybody has a better way of doing the
load/update sequence it would be nice to know. I've left the VarChar
column in the database so that the contents can be checked but I
couldn't find a way to flag those where the contents varies from the
message. It's fairly easy to pick out the likely candidates - choose
those with funny characters to start with!

Here's my code. Feel free to modify and do what you want with it but if
you can improve on it (probably not hard) please let me (and the list)
know:

--
------------------------------------------------------------------------
-
--
*( Filename: ErrMess.CMD    ...    ...    Date of last amendment:
29/12/2004 )
*( Creates database/table containing the latest error messages from
Base   )
--
------------------------------------------------------------------------
-
--
DISCONNECT
-- Take note of the following 2 lines before running in an old R:Base
session! CLEAR VAR vCaption, vMessage, vReplace, vErrNum, vError ERASE
v7_Error.RB? CREATE SCHEMA AUTHOR v7_Error CREATE TEMP TABLE
TEMP_ErrMsgs +
  (ErrNum INTEGER, ErrMsgTxt NOTE, ErrMsgFle VARCHAR (3000) ) SET VAR
vCaption TEXT = 'R:Base Error Messages Database Creation' SET CAPTION
.vCaption SET VAR vCaption = 'Please wait...'
SET VAR vReplace   TEXT = NULL
SET VAR vMessage   TEXT = 'Error Number: 0'
SET VAR vErrNum INTEGER = 1
SET VAR vError  INTEGER = NULL
SET ERROR VARIABLE vErrVar
SET NULL -0-
CLS
PAUSE 3 USING .vMessage CAPTION .vCaption
SET MESSAGES OFF
SET ERROR MESSAGES OFF
SET ERROR MESSAGE  565 OFF  -- Invalid error message number
SET ERROR MESSAGE 2059 OFF  -- No rows exist
-- 29/12/2004: highest valid Error Number appears to be 3104.
--             Tested up to: 99,999
WHILE vErrNum < 3200 THEN
  SET VAR vMessage = ('Error Number:' & (CTXT(.vErrNum)) )
  PAUSE 4 USING .vMessage CAPTION .vCaption
  OUTPUT Messages.$$$
    SHOW ERROR vErrNum
    SET VAR vError = .vErrVar
  OUTPUT SCREEN
  IF vError = 0 THEN
    LOAD TEMP_ErrMsgs FROM Messages.$$$ AS FORMATTED USING ErrMsgTxt 1
1500
    UPDATE TEMP_ErrMsgs SET ErrMsgFle = ['Messages.$$$'] WHERE COUNT =
LAST
    UPDATE TEMP_ErrMsgs SET ErrNum    = .vErrNum WHERE ErrNum IS NULL
    SET VAR vReplace = '(Unknown)'
    SELECT ErrMsgTxt INTO vReplace FROM TEMP_ErrMsgs +
      WHERE ErrNum = .vErrNum AND ErrMsgTxt IS NOT NULL
    UPDATE TEMP_ErrMsgs SET ErrMsgTxt = .vReplace +
      WHERE ErrNum = .vErrNum AND ErrMsgTxt IS NULL
  ELSE
    INSERT INTO TEMP_ErrMsgs (ErrNum, ErrMsgTxt) +
                    VALUES (.vErrNum, '(Invalid Number)' )
  ENDIF
  SET VAR vErrNum = (.vErrNum + 1)
ENDWHILE
SET ERROR MESSAGE  565 ON
SET ERROR MESSAGE 2059 ON
SET VAR vMessage TEXT = 'Configuring Data'
PAUSE 4 USING .vMessage CAPTION .vCaption
CREATE INDEX TempIndexErrNum ON TEMP_ErrMsgs (ErrNum ASC) DELETE ROWS
FROM TEMP_ErrMsgs WHERE ErrMsgFle IS NULL -- Removes most dups. DELETE
DUPLICATES FROM TEMP_ErrMsgs -- There shouldn't be any really. ALTER
TABLE TEMP_ErrMsgs ADD COLUMN MessType TEXT (8) ALTER TABLE TEMP_ErrMsgs
ALTER ErrMsgTxt TEXT (200) -- Check max length!
UPDATE TEMP_ErrMsgs SET MessType = 'Error'   +
  WHERE ErrMsgTxt CONTAINS '-ERROR-'
UPDATE TEMP_ErrMsgs SET MessType = 'Warning' +
  WHERE ErrMsgTxt CONTAINS '<WARNING>'
UPDATE TEMP_ErrMsgs SET MessType = 'Invalid' +
  WHERE ErrMsgTxt CONTAINS '(Invalid Number)'
UPDATE TEMP_ErrMsgs SET MessType = 'Message' +
  WHERE ErrMsgTxt IS NOT NULL AND MessType IS NULL
UPDATE TEMP_ErrMsgs SET MessType = 'Unknown' +
  WHERE ErrMsgTxt = '(Unknown)'
-- Previous processing done in temp table for speed; now create real
table: PROJECT ErrMsgs FROM TEMP_ErrMsgs USING * +
  ORDER BY MessType ASC, ErrMsgTxt ASC, ErrNum ASC
DROP TABLE TEMP_ErrMsgs
ERASE Messages.$$$
CLEAR VAR vCaption, vMessage, vReplace, vErrNum, vError
SET LAYOUT ON  -- layout needs changing and saving.
CLS
BROWSE * FROM ErrMsgs
DISCONNECT
RETURN
*( End of program )




----- Original Message ----- 
From: "Scott Sherer" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[email protected]>
Sent: Tuesday, December 28, 2004 2:17 PM
Subject: [RBG7-L] - Re: error 2583


> Hello Doug,
>
> Nice job.  This works pretty well, I appreciate it.  Still, it would 
> be
work
> much better if explanatory text accompanied each error message.  I 
> realize that doesn't exist, but it would be most helpful.
>
> Scott Sherer
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Doug
Hamilton
> Sent: Tuesday, December 28, 2004 7:56 AM
> To: RBG7-L Mailing List
> Subject: [RBG7-L] - Re: error 2583
>
> Paula, the code below will create a table called error_list with two 
> columns, error_text and error_code.  The code was posted by Mike 
> Ramsour in 1999: "The bottom line is that this file creates a table 
> and populates it with error codes and their associated text.  In its 
> present form I imposed an upper limit of 5000 for the number of 
> messages but I'm not sure how many error codes there are.  Does anyone

> else?"
>
> I just tested it in 7.1 and it ran ok.
> Hope this helps - Thanks to Mike.
> Doug
>
> SET VAR vcntr INTEGER=0,verr_msg TEXT,vcol_val TEXT
> CREATE TEMP TABLE error_list (error_text NOTE,error_code INT)
> --
> CREATE INDEX el_error_idx ON error_list (error_text)
> --
> SET MESSAGES OFF
> SET ERROR MESSAGES OFF
> --
> WHILE vcntr < 5001 THEN
>   OUTPUT errors.dat
>   SHOW ERROR vcntr
>   OUTPUT SCREEN
>   LOAD error_list FROM errors.dat AS FORMATTED USING error_text 1 150
>   SELECT error_text INTO vcol_val IND vcol_ind FROM error_list +
>     WHERE COUNT=LAST
>   IF vcol_val IS NOT NULL THEN
>       UPDATE error_list SET error_code=.vcntr WHERE COUNT=LAST
>       GOTO next_loop
>     ELSE
>       DELETE ROW FROM error_list WHERE COUNT=LAST
>   ENDIF
>   LABEL next_loop
>   SET VAR vcntr=(.vcntr + 1)
> ENDWHILE
> --
> QUIT
>
> Paula Stuart wrote:
>
> >Once again, I would like to comment that it would be VERY helpful to 
> >have an index of error messages and their meanings.  Nothing is so 
> >frustrating as to get an error message the meaning of which is lost 
> >on you.
> >
> >Paula Stuart
> >
> >
>

Reply via email to