Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Any reason to use or not use a period on each statement?
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: 7993
Location: Bellevue, IA

PostPosted: Mon Jan 12, 2009 5:10 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Mon Jan 12, 2009 5:55 am    Post subject: Re: Any reason to use or not use a period on each statement?
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    Post subject:
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    Post subject:
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

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Tue Mar 03, 2009 12:53 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us