IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Any reason to use or not use a period on each statement?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
James Magruder

New User


Joined: 01 Nov 2008
Posts: 5
Location: Kansas City MO

PostPosted: Mon Jan 12, 2009 4:26 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 12, 2009 5:10 am
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jan 12, 2009 5:55 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Jan 12, 2009 7:40 am
Reply with quote

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. icon_smile.gif
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Mon Jan 12, 2009 10:07 am
Reply with quote

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
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Tue Mar 03, 2009 12:53 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Reorg abended with REASON=X'00E40347' DB2 2
No new posts REASON 00D70014 in load utility DB2 6
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
Search our Forums:

Back to Top