Being a major fan of INTERPRET, I've had to deal with many similar 
situations - it's a question of the number of the number of indirection 

levels.  I've added a line to your error routine below to display what yo
u 
are looking for.

/* */
SIGNAL ON ERROR
cmd='CP THIS WILL FAIL'
/* There may be a leading comment on this line */       cmd /* There may 

be a trailing comment on this line, too */
say cmd', rc='rc
EXIT

/* -------- */
Error:
say '+++ "ERROR:" error rtn entered in:' xfn xft xfm', rc='rc
say '+++ from line:' sigl', which reads:'
say '+++'sourceline(sigl)
cmdline=strip(sourceline(sigl),'B')
say '+++ which translates to:' value('CMDLINE')

INTERPRET 'say "+++ which translates to:"' cmdline

EXIT



Brian Nielsen


On Fri, 13 Mar 2009 18:00:38 -0500, Mike Walter <mike.wal...@hewitt.com> 

wrote:

>Over the years I've enhanced our sample boilerplate "DOCREXX EXEC" which

>most application developers use to start new REXX execs.
>
>The subroutines for SIGNAL ON SYNTAX, SIGNAL ON NOVALUE, and SIGNAL ON
>ERROR have presented interesting challenges over those years. What has
>been developed seems to do a pretty good job except in the case of
>providing truly useful command failure information for a sequence such a
s:
>
>---<snip>---
>SIGNAL ON ERROR
>cmd='CP THIS WILL FAIL'
>/* There may be a leading comment on this line */       cmd /* There may

>be a trailing comment on this line, too */
>say cmd', rc='rc
>---<snip>---
>
>When the sample error subroutine executes, it easily displays some usefu
l
>information:
>---<snip>---
>Error:
>say '+++ "ERROR:" error rtn entered in:' xfn xft xfm', rc='rc
>say '+++ from line:' sigl', which reads:'
>say '+++'sourceline(sigl)
>cmdline=strip(sourceline(sigl),'B')
>say '+++ which translates to:' value('CMDLINE')
>---<snip>---
>
>But in the above example, the: '+++ which translates to:' value('CMDLINE
')
>would only display : +++ which translates to: cmd
>well, that's not so very useful.  One would hope to see: +++ which
>translates to: CP THIS WILL FAIL
>
>I've tried various permutations of: say '+++ which translates to:'
>value('CMDLINE')
>but that introduces complications when the line is not a variable {ok, I
f
>symbol(value('CMDLINE'))-'VAR' then ... }
>and that introduce even more complications when the line contains commen
ts
>as in the aforementioned:
>/* There may be a leading comment on this line */       cmd /* There may

>be a trailing comment on this line, too */
>
>Granted, that's a fairly perverted line of code, but not unseen.
>
>So... does anyone have some pretty rock-solid examples of Error, Syntax,

>and Novalue subroutines that they'd be willing to share?
>Too bad that the rexx manuals don't provide some nice, proven,
>tried-and-tested samples what everyone could use as a starting point.
>TIA
>
>Mike Walter
>Hewitt Associates
>Any opinions expressed herein are mine alone and do not necessarily
>represent the opinions or policies of Hewitt Associates.
>
>
>
>The information contained in this e-mail and any accompanying documents 

may contain information that is confidential or otherwise protected from 

disclosure. If you are not the intended recipient of this message, or if 

this message has been addressed to you in error, please immediately alert
 
the sender by reply e-mail and then delete this message, including any 

attachments. Any dissemination, distribution or other use of the contents
 
of this message by anyone other than the intended recipient is strictly 

prohibited. All messages sent to and from this e-mail address may be 
monitored as permitted by applicable law and regulations to ensure 
compliance with our internal policies and to protect our business. E-mail
s 
are not secure and cannot be guaranteed to be error free as they can be 

intercepted, amended, lost or destroyed, or contain viruses. You are 
deemed to have accepted these risks if you communicate with us by e-mail.

>========================
=========================
========================

Reply via email to