Re: newbie question on cobol syntax



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



.



Relevant Pages

  • Re: Non-Cobol person getting error code
    ... I neither do have a COBOL ... can then do an informative error display. ... because you have locked yourself in to the DECLARATIVES SECTION ... If it's OO then I invoke the FileErrors ...
    (comp.lang.cobol)
  • Re: simple compression routine
    ... I don't want to link to external routines, just do it with COBOL code. ... char-value pic 9value 0. ... display 9-byte space 8-byte-value ... ABCDEFGHI ...
    (comp.lang.cobol)
  • Re: Web GUI for Text COBOL Apps.
    ... When you say PICK COBOL, do you mean the one from the old PICK ... RM-COBOL and its offshoots use the DISPLAY and ACCEPT verbs ... The IBM 5250 data stream expects ... transmission to signal the middle layer to do the output; ...
    (comp.sys.ibm.as400.misc)
  • Re: OO COBOL - What if ???
    ... understood how EXHIBIT was supposed to be better than DISPLAY - I guess I was just late to the game. ... Yes, I removed them when I converted programs from COBOL 74 to COBOL 85, but it was trivial, IMO. ... Micro Focus still has EXHIBIT .. ... I know, more verbose, but a guy in our shop wrote a SlickEdit macro that did the conversion like that. ...
    (comp.lang.cobol)
  • Re: cobol array editing output
    ... I am using Cobol Fujitsu V3 compiler. ... > I am trying to diplay information which I have taken in to an array ... > When I display these variables there is large gaps between both names. ... operator's console, and the screen section has a screen window. ...
    (comp.lang.cobol)