Skip to content

Getting Started

dakaa16 edited this page Jun 8, 2022 · 26 revisions

Home -> User Guide ->

This document was last updated on February 25, 2021.

Prerequisites

  • A Java JRE at level 1.8 or above
  • A Cobol compiler (the distribution assumes GnuCOBOL)

Download

Download a Cobol Check distribution archive from the project home page.

Unpack

Distributions are in zip format. Use any zip utility to unpack the file. Here's an example for Linux systems:

cd [your-project-root]
unzip cobol-check-0.1.0.zip 

Here's the output from an actual unzip on a Linux system:

neopragma@mint21:~/projects/cobol-check-user$ unzip cobol-check-0.0.0-2.zip 
Archive:  cobol-check-0.0.0-2.zip
   creating: scripts/
  inflating: scripts/linux_gnucobol_run_tests  
  inflating: cobolcheck              
  inflating: config.properties       
   creating: src/
   creating: src/test/
   creating: src/test/cobol/
   creating: src/test/cobol/ALPHA/
  inflating: src/test/cobol/ALPHA/AlphaExpectationsTest  
   creating: src/test/cobol/NUMBERS/
  inflating: src/test/cobol/NUMBERS/SymbolicRelationsTest  
   creating: src/main/
   creating: src/main/cobol/
   creating: src/main/cobol/ALPHA/
  inflating: src/main/cobol/ALPHA/ALPHA.CBL  
   creating: src/main/cobol/NUMBERS/
  inflating: src/main/cobol/NUMBERS/NUMBERS.CBL  
   creating: bin/
  inflating: bin/cobol-check-0.0.0.jar  
neopragma@mint21:~/projects/cobol-check-user$ 

This creates the Default Directory Structure and places the following files there:

  • The Cobol Check shell script, cobolcheck
  • The Cobol Check configuration file, config.properties
  • The executable jar, bin/cobol-check-[version].jar
  • Sample Cobol programs in src/main/cobol
  • Sample test suites in src/test/cobol
  • A script that Cobol Check uses to compile and run test programs, in scripts/linux_gnucobol_run_tests.

Verify

Run the samples and see if it works.

All platforms

If you are using a different Cobol compiler than GnuCOBOL, change the script under scripts/ for your platform accordingly. For instance, if your employer/client is using Micro Focus products, you might have access to COBOL-IT or a development environment that bundles it. It makes sense to use the same compiler with Cobol Check as you use for Cobol development. In principle, any Cobol compiler that can be invoked from the command line will work.

Linux and Unix

This includes Apple OSX and Windows Subsystem for Linux (WSL).

Run the samples:

./cobolcheck -p ALPHA NUMBERS 

If everything is installed correctly, you will see test results on stdout.

Windows

If you installed GnuCOBOL as described here, then the directory where GnuCOBOL was installed is on your Path. When you open a command-line window to run Cobol Check, you must run the script that sets environment variables in that shell before you run Cobol Check.

Installed in this way, Cobol Check runs under minGW using scripts developed by Keisuke Nishida, Roger While, Ron Norman, Simon Sobbisch, and Edward Hart. They ask users to run GnuCOBOL from within the installation directory. It's a clever, but hacky way to make something run on Windows that was never designed to run on Windows.

To set up Cobol Check to run from within the root directory of your Cobol project, you have to set the same environment variables as they use in their scripts.

Run this first:

[path-to-gnucobol-installation]\set_env.cmd 

Note: If you are not admin on your system you need to add the following system environment variable:

COB_CONFIG_DIR = [path-to-gnucobol-installation]\config 

You also need to add the following to your Path variable:

COB_CONFIG_DIR = [path-to-gnucobol-installation]\bin 

You will have to restart for these changes to take effect

Now run Cobol Check to see if it handles the sample programs properly:

cobolcheck.cmd -p ALPHA NUMBERS 

If everything is installed correctly, you will see test results on stdout.

If you see

configuration error 
default.conf: No such file or directory 

it means the environment variables have not been set.

Write tests

You can use the samples as a starting point to start building out test suites for your Cobol application.

Clone this wiki locally