Post by Cydrome LeaderPost by VolkerPost by RichardColumns 1-6 Sequence number, may be left blank
* - line is a comment
- - line is a continuation
D - line is a 'debugging line'
Columns 8-11 Area A
Columns 12-72 Area B
Certain things need to, or can, start in Area A such as labels, and
other things, such as statements, need to start in Area B.
12345678901234567890...
* Sample COBOL program
IDENTIFICATION DIVISION.
PROGRAM-ID. hello.
PROCEDURE DIVISION.
DISPLAY "Hello World!".
STOP RUN.
V.
This works fine. I suspect I did have a tab after moving text around. I'm
fascinated by the BASIC/foxpro like syntax. Perl disgusts me so I guess
this is the language for me learn.
I suggest that you use a programmer' editor such as Gvim. If you specify
syntax checking and subequently you get things in the wrong column then the
editor will color the entire line in red with white print.
Also I suggest you borrow get a good college text on COBOL. Or look in the
manuals that come with a commercial version. I learned COBOL (and FORTRAN
and PL/I) from the self teaching booklets from IBM, the famous "Green
Books. Don't think they are around any more.
One trick: Even though line numbers are no longer required I alwasy start
off from scratch with the folLlowing statements:
123456 IDENTIFICATION DIVISION.
123456 PROGRAM-ID.
This gives a visual guide to the correct placement of things.
Or better, start off with a tamplate program. Just copy the file below that
I call "template.cbl" to another file name. Then expand the copy.
----------------------------------------------------------------
000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. TEMPLATE.
000030 AUTHOR. JOHN CULLETON.
000040 INSTALLATION. WEXFORDPRESS
000045 Eldersburg MD.
000050*REMARKS.
000060* THIS IS A TEMPLATE FOR OPEN COBOL AND HTCOBOL.
000070 ENVIRONMENT DIVISION.
000080
000090 CONFIGURATION SECTION.
000100 SOURCE-COMPUTER.
000110 Linux.
000120 OBJECT-COMPUTER.
000230 Linux.
000140
000150 INPUT-OUTPUT SECTION.
000160 FILE-CONTROL.
000170 SELECT PRINTFILE ASSIGN TO PRINTER.
000180 DATA DIVISION.
000190
000200 FILE SECTION.
000210
000220 WORKING-STORAGE SECTION.
000230
000240 PROCEDURE DIVISION.
000250 001-MAIN-PROCEDURE.
000260 DISPLAY "TEMPLATE".
000270 STOP RUN.
----------------------------------------------
--
John Culleton
Able Indexers and Typesetters