Re: GoTo in Java



On Tue, 17 Jan 2006 17:53:34 -0600, Peter Lacey <lacey@xxxxxxx> wrote:

>> It is interesting that Java, where the word GOTO is reserved but not
>> used, it has a label and a GoTo equivalent to tell us how to exit a
>> multi-layer iteration (perform loop).
>>
>> I wish we had an equivalent in CoBOL.
>
>We do, dammit (if I undersrand what you're saying). GOTO, GOTO
>equivalent - what's the point? GOTO works, does just what an equivalent
>would do. Stop being stubborn.
>
>(Cancel this if you're trolling).

There are two ways to have internal loops:

PERFORM VARYING.....
PERFORM VARYING....
IF I-AM-FINISHED
EXIT PERFORM
END-IF
END-PERFORM
END-PERFORM

I am not sure, but I think the EXIT PERFORM will have the ability to
pick which level is being exited from. At any rate, I can't do this
now.


Let's say I want to go the GOTO route as you say. I can't use the
existing code, but would need to rewrite the logic.
IF FOUND-SUBCODE
PERFORM SUBCODE-ROUTINE
PERFORM WRITE-RESULTS
END-IF
...
SUBCODE-ROUTINE.
...
IF FINISHED-SUBCODE
PERFORM CHECK-INVENTORY
PERFORM ADD-TO-BIN
END-IF.
....
CHECK-INVENTORY.
...
IF NEED-TO-EXIT
GO TO ??????
END-IF.
....

Let's say I want to go to PERFORM WRITE-RESULTS at this case. I
need to set up switches or rewrite the logic (which is frowned at with
working code).
.



Relevant Pages

  • Re: pattern for an error
    ... so as u maybe see in any paragraph there are exit conditions when the ... clean way WITHOUT goto because i have to transfair it into an acu code ... Change 'go to error' into 'perform error' (where error includes exit program), ...
    (comp.lang.cobol)
  • pattern for an error
    ... exit program. ... so as u maybe see in any paragraph there are exit conditions when the ... clean way WITHOUT goto because i have to transfair it into an acu code ...
    (comp.lang.cobol)
  • Re: Error 2501 Problem when DoubleClicking to Delete Record is Can
    ... Private Sub DeleteRecord_DblClick ... On Error GoTo Err_DeleteRecord_Click ... vbDefaultButton2, "Critical") Then ... > I provided the rewrite to show how to use a more logical flow for the code; ...
    (microsoft.public.access.formscoding)
  • Re: a goto command???
    ... goto isn't scientifically or intellectually a good command; ... rewrite your code more logically. ... Prev by Date: ...
    (comp.soft-sys.matlab)
  • Re: Mens Hour Books
    ... school programming class, and a very long time ago. ... What circumstanceother than creating an infinite loop (10 GOTO ... error handling block than see the same error handling code repeated ... (And can't you just rewrite your infinite loop as ...
    (rec.arts.sf.composition)