Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
How to trap when an index is on a second table
Versions des environnements
Have a moment of densness today.
* Goal is to trap for the following situation
* two files involved
* testabc.dbf with a chr field abc of 10 spaces
* testdef.dbf with a chr field def of 10 spaces
* if both tables are opened at the same time
* and an index is created on the first table of index on testabc.abc+testdef.def tag test
* (this is a practice I would never use indexes with other tables involved)
*
* If table testdef is not open when you open table testabc - then an error will happen.
* a message that "alias testdef does not exist"
*
* When this happens I can not get an error number for it - errhand does not even fire.
*
* table testabc will go ahead an open
* I tried wrapping in try catch
* I am dense today - on how to trap for this
*
*
* goal is a way to trap for this situation and inform the user that there is an index
* involved that includes an additional table
*
*
ON ERROR DO errhand WITH ;
ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )
use testabc in 0
ON ERROR && restore system error handler
PROCEDURE errhand
PARAMETER merror, mess, mess1, mprog, mlineno
CLEAR
? 'Error number: ' + LTRIM(STR(merror))
? 'Error message: ' + mess
? 'Line of code with error: ' + mess1
? 'Line number of error: ' + LTRIM(STR(mlineno))
? 'Program with error: ' + mprog
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement