and when you end Prepmort routines, you use the construction:
$CALL ... ERROR RETURN
ERROR RETURN in the
means that if the routine you are calling fails, your own routine will
The error message from the routine that actually had the problem
will end up being passed up the chain of all the routines that called
one another until the error message gets back to IDA.
In rare cases, you may want to take some other action when a routine you
$CALL fails. Instead of just returning, you can set up
$CALL statement to execute some other set of code.
$CALL JZIOPN(SAVSET,'READ','OLD',DEVID) ERROR [ IF P_DSPWIND%(INTERLEV) .GT. 1 [ $CALL DSPUIRM ERROR RETURN; ] $RETURN; ]Instead of just returning when
JZIOPNfails, this example tests on a flag and then has the option of calling another routine.
In most cases, an
ERROR RETURN is enough.
By issuing all messages through the Signal System rather than through
The Signal System even knows how to suppress certain kinds of error messages if they appear very often. It will typically show you the message the first few times it occurs in your job, and will then suppress the message for the rest of the job, issuing occasional reminders that the message has occurred many times and has been suppressed.
As you become more familiar with SLD software, you will become more aware
of the importance of the Signal System.
For now, you should learn the basics of how to use
The process involves three steps,
ERR. A single
ERRfile typically contains all of the signal messages for a related group of Prepmort routines. The
ERRis short for "Error Handler," but it is important to remember that this system actually supports many more kinds of messages than just error messages. Many of the messages handled by Signal are normal progress reports, not error messages.
As a first example of an
ERR file, look at the one that handles
all of thhe signal messages for the
MFIT Minuit fitting package.
They are in the file
The header is self-explanatory. It is almost like a Prepmort header.
/ABBREV=FIT defines an abbreviation used in
Prepmort files to refer to this message file.
ERR files have a three letter abbreviation, though this
is not required.
Each line that starts with the percent sign represents one signal message.
ERRfile name or abbreviation, gives a unique identifier for the signal message.
For example, when Prepmort code wants to invoke the seventh message from this file, it uses the statement:
When Prepmort code wants to invoke the last message from this file, it uses the statement:
It can be either:
Sfor Success, nothing at all is written out
Ifor Informational, just writes out some information
Wfor Warning, still just writes out some information
Efor Error, writes an error message and causes the chain of called routines to all return to IDA
Ffor Fatal Error, writes an error message and causes the IDA job to end
Fare the ones you will use most often. There is no clear distinction when
Wis better than
I. generally, both have the same affect, but
Iis used when the information is something to be expected while
Wis used when the information means that something is a little bit wrong but not so serious that it will cause a problem.
It is easier to understand all of this by looking at some examples of
ERR files, at the Prepmort files that use them, and at the
results that appear in IDA.
Ida> CMDPROC MFITCMD Ida> MFIT Sthe routine
PRODMFIT:MFITCMD.PREPMNLBwill execute the statement
which will write out the message:
%FITCMD-E-AMBIG Ambiguous fit command. Supply more characters. IDA error executing MFIT (4)The only difference between
$RETURNwill return after writing out the signal message.
'I'. These are places where the Prepmort code will supply character or integer arguments to the Signal System when it invokes the signal message.
For example, if in you are running IDA with the MFIT package, and you try to fit to a dataset that does not exist:
Ida> CMDPROC MFITCMD Ida> MFIT DATA CRUDthe routine
PRODMFIT:MFITCMD.PREPMNLBwill execute the statement
where the variable
$RETURN FIT$NODATA WORD;
WORDwill be the data set name you typed in,
CRUD. The signal system will then write out the message:
%FITCMD-I-NODATA Could not locate the data set named CRUD.
For example, in the file
PRODDISPLAY:DSPDSP.ERR you will see
all of the error messages used by the event display system.
Look at that file now and study the lines around the
The following IDA code would invoke this signal message, trying to read a set of saved view parameters that do not exist:
Ida> CMDPROC DSPCMD Ida> DSP RVIEW FAKEthe routine
PRODDISPLAY:DSPURVW.PREPMORTwill execute the statement
where the variable
$RETURN DSP$NOSVEW SAVSET;
SAVSETwill be the data set name you typed in,
FAKE. The signal system will then write out the message:
%DSPDSP-W-NOSVEW No view parameters named FAKE JAZZDATA have been saved.To see the additional help information relating to this signal message:
Ida> SIGNAL HELP DSP$NOSVEWIDA will respond with:
DSPDSP NOSVEW There is no saved set of view parameters with the filename you specified. The view parameters have been left as they were before the DSP RVIEW. Topic?IDA will leave you in the help mode (you will have the
Topicprompt). To leave help mode, hit return.
ERRfile or written your own, you make IDA add those signal messages to its signal database by issueing a command from the DCL prompt.
The command is:
For example, copy the file from
PRODMFIT:FITCMD.ERRto your current directly and then try to rebuild the error database (this will not actually make anything new since you have not changed the
You should get the reponse:
%SYSTEM-F-NOLOGNAM, no logical name match %SIGNAL-W-TESTSECT Logical name TESTMFIT not defined, default directory used %SIGNAL-I-NEWDBASE New data base createdThe first two messages are just letting you know that the Signal system has noticed that the file your are rebuilding is part of the DUCS section MFIT and that DUCS is going to assume you want it to do a
DUCS TEST MFIT *for you.
If you now do a DIR, you will find that the Signal system has created three new files:
FITCMD.ERRORSis a compiled form of your
SIGNAL.DATABASEis a new version of the SLD signal database that includes your signal file
SIGNAL.HLBis a new version of the SLD help system that includes help messages from your signal file
ERRfile and rebuilt the signal database, you just use the
$SIGNALstatement to signal the message from your Prepmort. If you want to leave your routine immediately after signalling the message, you can instead use the
You already saw examples of these statements above:
$SIGNAL FIT$AMBIG; $SIGNAL FIT$NOFTPLT2; $RETURN FIT$AMBIG; $RETURN FIT$NODATA WORD; $RETURN DSP$NOSVEW SAVSET;
The only other thing you need is to have a
"© FROM ..."
statement for every
ERR file that you signal errors from.
For example, if you want to signal errors from the
file, you need the statement:
"© FROM FITCMD.ERRORS"
This statement should appear at the beginning of your declarations section.
The statement can not have any spaces before it.
It is another example of the rule that statements that begin with the two
"& can not have spaces before them.
You can see now that the statement that comes at the end of most
$RETURN;, is just a special case of
the more general form of the statement:
err_file_name$message_idis specified, Prepmort simply returns with no message signalled.