-
Notifications
You must be signed in to change notification settings - Fork 29
Getting Started
Home -> User Guide ->
This document was last updated on June 8, 2022.
- A Java JRE at level 1.8 or above
- A Cobol compiler (the distribution assumes GnuCOBOL)
Download a Cobol Check distribution archive from the project home page.
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
.
If you wish to create the smallest Cobol Check setup possible, you may remove both Cobol Check scripts and the script inside scripts/
, that is not relevant for your platform. Then to run Cobol Check you can simply write (assuming that the version of Cobol Check is 0.1.0):
Linux and Unix:
java -jar bin/cobol-check-0.1.0.jar -p ALPHA NUMBERS
Windows:
java -jar bin\cobol-check-0.1.0.jar -p ALPHA NUMBERS
Cobol Check will at a later date be able to run without a config.properties
-file. This will make Cobol Check run with default configurations. However, all configuration values do not have a default value yet, so Cobol Check currently depends on the file.
You are free to delete the sample programs that comes with Cobol Check, and you may set your config.properties
so that your source, test and copybooks are placed inside the src-folder, so you won't need the default folder structure:
application.source.directory = src
application.copybook.directory = src
test.suite.directory = src
Note that you will still need the rest of the configuration options. Above is just showing the three configurations you have to change.
Remember that it still is a requirement, that the test is inside a folder, with the same name as the source program.
Do note that the first time you run Cobol Check, it will generate/output a couple of files. There is currently no way to prevent this, so keep in mind that these files will be added to your setup as well.
Here you see an example of the current minimal setup for Cobol Check on Linux/Unix (not including the generated/outputted files):
Cobol-check
| config.properties
|
+---bin
| cobol-check-0.1.0.jar
|
+---scripts
| linux_gnucobol_run_tests
|
+---src
| program.CBL
| copybook.CPY
|
\ program
| test.cut
Run the samples and see if it works.
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.
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.
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.
You can use the samples as a starting point to start building out test suites for your Cobol application.