Overview
If you need to set compiler directives outside of your project properties (within the Elastic COBOL IDE), you can use a text sidefile to do this (the default name of this sidefile is ecobol.dir). The sidefile can be used as an alternative to the project properties settings within the IDE and/or outside of the IDE (for example within a command console).
Within the IDE
In this example, the 'account' project has syntax errors because it needs to reference a copybook that is not in the default 'copylib' folder -- the required copybook is in the 'copylib-gen' folder.
We are going to create an ecobol.dir file and place it the project's 'resources' folder.
- Right click on 'resources' > New > Other > General > File > Next
- Enter ecobol.dir in the 'File name' text box > Finish
An editor will automatically open for the ecobol.dir file. We are going to add a compiler directive to ecobol.dir to instruct the compiler to look in an additional location for copybooks. The directive is:
$set directive "-source:copylib %WORKSPACE_LOC%/account/copylib-gen"
NOTE: It is also possible to set directives for specific programs. The syntax for doing so looks like this:
$set pgm-directive myProgram.cbl "-source:copylib %WORKSPACE_LOC%/account/copylib-gen"
NOTE: The %WORKSPACE_LOC% is a variable that points to the root location of your workspace.
Next, we need to save the ecobol.dir file (click the 'Save' icon on the toolbar or Ctrl/S), and rebuild the project (from the menu, Project > Clean > Clean all projects > OK).
This resolves the syntax errors because the project now successfully locates the required copybook in 'copylib-gen'.
Within a Command Console
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
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
If we look at the physical file system for the project above (as an example), it will look something like:
$ ls
cobol_source copylib-gen java_source resources copylib intermediate_java_code
listing workdir
$ cd cobol_source
We are going to compile one of the programs within the 'cobol_source' directory.
If we compile ACCT00.cbl (which has a dependency on a copybook in the 'copylib-gen' directory), we get:
$ ecobol ACCT00.cbl
Elastic COBOL VYY.MM.DD Copyright (C) 2010-2014 Heirloom Computing
ACCT00.cbl 12: (Col 7) EC1044E Could not open copy library 'ACCTSET'.
ACCT00.cbl 24: (Col 16) EC9010E Cannot find implicit map data structure 'acctmnuo'.
ACCT00.cbl 27: (Col 16) EC1066E EXEC CICS requires -out:transaction compiler option.
LOC: 27 (0 variables in 0 records)
Warnings: 0 Errors: 3 Result:
Compilation FAILED
To correct the errors, we will create an ecobol.dir file that contains the following:
$set directive "-out:transaction"
$set directive "-source:copylib ../copylib-gen"
Now when we compile ACCT00.cbl, we get:
$ ecobol ACCT00.cbl
Elastic COBOL V14.11.2 Copyright (C) 2010-2014 Heirloom Computing
LOC: 661 (678 variables in 12 records)
Warnings: 0
Errors: 0
Result: Compilation SUCCESSFUL
Building: Class files
The compiler will look for an ecobol.dir file in the current directory.
You can also instruct the compiler to look for ecobol.dir in a different location, as well as look for a directives file that has a different name to ecobol.dir -- see the "ecobol options" article for more information.
0 Comments