View previous topic :: View next topic
|
Author |
Message |
James Magruder
New User
Joined: 01 Nov 2008 Posts: 5 Location: Kansas City MO
|
|
|
|
Originally in Cobol you HAD to use a period at the end of each statement in the Procedure Division.
With the 1985 revision of Cobol (I think), the period became optional, except for the last statement in a paragraph. You can now use a period at the end of each sentence, or you can omit them all except at the end of a paragraph. The compiler doesn't care.
Is there any reason to prefer using a period, or not using a period? Here's why I ask: sometime in the 1990's I took some training on what we were calling "Cobol II" -- the 1985 version of Cobol. The guy who taught that class, who seemed to know his stuff, told us that it's generally better not to use periods. He said that the optimizer looks at periods, and does not optimize the code as thoroughly when periods are present.
Does anyone know if this is true? Or was true at the time?
I have looked in Cobol manuals and reference books and haven't been able to verify what he said. I can't disprove it, either, because I haven't found anything that even addresses the issue. (I've also searched this forum for the topic and didn't find it, although I'm sure I could have missed it.)
I've also tried to contact the instructor who gave us this information. He hasn't responded to my emails. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I've never heard that leaving periods out improves optimization in COBOL. The optimizer shouldn't really change behavior based on statement terminators. I doubt this was ever true or is now, but I cannot prove it one way or the other. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
James Magruder wrote: |
sometime in the 1990's I took some training on what we were calling "Cobol II" -- the 1985 version of Cobol. The guy who taught that class, who seemed to know his stuff, told us that it's generally better not to use periods. He said that the optimizer looks at periods, and does not optimize the code as thoroughly when periods are present. |
I can't say if this it true or not, but the "END-verb" is a great way to keep the verb/command range in check.....
Back in the day (grin), periods where the only way....grin.... |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
I also found "no periods" of value when cut & pasting code into "IF"
stmt(s). Have'nt gotten a compiler error doing that in ages. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I think it's basically a matter of 2 things: Personal preference and shop standards. I personally prefer 1 period per paragraph coded in column 12. My reasons are that it forces you to use scope terminators (which I think is a good thing), eliminates the confusion between commas and periods, reduces the number of errors when copy and paste is used to copy code from one area to another which might be inside an IF or EVALUATE or whatever. I've just found that it leads to fewer problems by not using periods. One of the most common coding errors is still a period where there shouldn't be one and a missing period where there should be one. |
|
Back to top |
|
|
jasorn Warnings : 1 Active User
Joined: 12 Jul 2006 Posts: 191 Location: USA
|
|
|
|
I have heard that it's more efficient from a few sources. But I've never tested that. I'll do that and see.
But to me it's more a matter of maintenance. Periods get in the way and can change logic flows in ways that are hard to spot.
Trust me, one period per paragraph will prevent headaches. |
|
Back to top |
|
|
|