Hello Hobart,
here are my NOVALUE and SYNTAX handlers:-
Signal on Novalue /* Clean diagnostics */
Signal on Syntax /* for unexpected results. */
/*===================================================================*/
Syntax:
Say "SYNTAX raised in line" sigl". rc="rc "("errortext(rc)")."
zsigl = sigl /* Number of sourceline in error */
Parse Version impl langlevel . /* Look at language level */
Signal Common /* continue with common code */
NoValue:
Say "NOVALUE raised at line" sigl
zsigl = sigl /* Number of sourceline in error */
Parse Version impl langlevel . /* Look at language level */
If langlevel > 3.45 Then Do /* Condition BIF is supported */
Say "Then referenced variable is" "CONDITION"('D')
End
Signal Common /* continue with common code */
Common: /* Common error handling */
Trace 'o' /* Ensure no tracing */
If sourceline() <> 0 Then Do /* Source lines available */
Say '"'CompleteSource(zsigl)'"'/* Show the line in error */
End
If Left(impl,5) <> "REXXC" Then Do /* NOT running a compiled program*/
Say "You can look around now..." /* Tell user what they can do */
Trace ?R /* interactive tracing */
Nop
End
Exit
CompleteSource: Procedure
Parse Arg linenum
If Datatype(linenum) <> "NUM" Then linenum=1
line = Strip(SourceLine(linenum))
Do While (( Right(line,1) = ",") & (linenum <= SourceLine()))
linenum = linenum + 1
line = Left(line,(length(line)-1)) Strip(SourceLine(linenum))
End
Return line
On Wed, 13 Jun 2018 16:07:48 -0400, Hobart Spitz <[email protected]> wrote:
>Bruce;
>
<snip>
>
>My typical NOVALUE handler looks like this:
>
>
>
>
>
>*novalue:say condition() condition("c") condition("d") "in line"
>sigl"."parse source Sourcesay Source /* in case we are a few levels down in
>external modules */exit -889*
>
>
>I'd also recommend against TRACE OFF. A typo can turn a REXX instruction
>into a host command, and those problem can be hard to find. (The proper
>way to write TRACE is to omit the quotes; they imply VALUE, which takes a
>few extra machine instructions.
>
<snip>
Regards
Bruce
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN