Re: newbie question on cobol syntax
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx>
- Date: Sun, 22 Apr 2007 23:52:11 GMT
I am surprised by your statement that RM had a problem with the first example -
but it may depend upon the context of the entire COBOL program. (What message
does it give you?)
As far as the Procedure Division goes (different rules for other divisions).
There are requirements that:
A) every procedure-name (header) - paragraph or section name MUST be terminated
by a period (full-stop).
B) There must be a period (full-stop) at the end of each set of procedure
division statements that constitute a procedure, i.e. each paragraph or section
(terminated by another paragraph or section name - or by the end of source
code - or End Program header).
There is a SEMANTIC difference for periods. They end SENTENCES. This is where
a NEXT SENTENCE phrase (or statement - if your compiler has such a statement as
an extension - as Micro Focus does) will "go to". For example.
If Field-1 = A
Next Sentence
Else
Display "Here"
.
Display "There"
.
Gets very different results from
If Field-1 = A
Next Sentence
Else
Display "Here"
Display "There"
.
As far as WHERE you place the period (same line or next) this should make no
difference. HOWEVER, your compiler may follow rules about A-margin/B-Margin (and
columns 1-6). So you need to understand these (if your compiler cares).
P.S. And YES a "Continue" is a very different thing than a "Next Sentence" -
if your compiler allows them both to be used in the same place.
--
Bill Klein
wmklein <at> ix.netcom.com
"Mayer" <mayer.goldberg@xxxxxxxxx> wrote in message
news:1177272149.938765.13260@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello:
I noticed two styles of cobol syntax:
main.
display "hello"
display "goodbye"
stop run
.
vs.
main.
display "hello".
display "goodbye".
stop run.
Some books use the first, others the second. I have no idea what's the
difference between them, but I note the following:
- MF Cobol/DOS allows both
- RM Cobol/DOS allows only the second, i.e., requires a period at the
end of each statement.
Can someone please explain to me the function of the period in cobol,
what is the basis for the difference in syntax, and what is
recommended.
Thanks,
Mayer
.
- Follow-Ups:
- Re: newbie question on cobol syntax
- From: Howard Brazee
- Re: newbie question on cobol syntax
- References:
- newbie question on cobol syntax
- From: Mayer
- newbie question on cobol syntax
- Prev by Date: Re: newbie question on cobol syntax
- Next by Date: Re: newbie question on cobol syntax
- Previous by thread: Re: newbie question on cobol syntax
- Next by thread: Re: newbie question on cobol syntax
- Index(es):
Relevant Pages
|