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:
- system environment variables
- /etc/iscobol.properties
- iscobol.properties located in the user home directory
- iscobol.properties located in the Java Classpath
- -Discobol.conf=ownconfigurationfile or, where applicable, -c ownconfiguration file set at the command line
- $ISCOBOL/iscobol.properties
- -Discobol.* at command line
- -Discobol.remote.conf=remoteconfigurationfile and -c remoteconfigurationfile (set at the client command line in Thin Client environment)
-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:
- 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).
- 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).
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