You could improve the NOVALUE handling. This is what I code since ages:
Signal on Novalue
....
/*-----------------------------------------------------------------*/
NOVALUE: /* we come here when REXX finds unitialised variable */
/*-----------------------------------------------------------------*/
parse upper source . how myname mytype . syn . '' undefvar
parse version . rexxlvl .
if rexxlvl>=3.46 then undefvar= 'CONDITION'('D')
call errexit 99,'REXX problem in' myname mytype 'line' sigl,
'variable' undefvar 'not defined'
/*-----------------------------------------------------------------*/
SYNTAX: /* we come here when SIGNAL ON SYNTAX traps an error */
/*-----------------------------------------------------------------*/
parse upper source . how myname mytype . syn .
call errexit rc,'REXX problem in' myname mytype 'line' sigl':' ,
'ERRORTEXT'(rc), sigl':'||'SOURCELINE'(sigl)
ERREXIT: /* general errorexit routine */
parse upper source . . myname mytype . syn .
do i=2 to arg() /* give errormessages (if any) */
say myname':' arg(i)
end
exit arg(1)
And you will know what variable is undefined, and on which line it was.
Furthermore, I see you have
SIGNAL ON ERROR
And
IF RC\=0 THEN ...
The IF will never be executed as the SIGNAL ON ERROR causes transfer to the
error routine
Kris Buelens,
--- freelance z/VM consultant, Belgium ---
-----------------------------------------------------------------------
2014-04-14 18:50 GMT+02:00 Frank M. Ramaekers <[email protected]>:
> I've only done a couple of these before and don't have any good
> debugging techniques. I've run into a problem on this:
>
>
>
> /* */
>
> Trace "O"
>
> Signal On Error Name Bad_Error
>
> Signal On Syntax Name Bad_Syntax
>
> Signal On NoValue Name Bad_NoValue
>
>
>
> RecNo=0
>
> Parse arg OmitRec . "("
>
> "PEEKTO Record"
>
> Do while rc==0
>
> RecNo=RecNo+1
>
> If RecNo\==OmitRec then
>
> "OUTPUT" Record
>
> "READTO"
>
> If rc\==0 then
>
> Exit rc
>
> "PEEKTO Record"
>
> End /* while */
>
> Bad_Error:
>
> If rc==12 then
>
> rc=0
>
> Exit rc
>
> Bad_Syntax:
>
> Exit 13
>
> Bad_NoValue:
>
> Exit 14
>
>
>
> The output looks fine, but it ends up with an RC=14:
>
>
>
> pipe strliteral /abc 12358 thisone notthisone/ | split at blank| omitrec
> 3 | console
>
> abc
>
>
> 12358
>
>
> notthisone
>
>
> Ready(00014);
>
>
>
>
> Thoughts as to why I'm getting a "Bad Value"?
>
>
>
> Frank M. Ramaekers Jr. | Systems Programmer | Information Technology |
> American Income Life Insurance Company | 254-761-6649
>
>
>