From: Howard Brazee on
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.


From: Peter Lacey on
Howard Brazee 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).
From: William M. Klein on
In the '02 Standard and some current implementations (but alas NOT IBM's).

Exit PERFORM (cycle)

--
Bill Klein
wmklein <at> ix.netcom.com
"Howard Brazee" <howard(a)brazee.net> wrote in message
news:dnnqs1tjutcc64coojpi0k06g2jrlopf38(a)4ax.com...
> 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.
>
>


From: Chuck Stevens on
I think what he was looking for was exit from PERFORMs of any level,
analogous to Burroughs B1000 SDL/UPL (and almost certainly
Dijkstra-inspired)
...
DO <label-1> FOREVER;
DO <label-2> FOREVER;
DO <label-3 FOREVER;
...
IF <condition-1> THEN UNDO; % transfers control to just after
END <label-3>
IF <condition-2> THEN UNDO <label-2>; % control to after END
<label-2>
IF <condition-3> THEN UNDO *; % control to outermost DO within
procedure
END <label-3>;
END <label-2>;
END <label-1>;

You can certainly EXIT the "innermost" PERFORM in COBOL, but there's no
provision to EXIT, say, the fifth nested PERFORM level above you in the
hierarchy.

-Chuck Stevens

"William M. Klein" <wmklein(a)nospam.netcom.com> wrote in message
news:yBfzf.123644$Es3.36473(a)fe03.news.easynews.com...
> In the '02 Standard and some current implementations (but alas NOT IBM's).
>
> Exit PERFORM (cycle)
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "Howard Brazee" <howard(a)brazee.net> wrote in message
> news:dnnqs1tjutcc64coojpi0k06g2jrlopf38(a)4ax.com...
>> 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.
>>
>>
>
>


From: Howard Brazee on
On Tue, 17 Jan 2006 17:53:34 -0600, Peter Lacey <lacey(a)mts.net> 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).
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: free implementation? factorial?
Next: xml acucobol