> -----Ursprungligt meddelande----- > Från: IBM Mainframe Assembler List [mailto:ASSEMBLER- > l...@listserv.uga.edu] För Paul Gilmartin > Skickat: den 4 februari 2011 16:09 > Till: ASSEMBLER-LIST@LISTSERV.UGA.EDU > Ämne: Re: Best (or any) practices to rewrite "spaghetti" > > On Feb 3, 2011, at 12:57, Edward Jaffe wrote: > <snip> > > Yup. You can find analogs in other languages. For example SIGNAL and > EXIT in > > REXX. Programs can become unnecessarily complex if you require every > condition > > to be surfaced back up through a deeply-nested logic hierarchy. > > > Rexx SIGNAL sucks. One one hand, it trashes the DO...END structure; OTOH > it leaves the subroutine return stack hanging (a naive colleague once > authored a Rexx program that used SIGNAL to "get out of Dodge". He tested > it, apparently successfully. It crashed on a large input data set when > the stack overflowed. PITA to refactor.) Absence of a construct to > exit a nest of procedures impels Rexx programmers to eschew subroutines > in contexts where they'd otherwise be preferable. > > I'd cherish an extension to support "LEAVE control-variable" where > control-variable belongs to a loop in an outer procedure exposed in > the inner procedure containing the LEAVE. > > But Rexx does support LEAVE and ITERATE for outer DOs. I habitually > code: > > do OuterLoop = 1 for 1 > ... > do > ... > do > ... > leave OuterLoop > ... > end > ... > end > ... > end OuterLoop
I don't quite understand Your problems with SIGNAL. AFAICS, You use SIGNAL when the situation is such that You can't handle it within Your REXX routine logic/context. That's is, You must abort all processing and (normally) give a comprehensive error message, maybe also log it. You describe a situation where a large input file was handled. If that were the reason for the crash it means that too much data was stored in memory (instead of reading smaller amounts at a time from the file or storing temporary data in a disk dataset). (BTW, I use in these kinds of error situations a "CALL errorroutine" where I do necessary messaging etc, and then in that routine "SIGNAL exitroutine".) Regards, Thomas Berg _________________________________________ Thomas Berg Specialist A M SWEDBANK