> -----Ursprungligt meddelande-----
> Från: IBM Mainframe Discussion List [mailto:[email protected]] För
> Paul Gilmartin
> Skickat: den 16 april 2012 16:33
> Till: [email protected]
> Ämne: Re: SV: GO TO "cobol"
> 
> On Mon, 16 Apr 2012 15:42:12 +0200, Thomas Berg wrote:
> >>
> >> Rexx is a nightmare here.  The LEAVE statement, even with a specified
> >> target, won't exit a (nest of) procedure(s).  The SIGNAL statement
> >> trashes the DO nesting at the target level.  Shame on Rexx.
> >
> >I can see that as a feature.  ;)
> >That prohibits some obfuscate like coding.
> >
> As it stands, the only way to exit a nest of procedures is to set
> a flag and RETURN, and test that flag and RETURN after each
> intervening cal; hardly unobfuscated.  I'd be delighted to be
> able to code, instead
> 
>     DO I =1
>         DO J = 1
>             DO K= 1
>                 CALL P1
>                 ...
>             END K
>         END J
>     END I> 
>     P1:
>         CALL P2
> 
>     P2:  PROCEDURE EXPOSE J
>        LEAVE J
> 

Ok, I can see logic in this.  Although it makes the code somewhat harder to 
understand as You have to check the called procedures for those leave's if You 
want to understand the loops.
An existing alternative would perhaps be RETURNing "LEAVE J" and:

     DO I =1
         DO J = 1
             DO K= 1
                 CALL P1
                 IF  RESULT = 'LEAVE J'  THEN  LEAVE J
                 ...
             END K
         END J
     END I



Regards,
Thomas Berg
______________________________________________________
Thomas Berg   Specialist   AM/DQS   SWEDBANK AB (publ)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to