Identification division



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Identification division

Postby gowthamgyaa » Tue Oct 16, 2012 7:27 pm

Hi everyone,
why should it have a period(dot) after the program ID, with my knowledge i think period states for End.


Kind regards
gyaa
gowthamgyaa
 
Posts: 101
Joined: Wed Sep 05, 2012 11:18 pm
Has thanked: 67 times
Been thanked: 0 time

Re: Identification division

Postby Akatsukami » Tue Oct 16, 2012 7:29 pm

And is that not the end of the program ID?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
gowthamgyaa (Tue Oct 16, 2012 8:15 pm)
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Identification division

Postby Robert Sample » Tue Oct 16, 2012 8:03 pm

There is a link to IBM Manuals at the top of this page. I STRONGLY recommend you find the COBOL Language Reference manual and read it cover to cover. If you do this, you will find in section 1.4.1 this (emphasis added):
Period {.b},
Comma {,b}, Semicolon {;b} A separator comma is composed of a comma followed by a space. A separator period is composed of a period followed by a space. A separator semicolon is composed of a semicolon followed by a space.

The separator period must be used only to indicate the end of a sentence, or as shown in formats. The separator comma and separator semicolon can be used anywhere the separator space is used.

In the identification division, each paragraph must end with a separator period.
In the environment division, the SOURCE-COMPUTER, OBJECT-COMPUTER, SPECIAL-NAMES, and I-O-CONTROL paragraphs must each end with a separator period. In the FILE-CONTROL paragraph, each file-control entry must end with a separator period.

In the data division, file (FD), sort/merge file (SD), and data description entries must each end with a separator period.

In the procedure division, separator commas or separator semicolons can separate statements within a sentence and operands within a statement. Each sentence and each procedure must end with a separator period.
So the answer to your question is, "because COBOL syntax requires the period after the program name" -- end of discussion.

These users thanked the author Robert Sample for the post:
gowthamgyaa (Tue Oct 16, 2012 8:14 pm)
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Identification division

Postby blackswan » Tue Oct 23, 2012 3:03 pm

Hi gowthamgyaa,

In COBOL each sentence and statements are ended with a period. So programs Id is a statement.

regards

These users thanked the author blackswan for the post:
gowthamgyaa (Tue Oct 23, 2012 7:07 pm)
blackswan
 
Posts: 13
Joined: Thu Sep 13, 2012 2:39 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Identification division

Postby BillyBoyo » Tue Oct 23, 2012 3:14 pm

Let's not go "over the top" on this.

In "modern" Cobol (from Cobol II onwards) fullstops/periods in the PROCEDURE DIVISION have decreased in necessity. As long as an "end construct" (END-IF, END-READ, etc) is used whenever there is a condition (IF, AT END, etc) then the only fullstops/periods you need are for the PROCEDURE DIVISION itself, the end of paragraphs/sections and the end of the program (if there are no paragraphs/sections).

Using periods/fullstops makes it more difficult to "move code around" with the editor, as it becomes easy to accidently get a fullstop/period where it should not be (like "inside" an IF).

Prior to the PROCEDURE DIVISION, you still need all the ones you used to need. They denote "end of the bit I've just written", not any sort of END with capital letters.

These users thanked the author BillyBoyo for the post:
gowthamgyaa (Tue Oct 23, 2012 7:07 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post