Karen nailed the problem. You must immediately capture the error variable before you make any other code, because the code changes the error variable back to 0 - no error on the IF line, because that line had no error.

Albert

On 6/7/2015 10:10 AM, Karen Tellef wrote:
Tom: I have code almost identical to yours that I use and it works. The only difference is that I trap the error variable first before testing. I cannot imagine that it should make a difference, but it would be an easy thing to try. I also use the "full" parameter.

Code below, feel free to use any of it.

Karen

SET ERROR VAR xError

OUTPUT Autochk.TXT WITH SCREEN
AUTOCHK RKTPRDE FULL
SET VAR fvChkErr = .xError
OUTPUT SCREEN

CLS
IF fvChkErr > 40 THEN
DIALOG 'AUTOCHK has found ERRORS in your database! Reloading the database+ will fix the errors, but you may lose some data. DO YOU WANT TO CONTINUE+
 WITH THE RELOAD?'=75 vresp vendkey NO +
    CAPTION 'Autochk File saved AUTOCHK.TXT' ICON serious +
    OPTION MESSAGE_FONT_SIZE 14 +
    | MESSAGE_FONT_BOLD ON | BACK_COLOR WHITE | MESSAGE_COLOR WHITE +
    | MESSAGE_FONT_COLOR RED

  IF vresp = 'NO' THEN
    GOTO ENDPROG
  ENDIF
ENDIF

IF fvChkErr > 0 AND fvChkErr <= 50 THEN
  PAUSE 3 USING ' '

DIALOG 'For some reason, the AUTOCHK program could not run, so I do not know+ if your database is okay or not. You should call your database administrator+ to find the problem. DO YOU WANT TO CONTINUE WITH THE RELOAD?'=75 vresp vendkey NO +
    CAPTION 'Autochk not run' ICON serious +
    OPTION MESSAGE_FONT_SIZE 14 +
    | MESSAGE_FONT_BOLD ON | BACK_COLOR WHITE | MESSAGE_COLOR WHITE +
    | MESSAGE_FONT_COLOR RED

  IF vresp = 'NO' THEN
    GOTO ENDPROG
  ENDIF
ENDIF

IF fvChkErr = 0 THEN
  DIALOG 'Database passed the integrity check!  Do you want to RELOAD?' +
vresp vendkey NO CAPTION .fvCaption ICON question OPTION MESSAGE_FONT_SIZE 11
  IF vresp = 'NO' THEN
    CLOSEWINDOW
    RETURN
  ENDIF

ENDIF






-----Original Message-----
From: Buddy Walker <[email protected]>
To: RBASE-L Mailing List <[email protected]>
Sent: Sun, Jun 7, 2015 11:02 am
Subject: [RBASE-L] - RE: Autochk

Tom
What not put the output to a file  and then look in the file errors.
The way I would do is (make sure you put the word “full” after database name
R:>out mydatabaseerr.asc
R:>autochk databasename  full
R:>out term
R:>RBE mydatabaseerr.asc
Buddy
*From:*[email protected] <mailto:[email protected]> [mailto:[email protected] <mailto:[email protected]?>] *On Behalf Of *TOM HART
*Sent:* Sunday, June 07, 2015 11:44 AM
*To:* RBASE-L Mailing List
*Subject:* [RBASE-L] - Autochk
I have been having trouble with errors in a database so I set up the routine from help:
SET ERROR VAR E1
WRITE 'Checking database for errors...'
AUTOCHK database
IF E1 > 40 THEN
WRITE 'AUTOCHK has found errors in the database!'
BEEP
ENDIF
If E1 > 0 and E1 < 50 THEN
WRITE 'AUTOCHK will not run - User Abort or Out of Memory'
BEEP
ENDIF
IF E1 = 0 THEN
WRITE 'AUTOCHK successful - No errors found'
ENDIF
PAUSE 2
RETURN
When I run this I get no errors, E1 returns 0, but if I run 'autochk database' from the R> I get errors and E1 is some big number like 1249. Any suggestions. My ultimate goal is the send me an email saying there is a problem, I have got that all setup to work, but since my above routine does not show errors it does not send
Tom Hart

--
A democracy ..." can only exist until the majority discovers it can vote itself 
largess out of the public treasury."
Attributed to Alexander Fraser Tytler 1747-1813

Reply via email to