Re: GoTo in Java
- From: Howard Brazee <howard@xxxxxxxxxx>
- Date: Wed, 18 Jan 2006 08:38:37 -0700
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).
.
- Follow-Ups:
- Re: GoTo in Java
- From: Tiberiu Gociu
- Re: GoTo in Java
- References:
- GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- From: Peter Lacey
- GoTo in Java
- Prev by Date: Re: GoTo in Java
- Next by Date: Re: GoTo in Java
- Previous by thread: Re: GoTo in Java
- Next by thread: Re: GoTo in Java
- Index(es):
Relevant Pages
|