|
Prev: free implementation? factorial?
Next: xml acucobol
From: Howard Brazee on 17 Jan 2006 16:19 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 17 Jan 2006 18:53 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 17 Jan 2006 19:03 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 18 Jan 2006 10:15 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 18 Jan 2006 10:38
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). |