Elastic COBOL is distributed as an Eclipse plug-in and as such, the actual compiler and the runtime-jars are within one of the plug-in modules. However, you can set up Elastic COBOL to run in a command-line mode for inclusion in software building tools such as make, ant or maven.
You can set up symbolic links, shell or bat commands, or command aliases to point to the various compile- and run-time components.
- Compiler: $EC_HOME/plugins/com.heirloomcomputing.ecd.core_version/elastic_cobol/bin/system/arch/ecobol
- Runtime: $EC_HOME/plugins/com.heirloomcomputing.ecd.core_version/elastic_cobol/ecobol.jar
- ETP Runtime: $EC_HOME/plugins/com.heirloomcomputing.ecd.core_version/elastic_cobol/etrans.jar
substituting the following:
- $EC_HOME: the Eclipse installation directory, e.g., /usr/local/eclipse or c:\eclipse
- version: the compiler version, e.g., 12.8.10
- system: the operating system, e.g. windows or linux
- arch: the hardware architecture, e.g., x86 or x86_64
The Elastic COBOL compiler will also run the Java compiler by default after Java source is created. The Java compiler must be in the execution path and supply the Java runtime libraries as part of a classpath. See ecobol Options for detailed explanation of ecobol command line arguments.
Below is a shell script that works on Windows (under MinGW) and Linux/UNIX to set up these as command aliases.
- ecc -- Elastic COBOL Compiler
- ecr -- Elastic COBOL Runtime
- ecd -- Elastic COBOL Developer (Eclipse)
Because these drivers are set up as aliases, they can be used in a shell script but they will NOT work in a makefile.
To use the script, you need the following environment variables to be setup:
- JAVA_HOME (e.g. /c/Program Files/Java/jdk1.6.0_30)
- PATH needs to include $JAVA_HOME/bin
- EC_HOME needs to be set to the install directory for Eclipse (e.g. /c/eclipse)
$ cat > bin.sh
#These are generic alias drivers to run EC from the command-line
[ $# -ne 1 ] && echo "usage: bin.sh YY.MM.DD" && return
[ "$EC_HOME".x = .x ] && echo EC_HOME not set && return
[ ! -f "$ech"/ecobol.jar ] && echo EC_HOME is not set to a valid Elastic COBOL install && return
[ ! -f "$JAVA_HOME"/bin/javac ] && echo JAVA_HOME is not set to a valid JDK install && return
ech_tmp=`echo "$ech" | sed -e 's:\ :\\\ :g'`
ecd_tmp=`echo "$EC_HOME" | sed -e 's:\ :\\\ :g'`
alias ecc="$ech_tmp/bin/*/*/ecobol -cp .:$ech_tmp/ecobol.jar:$ech_tmp/etrans.jar"
alias ecr="java -cp .:$ech_tmp/ecobol.jar:$ech_tmp/etrans.jar"
$ source bin.sh YY.MM.DD <--replace YY.MM.DD with EC's version number
$ ecc -h
Elastic COBOL 12.8.10 (Build Aug 14 2012 17:15:24)
Copyright (C) 2010-2012 Heirloom Computing
Elastic COBOL Simple-Style Compiler Options
Use -help or -help:old for expanded list
usage: ecc [ -option [ param ] ] file(s)
-d Produce listing file & runtime debug info
-p Set COPY library path to parameter
-x Compile and execute (first program in list)
-c Check COBOL syntax (no output)
-t Compile EXEC TRANSACTION constructs
-w Suppress info/warning messages
-v Verbose compilation
To compile and execute myprog.cbl:
$ ecc myprog
$ ecr myprog
If you want to use the drivers in a shell script you must execute the shell like this:
$ source myscript.sh