Follow

Using Elastic COBOL from a Command Line Console

Overview

To use the Elastic COBOL compiler and runtime within a command console, it is necessary to set up your PATH (to locate the compiler) and CLASSPATH (to locate the runtime Java libraries).

Your PATH should look similar to:

$ echo $PATH

[...your other PATH env vars...]:/c/users/bradpitt/Elastic COBOL/plugins/com.heirloomcomputing.ecd.core_YY.MM.DD/elastic_cobol/bin/win64/x86_64

The above is a 64-bti Windows example. If you are on 32-bit Windows or Linux, check the elastic_cobol/bin location for the right path to the compiler.

Your CLASSPATH should look similar to:

$ echo $CLASSPATH

.:/c/users/bradpitt/Elastic COBOL/plugins/com.heirloomcomputing.ecd.core_YY.MM.DD/elastic_cobol/ecobol.jar:/c/users/bradpitt/Elastic COBOL/plugins/com.heirloomcomputing.ecd.core_YY.MM.DD/elastic_cobol/etrans.jar

Once both of these have been setup, you can compile/execute programs from the command line:

$ ls

ShowParams.java calljava.cbl

$ ecobol calljava.cbl ShowParams.java

Elastic COBOL V14.11.2 Copyright (C) 2010-2014 Heirloom Computing
LOC: 56 (10 variables in 6 records)
Warnings: 0
Errors: 0
Result: Compilation SUCCESSFUL
Building: Class files

$ ls *.class

ShowParams.class calljava$Wrk.class calljava.class

$ java calljava

Parameter 0: (passed by reference)
Datatype: text='hello ', type='TEXT SIGN-NONE'

Parameter 1: (passed by reference)
Datatype: text='12345', type='ZONED SIGN-NONE JUSTIFIED'

Parameter 2: (passed by reference)
Datatype: text='678.90', type='TEXT SIGN-NONE JUSTIFIED'

[...snip...]

You can list the Elastic COBOL directives by entering 'ecobol -help'.

You can find a full list of Elastic COBOL compiler directives and runtime options here.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk