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

Best Practices for Enterprise COBOL


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

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Wed Jul 20, 2011 6:04 pm
Reply with quote

Bill's earlier posting
Bill Woodger wrote:
If you dig into this topic, you can find some alternatives to the basic 4-digit numbers. http://www.ibmmainframes.com/viewtopic.php?t=54170
contained a broken link. The correct link is
http://www.ibmmainframes.com/viewtopic.php?t=54170
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 20, 2011 7:17 pm
Reply with quote

Thanks Ronald. A bit of spaghetti clicking on my part.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Wed Jul 20, 2011 8:21 pm
Reply with quote

Bill W., I know this is picking-nits (and I do apologize for that) but:
---- I coded --------
000037 A0000-MAINLINE.
000038 *****==============================================*****
000039 PERFORM A.
000040 *****==============================================*****
000041 GOBACK.
000042
000043 A SECTION.
000044 DISPLAY 'THIS IS THE A-SECTION'.
000045 A-EXIT.
000046 EXIT.
000047
000048 B-PARAGRAPH.
000049 DISPLAY 'THIS IS THE B-PARAGRAPH'.
000050 C SECTION.
000051 DISPLAY 'THIS IS THE C-SECTION'.
***** these are the DISPLAYs that came out of the above code
THIS IS THE A-SECTION
THIS IS THE B-PARAGRAPH

And for this reason -- (admittedly as an old-timer) I prefer Paragraphs with PERFORM-THRUs. I don't have to worry about some programmer sticking a PARAGRAPH between two PERFORMed SECTIONs
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 20, 2011 8:38 pm
Reply with quote

ridgewalker58 wrote:
Bill W., I know this is picking-nits (and I do apologize for that) but:
---- I coded --------
000037 A0000-MAINLINE.
000038 *****==============================================*****
000039 PERFORM A.
000040 *****==============================================*****
000041 GOBACK.
000042
000043 A SECTION.
000044 DISPLAY 'THIS IS THE A-SECTION'.
000045 A-EXIT.
000046 EXIT.
000047
000048 B-PARAGRAPH.
000049 DISPLAY 'THIS IS THE B-PARAGRAPH'.
000050 C SECTION.
000051 DISPLAY 'THIS IS THE C-SECTION'.
***** these are the DISPLAYs that came out of the above code
THIS IS THE A-SECTION
THIS IS THE B-PARAGRAPH

And for this reason -- (admittedly as an old-timer) I prefer Paragraphs with PERFORM-THRUs. I don't have to worry about some programmer sticking a PARAGRAPH between two PERFORMed SECTIONs


No problem. I'm picky as well. :-)

I missed mentioning the mixing of paragraphs and sections when one "camp" doesn't know that the other "camp" works differently.

What most don't realise is that "EXIT" does nothing. It is just a marker for the compiler. In the condensed listing, you can see there is stuff associated with the exit, but it is just where the compiler sticks some of the code which allows all possibilities to work. Without the exit paragraph (exit must be on its own) then the last instruction in the para/section just looks very long.

As with sticking a para uknowingly "inside" a section, so with the other examples. If someone were to stick a section inside a perform thru program, I'd say it was even worse.

"We" are old enough to know how each works. We each have our own personal preferences. I'm not aware of a "defeat all" argument for one, or the other. I don't get bent up about it, but have to admit to preferring sections.

I do my sections the way I do my perform thru's (if local standard). I'm a great believer in KISS. The more you know, the easier it is to KISS. I keep my perform thru's simple. I keep my sections simple. I use lots of performs from the paras/sections I perform, rather than bunging everything together in one way or another. I love the way the optimiser chops away the extraneous rubbish and makes the performs not much slower than a go to anyway, and orders of magnitude easier to cope with.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Wed Jul 20, 2011 8:41 pm
Reply with quote

ridgewalker58 wrote:

And for this reason -- (admittedly as an old-timer) I prefer Paragraphs with PERFORM-THRUs. I don't have to worry about some programmer sticking a PARAGRAPH between two PERFORMed SECTIONs
You can also avoid this by not using SECTIONS at all. If you code in paragraphs and never use GOTO you will never see a fall-through.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Jul 21, 2011 12:42 am
Reply with quote

OMG icon_oak.gif icon_oak.gif icon_oak.gif, am I happy that I've only ever used PL/I...
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Jul 21, 2011 3:21 am
Reply with quote

prino wrote:
OMG icon_oak.gif icon_oak.gif icon_oak.gif, am I happy that I've only ever used PL/I...

As Edsger Dijkstra famously remarked: "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."

icon_lol.gif
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jul 21, 2011 3:31 am
Reply with quote

I was a pioneer in the early 1980's, with Credit Card Software (Orlando, FL), which then became PaySys International and we had a standards committee (I was on it), that reviewed source code and ensured it met our requirements. If it didn't, then it was returned to do it right.

Because of these standards, all of our COBOL programs were the same, no one deviated or got "cute" with their code.

I was once told that programs need to be constructed, so they read like a book and the thousands of CCS programs met this.

Developing standards is site-dependent, but as has been expressed earlier, when you write a program, remember the next person that needs to come along and perform maintenance.

Regards,

Bill

Author of the PaySys Real Time Authorization Product "FAS".
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 21, 2011 2:09 pm
Reply with quote

i have stayed out of this topic because most have been subjected to my ranting and raving about standards.

instead, I will supply a bunch of edit macros that I use during analysis and modification of programs.

simply upload the txt file to an 80 column ps or pds member
and following the instructions.

i attempted to "comment" adequately to give a sense of what the macro/script accomplishes.

there are few if any comments about how the instructions work or why.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 2:28 pm
Reply with quote

Wow, dbz, a treasure-trove.

I like ID DIVISION, by the way.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jul 21, 2011 2:46 pm
Reply with quote

don.leahy wrote:
prino wrote:
OMG icon_oak.gif icon_oak.gif icon_oak.gif, am I happy that I've only ever used PL/I...

As Edsger Dijkstra famously remarked: "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense."

icon_lol.gif


Prino, you must be lucky that PL/1 is such a restrictive language that there is only one way to do anything, so therefore it is always the "best" way (in the "best" language, of course?) :-) Welcome back, by the way.

Dijkstra, I'll just point out - you never worked in Hollywood after that, did you? Ha!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jul 21, 2011 2:51 pm
Reply with quote

Another quote of Dijkstra :

PL/I --"the fatal disease"-- belongs more to the problem set than to the solution set.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jul 21, 2011 2:54 pm
Reply with quote

Another one :

The problems of business administration in general and data base management in particular are much too difficult for people that think in IBMerese, compounded with sloppy English.

I like the bold part of previous statement.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jul 21, 2011 7:56 pm
Reply with quote

PL/1 - so much better than COBOL (but I started with Pl/1) and enough different ways of doing things to keep people happy.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 22, 2011 4:08 am
Reply with quote

I do hope they don't mind, but there is a good example today of the problem with comments, here.

Probably due to site standards, the poor thing is in a debugger, and there are so many comments that there is not a line of procedure code on the screen. And probably more comments on most of the next one, as the para numbers are only up to 1000.

To me, it does not look as though the comments are likely to add a single piece of information beyond what anyone is capable of getting just by looking at the compile listing.

And the code is always right, in the sense it that it dictates what happens. These sort of comments just get in the way.

Code:
z 7 7#all/*#top#del *#z 1 *#all


Ah, now I feel better.

Funny, this is the only standard I've ever fought against. On the other hand, the reason I fought against it is because no-one was following it, so the programs were a mess of "comment blocks" with up to 50% in any given program obviously wrong (just left from the program used as a model). If it had been followed, I'd have gritted my teeth, done a little rexx/kedit thingy (I believe these days they are called Tools) and got on with it.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Jul 22, 2011 9:53 pm
Reply with quote

Susan,
You should keep in mind that this person probably really believes it's true. If they need this level of consistency to make things easier for them, then so be it.

The tough part for me when I first hit this type of thinking was realizing that these programs have to stand the test of time. Almost any standard is good, as long as everyone follows it. It certainly makes things easier when you have to pick up an old program and try to figure it out.
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 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top