0

The following code :

IDENTIFICATION DIVISION.
PROGRAM-ID. tester.

PROCEDURE DIVISION.
greet_program.
   DISPLAY "HELLO WORLD !".
STOP RUN.

produces a compiler error which says : Error: syntax error, unexpected WORD, expecting PROGRAM_ID

I am unable to spot the error. Where is it ?

The errors with the program are listed here at ideone

saplingPro
  • 20,769
  • 53
  • 137
  • 195

1 Answers1

3

You are compiling using the option of a traditional "fixed" Cobol layout.

That means you need to start each line with seven blanks.

You should have asked yourself why the first error messages referred to column seven. You could also have found some sample Cobol cobde and compare it to yours. Other people you can find with Google who've done the same thing.

Bill Woodger
  • 12,968
  • 4
  • 38
  • 47
  • Oh ! thank you.I am new to cobol and this was my first program,so didn't understand it. – saplingPro Feb 05 '13 at 06:50
  • You can compile with "freeformat" which doesn't require the traditional fixed-positions of Area A (8-11) and Area B (12-71). Check on the -free compiler option. – Bill Woodger Feb 05 '13 at 06:58