VS COBOL II Parser

NOTE: You have to download and install GDK first and add $HOME/pkgs/gdk-1.4.4/bin to the environment variable PATH. Not all versions of GDK work together with all versions of the VS COBOL II parser. To be on the safe side use equal version numbers for GDK and the VS COBOL II parser.

Download vscobolii-1.4.4.tar.gz , then unpack and build it with:

gzip -d vscobolii-1.4.4.tar.gz
tar -xf vscobolii-1.4.4.tar
cd vscobolii-1.4.4
./configure
make
make check

The recovered VS COBOL II grammar is the starting point of this project.

Preprocessor

A rudimentary COBOL preprocessor was added recently (in directory vscobolii-1.4.4/cobpre) to make our distribution more self contained. It is however not meant to be complete, we do not have the time to develop a full fledged preprocessor.

Demo

After building the VS COBOL II parser, run a demo with:

cd vscobolii-1.4.4/demos/expand
./expand < ../test.cob.trm

This will result in picture mask expansion and maximum adaptation as show in the table below. You can browse the sources to see how this is implemented.

BeforeAfter
IDENTIFICATION DIVISION.
 PROGRAM-ID. LITTLE-Y2K-TEST.

DATA DIVISION.
 WORKING-STORAGE SECTION.

  01  SEEK-NAME       PIC 99.
  01  OTHER-NAME-1    PIC 99.
  01  OTHER-NAME-2    PIC 99999.
  01  OTHER-NAME-3    PIC 99.

PROCEDURE DIVISION.

 MOVE '20' TO SEEK-NAME.
 MOVE SEEK-NAME TO OTHER-NAME-1.
 MOVE SEEK-NAME TO OTHER-NAME-2.
 IF OTHER-NAME-2 > 99
  DISPLAY "EXCEPTION ENCOUNTERED"
  STOP RUN
 END-IF.
IDENTIFICATION DIVISION.
 PROGRAM-ID. LITTLE-Y2K-TEST.

DATA DIVISION.
 WORKING-STORAGE SECTION.

  01  SEEK-NAME       PIC 999.
  01  OTHER-NAME-1    PIC 999.
  01  OTHER-NAME-2    PIC 99999.
  01  OTHER-NAME-3    PIC 99.

PROCEDURE DIVISION.

 MOVE '20' TO SEEK-NAME.
 MOVE SEEK-NAME TO OTHER-NAME-1.
 MOVE SEEK-NAME TO OTHER-NAME-2.
 IF OTHER-NAME-2 > 299
  DISPLAY "EXCEPTION ENCOUNTERED"
  STOP RUN
 END-IF.

NIST test suite conformance

The parser is currently being tested for conformance to the COBOL85 NIST test suite. The current distribution parses most of the core test sources. The testsuite has been quite helpful for discovering bugs, both in the parser and the preprocessor.

To be able to use the testsuite yourself you need a COBOL compiler, in case you don't have one here is a redistribution nist.tar.gz generated with Tinycobol with default options.

Read the NIST Software Acknowledgment and Redistribution before using the NIST test suite in any form.

SourceForge.net Logo