On Mon, 16 Apr 2012 16:51:27 +0200, Thomas Berg wrote:
>>
>>     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
>
Again, if P1 were to do any processing after the call to P2
P1 would need to make the same test.  This is just a form
or set-a-flag-and-test-after-each-call.

It's a trivial exercise to convert any tangle of GOTOs to
a DO containing a SELECT with no gain in legibility or in
reliability.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to