Page 1 of 1

Identification division

PostPosted: Tue Oct 16, 2012 7:27 pm
by gowthamgyaa
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

Re: Identification division

PostPosted: Tue Oct 16, 2012 7:29 pm
by Akatsukami
And is that not the end of the program ID?

Re: Identification division

PostPosted: Tue Oct 16, 2012 8:03 pm
by Robert Sample
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.

Re: Identification division

PostPosted: Tue Oct 23, 2012 3:03 pm
by blackswan
Hi gowthamgyaa,

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

regards

Re: Identification division

PostPosted: Tue Oct 23, 2012 3:14 pm
by BillyBoyo
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.