Skip to Content

What is the recommended method for specifying isCOBOL framework properties?

Estimated Reading Time: 3 Minutes
Question:

From the documentation it seemed that the best or recommended practice is to put all property settings in c:/etc/iscobol.properties. However, with this method it is difficult to maintain different settings for different programs. I have to edit the c:/etc/iscobol.properties file every time I want to switch programs.
What is the recommended solution?

Answer:

Unless iscobol.conf.only is set (or the corresponding command line option -conly is used, where applicable), isCOBOL can use several configurations at the same time. They are loaded in the following order, and the properties they contain are set in the order in which they appear in the respective files:
  1. system environment variables
  2. /etc/iscobol.properties
  3. iscobol.properties located in the user home directory
  4. iscobol.properties located in the Java Classpath
  5. -Discobol.conf=ownconfigurationfile or, where applicable, -c ownconfiguration file set at the command line
  6. $ISCOBOL/iscobol.properties
  7. -Discobol.* at command line
  8. -Discobol.remote.conf=remoteconfigurationfile and -c remoteconfigurationfile (set at the client command line in Thin Client environment)
In addition, you can specify:

-Discobol.conf=class_name

In this case iscobol.properties is loaded from the same directory as class_name

or

-Discobol.conf=http://www.mydomain.com/iscobol.properties

If a property is set in multiple places, isCOBOL will use the last read value.

Veryant recommends putting only the global property settings in c:/etc/iscobol.properties. These are the properties you want all programs for all purposes to use on the machine. It is common practice to put only the iscobol.license property in c:/etc/iscobol.properties.

For other properties there are two methods for reducing confusion:
  1. The safest thing is to only have one iscobol.properties file on your machine, the one in c:etc. Then create property files with different names for different purposes and specify their names on the command line when you run the program (See below for an example).
  2. Have separate object directories for each application. Put the application specific properties in a file named iscobol.properties in the object directory for that application. When you run a program make sure that CLASSPATH does not contain object directories for more than one application program (otherwise only the iscobol.properties file for the first application would be read).
You can specify a properties file on the command line as follows where FILENAME is the name of the properties file and PROGRAM is the name of the program:

iscrun -J-Discobol.conf=FILENAME PROGRAM

or

java -Discobol.conf=FILENAME com.iscobol.rts.Isrun PROGRAM

or simply

java -Discobol.conf=FILENAME PROGRAM

When using the debugger, the properties must be specified after the -d or debugger class name (GraphDebugger).

iscrun -d -Discobol.conf=FILENAME PROGRAM

or

java com.iscobol.debugger.GraphDebugger -Discobol.conf=FILENAME PROGRAM

Notice that the properties file is specified as the value of the iscobol.conf property. You can also specify other properties and "environment" variables for the COBOL program directly on the command line.

For example, to setup your program for remote debugging you could set iscobol.rundebug=2 as follows:

iscrun -J-Discobol.rundebug=2 PROGRAM

or

java -Discobol.rundebug=2 com.iscobol.rts.Isrun PROGRAM

For another example, suppose your program has

ACCEPT ENV FROM ENVIRONMENT "env_var"

You could set env_var on the command line as follows:

iscrun -J-Discobol.env_var=VALUE PROGRAM

or

java -Discobol.env_var=VALUE com.iscobol.rts.Isrun PROGRAM
What is the recommended method for specifying isCOBOL framework properties?