The COBOL standards?
-
- Registered Member
- Posts: 26
- Joined: Thu Nov 21, 2013 3:25 pm
The COBOL standards?
Hi,
Are there some COBOL standards for coding? What are they,is there some good guidance on them? Please let me know.
Are there some COBOL standards for coding? What are they,is there some good guidance on them? Please let me know.
Re: The COBOL standards?
Use the same standards as you would for any other programming language remembering that your in-house standards, no matter what they are, override all others.
Regards
Nic
Nic
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: The COBOL standards?
There are many rules - some might be very general in nature a programmer should always follow as suggested by Nic and there are others which are more popular with in your company. (Popular is not always right though.) Some of the rules which comes to mind are listed below, in no-chronological order though:
- IDENTIFICATION DIVISION of any COBOL program must contain at least the program name. But it can have some of the follosing to make it more meaningful:
- AUTHOR - we will know who to blame when things go wrong! Yeah!?
- DATE-WRITTEN - this gives us the age of the original version. And you can boast in the glory to disrupt a program written before you were born.
- DATE-COMPILED - this is automatically inserted by the COBOL compiler, and shows the age of the current version of this program.
- Program function - It should tell about the purpose of the program and/or if it is a stand-alone program, or part of a suite of programs? When is it run?
- Database access - what databases are used, and in what modes?
- Amendment history - each time a program is changed you should insert a note giving the amendment date, a brief description of the amendment, plus your name.
- INPUT FILES. List the internal name for each file used as input, followed by its disk file name and the sort sequence (if any) of the file.
- OUTPUT FILES. List the internal name for each file used for output, followed by its disk file name and the sort sequence (if any) of the file.
- AUTHOR - we will know who to blame when things go wrong! Yeah!?
- Have a good record structure and PICTURE clauses must be vertically aligned in the program: For example, this (reference taken from A J Marston document)
is much better than this structure:Code: Select all
01 RECORD-NAME. 05 DATA-NAME-1-ALPHA PIC X(2). 05 DATA-NAME-2. 10 DATA-NAME-3-NUMERIC PIC 99. 10 DATA-NAME-4. 15 DATA-NAME-5-ALPHA PIC X(2). 15 DATA-NAME-6-NUMERIC PIC 9(5). 05 DATA-NAME-7-ALPHA PIC X(6).
Code: Select all
01 RECORD-NAME. 02 DATA-NAME-1-ALPHA PIC X(2). 02 DATA-NAME-2. 03 DATA-NAME-3-NUMERIC PIC 99. 03 DATA-NAME-4. 04 DATA-NAME-5-ALPHA PIC X(2). 04 DATA-NAME-6-NUMERIC PIC 9(5). 02 DATA-NAME-7-ALPHA PIC X(6).
- Use meaningful paragraph and section names.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: The COBOL standards?
Not a very useful document. Written in 1984, updated last in 1993. Odd things in it.
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: The COBOL standards?
Agree, that's why I did not link it to directly, though still wanted to give some food for thought to the topic author to get started...
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- Registered Member
- Posts: 26
- Joined: Thu Nov 21, 2013 3:25 pm
Re: The COBOL standards?
Thanks Anuj and William for the guidance. Have been struggling it personal life, could not log in to Forums often.
- Anuj Dhawan
- Founder
- Posts: 2824
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: The COBOL standards?
Go easy - life has different plan at times.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute