>> Do the SPMs have a construct to LEAVE an outer loop from within an inner >> loop? This might not properly belong in even an extension of assembler >> language. Does ENDDO even perform any termination cleanup? If not a branch >> is equivalent to LEAVE.
The HLASMs provide a way to label the "DO" so that you can can "ASMLEAVE label" and that will jump you to the ENDDO of the labled DO construct. The HLASM SPMs are not magic and they have no concept of termination cleanup - that is up to the programmer. The macros just generate internal labels and normal assembler instructions. A sledgehammer approach to a "get-outta-dodge" might be to throw a user abend and then let your recovery routines (FRR, ESTAE or ARR) catch it and examine the status and either diagnose, issue messages or recover and retry to your logical ENDDO (or signal point or whatever you want). Rob Scott Lead Developer Rocket Software 275 Grove Street * Newton, MA 02466-2272 * USA Tel: +1.617.614.2305 Email: [email protected] Web: www.rocketsoftware.com -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Paul Gilmartin Sent: 04 February 2011 15:27 To: [email protected] Subject: Re: Best (or any) practices to rewrite "spaghetti" On Feb 3, 2011, at 11:18, John Ehrman wrote: > There's no reason your SP macro code can't include a jump to an error > handler when an error occurs. > We haven't licensed HLASM TK. Do the SPMs have a construct to LEAVE an outer loop from within an inner loop? This might not properly belong in even an extension of assembler language. Does ENDDO even perform any termination cleanup? If not a branch is equivalent to LEAVE. > Donald Knuth once wrote a scholarly article called "Structured Programming > with GOTO Statements" where he showed that attempts to be "purely > structured" were often more obscure than using a GOTO when it was simplest. > There's also an easy proof (perhaps from the same source?) that any spaghetti code can be rewritten as a DO FOREVER containing a SELECT where each branch ends by setting the label to be used by the SELECT in the next iteration. Uses only sanctioned "structured" constructs; still spaghetti. -- gil
