View previous topic :: View next topic |
Author |
Message |
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sat Aug 30, 2014 4:03 am Post subject: COBOL shop standards |
|
|
Just interested in a non-scientific "finger in the sky" feeling for what coding standards are out there.
For examples, 2 questions.
1) How many shops use/allow mixed-case coding and how many demand only upper-case
2) How many use perform on a section compared to perform xxxxx through yyyyy
Just curious _________________ Michael |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sat Aug 30, 2014 11:08 pm Post subject: |
|
|
misi01,
AFAIK
1. Except for the comments everything is in Upper-case. Exception was a case where you need to replace the lower-case strings to upper-case.
2. PERFORM section and if it was PERFORM xxx thru yyyy then the compiler option SSRANGE option was turned on to catch all the out of subscript range errors in the development region and production code did not have the SSRANGE. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Sun Aug 31, 2014 5:17 am Post subject: It'a always fascinated me (upper-case) |
|
|
I have a theory and it goes like this.
Everyone writes in UC only because everyone else does. Why?
I remember when I first started working, there was actually a punch machine and programmers sent their code on a form to be punched onto cards (remember, we're talking the 70's here). It follows (?) from that, that the punch operators didn't bother switching in and out of UC since that would have been more work than it was worth. From that comes the "standard" that all code is written in UC because "that's how we've always done it".
I find the idea rather strange. How about I write this append IN ALL UC, WOULD THAT MAKE IT EASIER TO READ (etc etc). Since the ability is there to write mixed code, why do shops STILL continue to write in UC only ? _________________ Michael |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Sun Aug 31, 2014 10:26 am Post subject: |
|
|
In early days lower case did not exist - sweeping statement and I cannot verify it. However, early COBOL, don't know about PL/1, HAD to be in upper case. JCL still has to be in upper case. Probably all to do with limited memory available so you did not waste code checking case. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Sun Aug 31, 2014 12:24 pm Post subject: |
|
|
These days cOBOL source can be written in lower-case, mixed-case or upper-case. However, as far as the CoBOL compiler is concerned, everything is processed in upper-case only. "Folding" is the technical term, and CObOL source is "folded" by the COBoL compiler.
This means that if I'd defined a data-name as:
Then the definition would actually refer to COBOL , as would all the above references I typed.
I think people mostly code in upper-case, because people mostly code in upper-case, as you say.
These days I PERFORM paragraph-name. If I PERFORM section-name then I ensure the SECTION contains no paragraphs |
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
|
Posted: Mon Sep 01, 2014 6:43 am Post subject: the joke of it all here at work is.... |
|
|
Most programmers follow the "I write in uc because everyone else does and that's the standard" (the standard being to go baaaaaa and follow other sheep). At the same time we have a naming convention that uc's the first letter of any "word" but has the others characters in lc. For example, a field called Effective Date becomes EffDat. Now, how's that for consistency ???? _________________ Michael |
|
Back to top |
|
|
t-bonham@scc.net Supermod
Joined: 18 Oct 2012 Posts: 30 Topics: 0 Location: Minneapolis, MN
|
Posted: Mon Sep 01, 2014 5:42 pm Post subject: |
|
|
William Collins wrote: | This means that if I'd defined a data-name as:
Then the definition would actually refer to COBOL , as would all the above references I typed. | Actually, I think that would cause an error message -- "cobol" is a reserved word. |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Tue Sep 02, 2014 1:36 am Post subject: |
|
|
I thought that too, until I tried it
I'm pretty much 100% certain it was reserved with older compilers, but then maybe it wasn't, maybe just an urban myth... |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Tue Sep 02, 2014 5:02 am Post subject: |
|
|
Seems it was "reserved", and even is reserved. However, using it as a data-name is entirely unproblematic for some reason. According to the Enterprise COBOL Language Reference, should get an S message.
I can find a "defined by American National Standard COBOL but not used by this compiler" for a very old COBOL.
So, it is reserved, but its use does not cause a diagnostic message. A "feature" I guess, and no come-back with IBM if you use it and hen a future release does as well. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Sep 02, 2014 10:44 am Post subject: Re: the joke of it all here at work is.... |
|
|
misi01 wrote: | Most programmers follow the "I write in uc because everyone else does and that's the standard" (the standard being to go baaaaaa and follow other sheep). At the same time we have a naming convention that uc's the first letter of any "word" but has the others characters in lc. For example, a field called Effective Date becomes EffDat. Now, how's that for consistency ???? |
misi01,
I don't think it is herd mentality that caused everyone to code in upper case. To date JCL only supports Upper case, So having everything in upper case is like a standard that works every where. Having mixed case is good for reading but for coding it doesn't seem to fit especially with capitalizing the first alphabet in a sentence/word. _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|