Bad habits of GOTO-using programmers : cobol
This is a discussion on Bad habits of GOTO-using programmers within the cobol forums in Programming Languages category; Richard, The Standard (and all compilers that I know of) allow for: Perform Para2 thru Para1 ... Para2. Display "second". Para1. Display "first". According to your logic below, this causes a "fall-thru" from Para1 to Para2. Is this really what you mean? If not, how does it differ from Perform Para2 thru Para1 (Why is one a "fall-thru" and the other isn't) If you do consider Perform Para1 thru Para2 to be fall-thru, I think you find that many (possibly most) COBOL programmers disagree with your use of the term. -- Bill Klein wmklein <at> ix.netcom.com "Richard" <riplin @ azonic.co.nz> ...
![]() |
| | LinkBack | Thread Tools |
|
#21
| |||
| |||
| The Standard (and all compilers that I know of) allow for: Perform Para2 thru Para1 ... Para2. Display "second". Para1. Display "first". According to your logic below, this causes a "fall-thru" from Para1 to Para2. Is this really what you mean? If not, how does it differ from Perform Para2 thru Para1 (Why is one a "fall-thru" and the other isn't) If you do consider Perform Para1 thru Para2 to be fall-thru, I think you find that many (possibly most) COBOL programmers disagree with your use of the term. -- Bill Klein wmklein <at> ix.netcom.com "Richard" <riplin@azonic.co.nz> wrote in message news:7d19d384-fefa-44dc-ab59-b0319919f08b@s9g2000prg.googlegroups.com... On Nov 6, 6:23 am, billg...@cs.uofs.edu (Bill Gunshannon) wrote: > In article <5lk3h4d55e67bsvkftdtfqps3dmvip3...@4ax.com>, > Robert <n...@e.mail> writes: > > > > > On Wed, 05 Nov 2008 10:59:19 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> > > wrote: > > >>On 5 Nov 2008 12:31:42 GMT, billg...@cs.uofs.edu (Bill Gunshannon) > >>wrote: > > >>>In article <fj12h4pe2rhi2veb7ibgop6i4l319vd...@4ax.com>, > >>> Robert <n...@e.mail> writes: > >>>> On Tue, 04 Nov 2008 12:10:49 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> > >>>> wrote: > > >>>>>>2b - do you ever fall through a PERFORMed label? > > >>>>>Nope. > > >>>>>>3c - do you always, or sometimes, or never, use PERFORM ...THRU i.e., as > >>>>>>opposed to just PERFORM? > > >>>>>I always use PERFORM THRU. > > >>>> Then you should have answered yes for 2b. You are falling into and > >>>> performing the -exit > >>>> paragraph. > > >>>He is not "falling into and performing the -exit paragraph.". He is > >>>explicitly telling it to perform the -exit. Falling thru is when you > >>>change paragraphs with no command telling it to do that. > > >>>bill > > >>Bingo! Cha Ching!! > > > How are you entering the -exit paragraph? > > a. always go to > > b. always fall into ("no command") > > c. usually fall into, sometimes go to > > d. none of the above > > PERFORM COUNT-PARA THRU COUNT-EXIT. > > COUNT-PARA. > ADD 1 TO COUNT. > > COUNT-EXIT. > EXIT. > > Both Paragraphs are explicitly mentioned. No GOTO. No Fall-thru. You misunderstand what 'fall into', or fall thru, means. The actual answer, based on your example, is b. always fall into. That is, after the ADD 1 the next thing that happens is that the program 'falls into' the Count-Exit paragraph. In fact the PERFORM a THRU z specifies exactly that the program should start at a and (fall) thru until the end of z. Your answer appeared to be as if your PERFORM was PERFORM COUNT-PARA PERFORM COUNT-EXIT which is a completely different beast. |
|
#22
| |||
| |||
| On Nov 7, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> wrote: > Richard, > The Standard (and all compilers that I know of) allow for: > > Perform Para2 thru Para1 > ... > Para2. > Display "second". > Para1. > Display "first". > > According to your logic below, this causes a "fall-thru" from Para1 to Para2. > Is this really what you mean? If not, how does it differ from > Perform Para2 thru Para1 Please re-read your message and correct it. I do not know why you got this backwards. Please reread my message and understand it. > (Why is one a "fall-thru" and the other isn't) Robert's questions referred to fall-INTO. Given: PERFORM para-a thru para-z para-a. ... para-b. ... ... ... para-z. ... and no gotos then each para- label between the start of para-a and the end of para-z will be fallen into and fallen-thru until the end of para-z cause a return to the statement after the perform. Note: "fall" is always in a downward direction. > If you do consider > Perform Para1 thru Para2 > to be fall-thru, I think you find that many (possibly most) COBOL programmers > disagree with your use of the term. But then most cobol programmers wouldn't misunderstand so badly what I actually wrote. >>>> Falling thru is when you >>>> change paragraphs with no command telling it to do that. Even with perform para-a thru para-a-exit para-a (no goto) para-a-exit exit. there is _NO_ command to tell the code to change to para-a-exit, it simply falls off the end of para-a and falls (downwards) into para-a- exit, or into any intermediate, and falls-thru until it reaches the end of para-a-exit. The only case where this example code wouldn't fall-tru is if there was an explicit go to para-a-exit at the end of para-a. > -- > Bill Klein > wmklein <at> ix.netcom.com"Richard" <rip...@azonic.co.nz> wrote in message > > news:7d19d384-fefa-44dc-ab59-b0319919f08b@s9g2000prg.googlegroups.com... > On Nov 6, 6:23 am, billg...@cs.uofs.edu (Bill Gunshannon) wrote: > > > > > In article <5lk3h4d55e67bsvkftdtfqps3dmvip3...@4ax.com>, > > Robert <n...@e.mail> writes: > > > > On Wed, 05 Nov 2008 10:59:19 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> > > > wrote: > > > >>On 5 Nov 2008 12:31:42 GMT, billg...@cs.uofs.edu (Bill Gunshannon) > > >>wrote: > > > >>>In article <fj12h4pe2rhi2veb7ibgop6i4l319vd...@4ax.com>, > > >>> Robert <n...@e.mail> writes: > > >>>> On Tue, 04 Nov 2008 12:10:49 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> > > >>>> wrote: > > > >>>>>>2b - do you ever fall through a PERFORMed label? > > > >>>>>Nope. > > > >>>>>>3c - do you always, or sometimes, or never, use PERFORM ...THRU i.e., as > > >>>>>>opposed to just PERFORM? > > > >>>>>I always use PERFORM THRU. > > > >>>> Then you should have answered yes for 2b. You are falling into and > > >>>> performing the -exit > > >>>> paragraph. > > > >>>He is not "falling into and performing the -exit paragraph.". He is > > >>>explicitly telling it to perform the -exit. Falling thru is when you > > >>>change paragraphs with no command telling it to do that. > > > >>>bill > > > >>Bingo! Cha Ching!! > > > > How are you entering the -exit paragraph? > > > a. always go to > > > b. always fall into ("no command") > > > c. usually fall into, sometimes go to > > > d. none of the above > > > PERFORM COUNT-PARA THRU COUNT-EXIT. > > > COUNT-PARA. > > ADD 1 TO COUNT. > > > COUNT-EXIT. > > EXIT. > > > Both Paragraphs are explicitly mentioned. No GOTO. No Fall-thru. > > You misunderstand what 'fall into', or fall thru, means. > > The actual answer, based on your example, is b. always fall into. > > That is, after the ADD 1 the next thing that happens is that the > program 'falls into' the Count-Exit paragraph. As clarification for Bill: this explanation is of the actual code sample above where there are no intermediate paragraphs. If there were paragraphs between COUNT-PARA and COUNT-EXIT then it would fall-thru those too. > In fact the PERFORM a THRU z specifies exactly that the program should > start at a and (fall) thru until the end of z. > > Your answer appeared to be as if your PERFORM was > > PERFORM COUNT-PARA > PERFORM COUNT-EXIT > > which is a completely different beast. |
|
#23
| |||
| |||
| Richard, Not worth responding in detail. You use of "fall-thru" is NOT the same as mine (or that of anyone that I can remember ever working with.) In the case of Perform Para1 thru Para3 with a structure of Para1. .... Para2. ... Para3. Then there IS a "fall-thru" (or fall into if you prefer) from Para1 to Para2. There is NOT a fall thru from Para2 to Para3 as Para3 is part of the explicit PERFORM statement. I understand your (repeated) view that this isn't true, but that does NOT mean that this is the common usage of "fall thru" (or fall into) as used by those COBOL programmers that I have worked with. I have certainly seen several others posting in this group who agree with my understanding of this term. I would be curious if there are others reading/participating in CLC who would think that in Perform PARAx thru PARAy that the "entrance" into PARAy is *ever* a "fall thru". (or fall into or any other type of "fall"). If I am in error in reading YOUR note (not Robert's) and you agree that the entry into PARAy is NOT a "fall into/thru", then I apologize for my misunderstanding. -- Bill Klein wmklein <at> ix.netcom.com "Richard" <riplin@azonic.co.nz> wrote in message news:3890aac7-c251-4ac8-a2b9-4980735828c7@i18g2000prf.googlegroups.com... > On Nov 7, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> > wrote: >> Richard, >> The Standard (and all compilers that I know of) allow for: >> >> Perform Para2 thru Para1 >> ... >> Para2. >> Display "second". >> Para1. >> Display "first". >> >> According to your logic below, this causes a "fall-thru" from Para1 to Para2. >> Is this really what you mean? If not, how does it differ from >> Perform Para2 thru Para1 > > Please re-read your message and correct it. > > I do not know why you got this backwards. > > Please reread my message and understand it. > > >> (Why is one a "fall-thru" and the other isn't) > > Robert's questions referred to fall-INTO. Given: > > PERFORM para-a thru para-z > > para-a. > ... > para-b. > ... > ... > ... > para-z. > ... > > and no gotos then each para- label between the start of para-a and the > end of para-z will be fallen into and fallen-thru until the end of > para-z cause a return to the statement after the perform. > > Note: "fall" is always in a downward direction. > >> If you do consider >> Perform Para1 thru Para2 >> to be fall-thru, I think you find that many (possibly most) COBOL programmers >> disagree with your use of the term. > > But then most cobol programmers wouldn't misunderstand so badly what I > actually wrote. > >>>>> Falling thru is when you >>>>> change paragraphs with no command telling it to do that. > > Even with perform para-a thru para-a-exit > > para-a > (no goto) > para-a-exit > exit. > > there is _NO_ command to tell the code to change to para-a-exit, it > simply falls off the end of para-a and falls (downwards) into para-a- > exit, or into any intermediate, and falls-thru until it reaches the > end of para-a-exit. > > The only case where this example code wouldn't fall-tru is if there > was an explicit go to para-a-exit at the end of para-a. > > >> -- >> Bill Klein >> wmklein <at> ix.netcom.com"Richard" <rip...@azonic.co.nz> wrote in message >> >> news:7d19d384-fefa-44dc-ab59-b0319919f08b@s9g2000prg.googlegroups.com... >> On Nov 6, 6:23 am, billg...@cs.uofs.edu (Bill Gunshannon) wrote: >> >> >> >> > In article <5lk3h4d55e67bsvkftdtfqps3dmvip3...@4ax.com>, >> > Robert <n...@e.mail> writes: >> >> > > On Wed, 05 Nov 2008 10:59:19 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> >> > > wrote: >> >> > >>On 5 Nov 2008 12:31:42 GMT, billg...@cs.uofs.edu (Bill Gunshannon) >> > >>wrote: >> >> > >>>In article <fj12h4pe2rhi2veb7ibgop6i4l319vd...@4ax.com>, >> > >>> Robert <n...@e.mail> writes: >> > >>>> On Tue, 04 Nov 2008 12:10:49 -0500, SkippyPB >> > >>>> <swieg...@Nospam.neo.rr.com> >> > >>>> wrote: >> >> > >>>>>>2b - do you ever fall through a PERFORMed label? >> >> > >>>>>Nope. >> >> > >>>>>>3c - do you always, or sometimes, or never, use PERFORM ...THRU i.e., >> > >>>>>>as >> > >>>>>>opposed to just PERFORM? >> >> > >>>>>I always use PERFORM THRU. >> >> > >>>> Then you should have answered yes for 2b. You are falling into and >> > >>>> performing the -exit >> > >>>> paragraph. >> >> > >>>He is not "falling into and performing the -exit paragraph.". He is >> > >>>explicitly telling it to perform the -exit. Falling thru is when you >> > >>>change paragraphs with no command telling it to do that. >> >> > >>>bill >> >> > >>Bingo! Cha Ching!! >> >> > > How are you entering the -exit paragraph? >> > > a. always go to >> > > b. always fall into ("no command") >> > > c. usually fall into, sometimes go to >> >> > d. none of the above >> >> > PERFORM COUNT-PARA THRU COUNT-EXIT. >> >> > COUNT-PARA. >> > ADD 1 TO COUNT. >> >> > COUNT-EXIT. >> > EXIT. >> >> > Both Paragraphs are explicitly mentioned. No GOTO. No Fall-thru. >> >> You misunderstand what 'fall into', or fall thru, means. >> >> The actual answer, based on your example, is b. always fall into. >> >> That is, after the ADD 1 the next thing that happens is that the >> program 'falls into' the Count-Exit paragraph. > > As clarification for Bill: this explanation is of the actual code > sample above where there are no intermediate paragraphs. If there were > paragraphs between COUNT-PARA and COUNT-EXIT then it would fall-thru > those too. > > >> In fact the PERFORM a THRU z specifies exactly that the program should >> start at a and (fall) thru until the end of z. >> >> Your answer appeared to be as if your PERFORM was >> >> PERFORM COUNT-PARA >> PERFORM COUNT-EXIT >> >> which is a completely different beast. > |
|
#24
| |||
| |||
| On Nov 10, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> wrote: > Richard, > Not worth responding in detail. You use of "fall-thru" is NOT the same as > mine (or that of anyone that I can remember ever working with.) > > In the case of > Perform Para1 thru Para3 > with a structure of > > Para1. > .... > Para2. > ... > Para3. > > Then there IS a "fall-thru" (or fall into if you prefer) > from Para1 to Para2. > There is NOT a fall thru from Para2 to Para3 as Para3 is part of the explicit > PERFORM statement. The mechanism of progressing from the end para1 to the start of para2 and from the end of para2 to the start of para3 is _identical_. Why would you wave your hands and say 'no,no, this is not drop-xx' ?. The only relevant part of Para3, because it is in the THRU clause of the PERFORM, is the bit that is _after_ all the statements because that is where the return is from. As Bill (the other one) clearly stated: "Falling thru is when you change paragraphs with no command telling it to do that." Where is the 'command' at the end of Para2 that you think changes the paragraph to Para3 ? (Clue: It isn't the PERFORM). > I understand your (repeated) view that this isn't true, but that does NOT mean > that this is the common usage of "fall thru" (or fall into) as used by those > COBOL programmers that I have worked with. Then they are all wrong. There is no magic in the code at the end of Para2 (in the example) that makes the transfer travel via some 4th dimension. The process simply drops off the end of Para2 exactly as it drops off Para1 and drops-into Para3. It actually drops-through all the code in Para3 until it finds the return after the end of the code > I have certainly seen several others posting in this group who agree with my > understanding of this term. I would be curious if there are others > reading/participating in CLC who would think that in > Perform PARAx thru PARAy > that the "entrance" into PARAy is *ever* a "fall thru". (or fall into or any > other type of "fall"). Regardless of how many vote on its meaning, it _IS_ a fall from the end of Para1, and from Para2, into the next paragraph. > If I am in error in reading YOUR note (not Robert's) and you agree that the > entry into PARAy is NOT a "fall into/thru", then I apologize for my > misunderstanding. At the end of Para1 it falls into the next paragraph. It will continue to do this until it reaches a point after the _END_ of the paragraph specified in the THRU. The PERFORM statement is explicit is specifying this as a THRU. ie it is: PERFORM (starting at) Para1 (and falling) THRU (until the end of) Para3 > -- > Bill Klein > wmklein <at> ix.netcom.com"Richard" <rip...@azonic.co.nz> wrote in message > > news:3890aac7-c251-4ac8-a2b9-4980735828c7@i18g2000prf.googlegroups.com... > > > On Nov 7, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> > > wrote: > >> Richard, > >> The Standard (and all compilers that I know of) allow for: > > >> Perform Para2 thru Para1 > >> ... > >> Para2. > >> Display "second". > >> Para1. > >> Display "first". > > >> According to your logic below, this causes a "fall-thru" from Para1 to Para2. > >> Is this really what you mean? If not, how does it differ from > >> Perform Para2 thru Para1 > > > Please re-read your message and correct it. > > > I do not know why you got this backwards. > > > Please reread my message and understand it. > > >> (Why is one a "fall-thru" and the other isn't) > > > Robert's questions referred to fall-INTO. Given: > > > PERFORM para-a thru para-z > > > para-a. > > ... > > para-b. > > ... > > ... > > ... > > para-z. > > ... > > > and no gotos then each para- label between the start of para-a and the > > end of para-z will be fallen into and fallen-thru until the end of > > para-z cause a return to the statement after the perform. > > > Note: "fall" is always in a downward direction. > > >> If you do consider > >> Perform Para1 thru Para2 > >> to be fall-thru, I think you find that many (possibly most) COBOL programmers > >> disagree with your use of the term. > > > But then most cobol programmers wouldn't misunderstand so badly what I > > actually wrote. > > >>>>> Falling thru is when you > >>>>> change paragraphs with no command telling it to do that. > > > Even with perform para-a thru para-a-exit > > > para-a > > (no goto) > > para-a-exit > > exit. > > > there is _NO_ command to tell the code to change to para-a-exit, it > > simply falls off the end of para-a and falls (downwards) into para-a- > > exit, or into any intermediate, and falls-thru until it reaches the > > end of para-a-exit. > > > The only case where this example code wouldn't fall-tru is if there > > was an explicit go to para-a-exit at the end of para-a. > > >> -- > >> Bill Klein > >> wmklein <at> ix.netcom.com"Richard" <rip...@azonic.co.nz> wrote in message > > >>news:7d19d384-fefa-44dc-ab59-b0319919f08b@s9g2000prg.googlegroups.com... > >> On Nov 6, 6:23 am, billg...@cs.uofs.edu (Bill Gunshannon) wrote: > > >> > In article <5lk3h4d55e67bsvkftdtfqps3dmvip3...@4ax.com>, > >> > Robert <n...@e.mail> writes: > > >> > > On Wed, 05 Nov 2008 10:59:19 -0500, SkippyPB <swieg...@Nospam.neo.rr.com> > >> > > wrote: > > >> > >>On 5 Nov 2008 12:31:42 GMT, billg...@cs.uofs.edu (Bill Gunshannon) > >> > >>wrote: > > >> > >>>In article <fj12h4pe2rhi2veb7ibgop6i4l319vd...@4ax.com>, > >> > >>> Robert <n...@e.mail> writes: > >> > >>>> On Tue, 04 Nov 2008 12:10:49 -0500, SkippyPB > >> > >>>> <swieg...@Nospam.neo.rr.com> > >> > >>>> wrote: > > >> > >>>>>>2b - do you ever fall through a PERFORMed label? > > >> > >>>>>Nope. > > >> > >>>>>>3c - do you always, or sometimes, or never, use PERFORM ...THRU i.e., > >> > >>>>>>as > >> > >>>>>>opposed to just PERFORM? > > >> > >>>>>I always use PERFORM THRU. > > >> > >>>> Then you should have answered yes for 2b. You are falling into and > >> > >>>> performing the -exit > >> > >>>> paragraph. > > >> > >>>He is not "falling into and performing the -exit paragraph.". He is > >> > >>>explicitly telling it to perform the -exit. Falling thru is when you > >> > >>>change paragraphs with no command telling it to do that. > > >> > >>>bill > > >> > >>Bingo! Cha Ching!! > > >> > > How are you entering the -exit paragraph? > >> > > a. always go to > >> > > b. always fall into ("no command") > >> > > c. usually fall into, sometimes go to > > >> > d. none of the above > > >> > PERFORM COUNT-PARA THRU COUNT-EXIT. > > >> > COUNT-PARA. > >> > ADD 1 TO COUNT. > > >> > COUNT-EXIT. > >> > EXIT. > > >> > Both Paragraphs are explicitly mentioned. No GOTO. No Fall-thru. > > >> You misunderstand what 'fall into', or fall thru, means. > > >> The actual answer, based on your example, is b. always fall into. > > >> That is, after the ADD 1 the next thing that happens is that the > >> program 'falls into' the Count-Exit paragraph. > > > As clarification for Bill: this explanation is of the actual code > > sample above where there are no intermediate paragraphs. If there were > > paragraphs between COUNT-PARA and COUNT-EXIT then it would fall-thru > > those too. > > >> In fact the PERFORM a THRU z specifies exactly that the program should > >> start at a and (fall) thru until the end of z. > > >> Your answer appeared to be as if your PERFORM was > > >> PERFORM COUNT-PARA > >> PERFORM COUNT-EXIT > > >> which is a completely different beast. |
|
#25
| |||
| |||
| In article <77b33c53-a4c4-46e0-a472-b3d4caf8ed60@z6g2000pre.googlegroups.com>, Richard <riplin@azonic.co.nz> wrote: >On Nov 10, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> >wrote: >> Richard, >> Not worth responding in detail. You use of "fall-thru" is NOT the same as >> mine (or that of anyone that I can remember ever working with.) >> >> In the case of >> Perform Para1 thru Para3 >> with a structure of >> >> Para1. >> .... >> Para2. >> ... >> Para3. >> >> Then there IS a "fall-thru" (or fall into if you prefer) >> from Para1 to Para2. >> There is NOT a fall thru from Para2 to Para3 as Para3 is part of the explicit >> PERFORM statement. [snip] >As Bill (the other one) clearly stated: "Falling thru is when you >change paragraphs with no command telling it to do that." > >Where is the 'command' at the end of Para2 that you think changes the >paragraph to Para3 ? (Clue: It isn't the PERFORM). The range invoked by the THRU causes the code in Para3 to be executed, Mr Plinston... are you saying that range-execution is the same as falling through? If that is the case then how is the code which follows the PERFORM executed? DD |
|
#26
| |||
| |||
| "William M. Klein" <wmklein@nospam.netcom.com> wrote in message news:hkNRk.145893$cU2.30642@fe04.news.easynews.com... > Richard, > Not worth responding in detail. You use of "fall-thru" is NOT the same > as mine (or that of anyone that I can remember ever working with.) > > In the case of > Perform Para1 thru Para3 > with a structure of > > Para1. > .... > Para2. > ... > Para3. > > Then there IS a "fall-thru" (or fall into if you prefer) from Para1 to > Para2. There is NOT a fall thru from Para2 to Para3 as Para3 is part of > the explicit PERFORM statement. I agree with Bill's interpretation and I'd go further... I'd say that in the example above the execution of para2 is NOT a "fall thru" because it is part of the specified scope of the PERFORM. If I PERFORM a SECTION with several paragraphs in it (provided I don't do any branching out of the section) then that SECTION is a defined scope and it is arguable if paragraphs receiving control within that scope, are "fall thrus". (More importantly, it is irrelevant if I am looking to debug a roblem with control flow...) For example: some section. p000. ...... p010. ..... p020. if some-condition go to p000 end-if .... p999. exit. =============================== It seems pointless to me to argue whether control "falls thru" each of the paragraphs... it doesn't matter. The defined scope is the SECTION and that is the "unit" of control transference that we need to be concerned with. Similarly, PERFORM para1 thru para3 defines an explicitly scoped "unit" of control transference, in fact, the scope of any PERFORM does this. What happens inside the scope of that unit is of no consequence; problems of control flow occur only when we jump out of this defined scope, or inadvertently fall out of it, and that cannot happen if it has been PERFORMed (and there are no GO TOs or ALTERED procedures within the scope.) It really comes down to what you mean by "fall thru". You can argue that all code execution is a "fall thru" to the next sequential instruction, unless diverted by a branch or jump in which case you have simply "fallen" into a different location... But what point does such an argument serve? Like I said before, this whole discussion would be important if control flow was problematic, but for the most part, it isn't. Checks and balances already in place on most installations, plus programmer experience over years, all combine to make it simply a storm in a teacup. Peter's survey showed that at least the people who responded, all applied constraints to code to prevent control flow issues (Minimal use of GO TO, one entry and one exit to a performed scope, no ALTERs, etc.), most production problems are caused by bad data or data that is outside the validation scope of the program concerned, NOT with control flow branching out of a PERFORMED range, or dropping inot places where it shouldn't. When's the last time you saw an endless loop in production, or S0C3/4 (NOT caused by bad subscripting/indexing...)? And, if you can answer in the affirmative, what percentage of ALL production errors was this? Pete. -- "I used to write COBOL...now I can do anything." > > I understand your (repeated) view that this isn't true, but that does NOT > mean that this is the common usage of "fall thru" (or fall into) as used > by those COBOL programmers that I have worked with. > > I have certainly seen several others posting in this group who agree with > my understanding of this term. I would be curious if there are others > reading/participating in CLC who would think that in > Perform PARAx thru PARAy > that the "entrance" into PARAy is *ever* a "fall thru". (or fall into or > any other type of "fall"). > > If I am in error in reading YOUR note (not Robert's) and you agree that > the entry into PARAy is NOT a "fall into/thru", then I apologize for my > misunderstanding. > > -- > Bill Klein > wmklein <at> ix.netcom.com > "Richard" <riplin@azonic.co.nz> wrote in message > news:3890aac7-c251-4ac8-a2b9-4980735828c7@i18g2000prf.googlegroups.com... >> On Nov 7, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> >> wrote: >>> Richard, >>> The Standard (and all compilers that I know of) allow for: >>> >>> Perform Para2 thru Para1 >>> ... >>> Para2. >>> Display "second". >>> Para1. >>> Display "first". >>> >>> According to your logic below, this causes a "fall-thru" from Para1 to >>> Para2. >>> Is this really what you mean? If not, how does it differ from >>> Perform Para2 thru Para1 >> >> Please re-read your message and correct it. >> >> I do not know why you got this backwards. >> >> Please reread my message and understand it. >> >> >>> (Why is one a "fall-thru" and the other isn't) >> >> Robert's questions referred to fall-INTO. Given: >> >> PERFORM para-a thru para-z >> >> para-a. >> ... >> para-b. >> ... >> ... >> ... >> para-z. >> ... >> >> and no gotos then each para- label between the start of para-a and the >> end of para-z will be fallen into and fallen-thru until the end of >> para-z cause a return to the statement after the perform. >> >> Note: "fall" is always in a downward direction. >> >>> If you do consider >>> Perform Para1 thru Para2 >>> to be fall-thru, I think you find that many (possibly most) COBOL >>> programmers >>> disagree with your use of the term. >> >> But then most cobol programmers wouldn't misunderstand so badly what I >> actually wrote. >> >>>>>> Falling thru is when you >>>>>> change paragraphs with no command telling it to do that. >> >> Even with perform para-a thru para-a-exit >> >> para-a >> (no goto) >> para-a-exit >> exit. >> >> there is _NO_ command to tell the code to change to para-a-exit, it >> simply falls off the end of para-a and falls (downwards) into para-a- >> exit, or into any intermediate, and falls-thru until it reaches the >> end of para-a-exit. >> >> The only case where this example code wouldn't fall-tru is if there >> was an explicit go to para-a-exit at the end of para-a. >> >> >>> -- >>> Bill Klein >>> wmklein <at> ix.netcom.com"Richard" <rip...@azonic.co.nz> wrote in >>> message >>> >>> news:7d19d384-fefa-44dc-ab59-b0319919f08b@s9g2000prg.googlegroups.com... >>> On Nov 6, 6:23 am, billg...@cs.uofs.edu (Bill Gunshannon) wrote: >>> >>> >>> >>> > In article <5lk3h4d55e67bsvkftdtfqps3dmvip3...@4ax.com>, >>> > Robert <n...@e.mail> writes: >>> >>> > > On Wed, 05 Nov 2008 10:59:19 -0500, SkippyPB >>> > > <swieg...@Nospam.neo.rr.com> >>> > > wrote: >>> >>> > >>On 5 Nov 2008 12:31:42 GMT, billg...@cs.uofs.edu (Bill Gunshannon) >>> > >>wrote: >>> >>> > >>>In article <fj12h4pe2rhi2veb7ibgop6i4l319vd...@4ax.com>, >>> > >>> Robert <n...@e.mail> writes: >>> > >>>> On Tue, 04 Nov 2008 12:10:49 -0500, SkippyPB >>> > >>>> <swieg...@Nospam.neo.rr.com> >>> > >>>> wrote: >>> >>> > >>>>>>2b - do you ever fall through a PERFORMed label? >>> >>> > >>>>>Nope. >>> >>> > >>>>>>3c - do you always, or sometimes, or never, use PERFORM ...THRU >>> > >>>>>>i.e., as >>> > >>>>>>opposed to just PERFORM? >>> >>> > >>>>>I always use PERFORM THRU. >>> >>> > >>>> Then you should have answered yes for 2b. You are falling into >>> > >>>> and >>> > >>>> performing the -exit >>> > >>>> paragraph. >>> >>> > >>>He is not "falling into and performing the -exit paragraph.". He is >>> > >>>explicitly telling it to perform the -exit. Falling thru is when >>> > >>>you >>> > >>>change paragraphs with no command telling it to do that. >>> >>> > >>>bill >>> >>> > >>Bingo! Cha Ching!! >>> >>> > > How are you entering the -exit paragraph? >>> > > a. always go to >>> > > b. always fall into ("no command") >>> > > c. usually fall into, sometimes go to >>> >>> > d. none of the above >>> >>> > PERFORM COUNT-PARA THRU COUNT-EXIT. >>> >>> > COUNT-PARA. >>> > ADD 1 TO COUNT. >>> >>> > COUNT-EXIT. >>> > EXIT. >>> >>> > Both Paragraphs are explicitly mentioned. No GOTO. No Fall-thru. >>> >>> You misunderstand what 'fall into', or fall thru, means. >>> >>> The actual answer, based on your example, is b. always fall into. >>> >>> That is, after the ADD 1 the next thing that happens is that the >>> program 'falls into' the Count-Exit paragraph. >> >> As clarification for Bill: this explanation is of the actual code >> sample above where there are no intermediate paragraphs. If there were >> paragraphs between COUNT-PARA and COUNT-EXIT then it would fall-thru >> those too. >> >> >>> In fact the PERFORM a THRU z specifies exactly that the program should >>> start at a and (fall) thru until the end of z. >>> >>> Your answer appeared to be as if your PERFORM was >>> >>> PERFORM COUNT-PARA >>> PERFORM COUNT-EXIT >>> >>> which is a completely different beast. >> > > |
|
#27
| |||
| |||
| "Richard" <riplin@azonic.co.nz> wrote in message news:77b33c53-a4c4-46e0-a472-b3d4caf8ed60@z6g2000pre.googlegroups.com... > On Nov 10, 3:50 pm, "William M. Klein" <wmkl...@nospam.netcom.com> > wrote: >> Richard, >> Not worth responding in detail. You use of "fall-thru" is NOT the same >> as >> mine (or that of anyone that I can remember ever working with.) >> >> In the case of >> Perform Para1 thru Para3 >> with a structure of >> >> Para1. >> .... >> Para2. >> ... >> Para3. >> >> Then there IS a "fall-thru" (or fall into if you prefer) >> from Para1 to Para2. >> There is NOT a fall thru from Para2 to Para3 as Para3 is part of the >> explicit >> PERFORM statement. > > The mechanism of progressing from the end para1 to the start of para2 > and from the end of para2 to the start of para3 is _identical_. Why > would you wave your hands and say 'no,no, this is not drop-xx' ?. > > The only relevant part of Para3, because it is in the THRU clause of > the PERFORM, is the bit that is _after_ all the statements because > that is where the return is from. > > As Bill (the other one) clearly stated: "Falling thru is when you > change paragraphs with no command telling it to do that." > > Where is the 'command' at the end of Para2 that you think changes the > paragraph to Para3 ? (Clue: It isn't the PERFORM). > > > >> I understand your (repeated) view that this isn't true, but that does NOT >> mean >> that this is the common usage of "fall thru" (or fall into) as used by >> those >> COBOL programmers that I have worked with. > > Then they are all wrong. There is no magic in the code at the end of > Para2 (in the example) that makes the transfer travel via some 4th > dimension. The process simply drops off the end of Para2 exactly as it > drops off Para1 and drops-into Para3. It actually drops-through all > the code in Para3 until it finds the return after the end of the code > > >> I have certainly seen several others posting in this group who agree with >> my >> understanding of this term. I would be curious if there are others >> reading/participating in CLC who would think that in >> Perform PARAx thru PARAy >> that the "entrance" into PARAy is *ever* a "fall thru". (or fall into or >> any >> other type of "fall"). > > Regardless of how many vote on its meaning, it _IS_ a fall from the > end of Para1, and from Para2, into the next paragraph. > I disagree :-) But I don't think you're wrong :-) Why limit "fall thru" to paragraphs? EVERY single instruction that is executed "falls thru" by the definition you are using. Could you accept that this is maybe a matter of subjective interpretation, Richard? By YOUR definition of "fall thru" what you say is perfectly correct, but not everyone uses that definition. Personally, I consider the scope of a PERFORM (Whether it is a PERFORMed paragraph, section or THRU ...) to be a defined scope and what happens inside it is NOT "fall thru". I activated a scope explicitly. That is not by accident or causing a transfer of control I didn't want to happen. (See earlier post in this thread) Pete. -- "I used to write COBOL...now I can do anything." |
|
#28
| |||
| |||
| To me, there are three ways to get into a paragraph. Either you get sent there by name (perform, go to), you fall through after performing the preceding sentence, or you return from a perform or call. Exit paragraphs don't have performs or calls, so they only have 2 options. -- "In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department." - James Madison |
|
#29
| |||
| |||
| On Tue, 04 Nov 2008 19:51:37 +0000, Frederico Fonseca <real-email-in-msg-spam@email.com> wrote: >Now. I work according to my client standards most of the time. >If the client uses sections, then GO are allowed within the Section >mainly to hop to exit paragraph > >If he does not use sections, then I only use PERFORM's, and very very >rarely GO TO's. > >When doing my OWN programs, I use PERFORM only Same with me. I use whatever programs were assigned to me, standards which were assigned to me, or when I have a choice with my own programs, each paragraph is stand alone, and all but the first are only executed by perform commands (or by sort procedures). -- "In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department." - James Madison |
|
#30
| |||
| |||
| On Wed, 05 Nov 2008 19:41:50 -0500, Silfax <root@localhost.localdomain> wrote: >I don't particulary like using sections, I will only use them when >modifying something that already has them, and I try to do sorts >externally if possible. Does your compiler allow sort procedures to be paragraphs? -- "In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department." - James Madison |


