What is the recommended method for specifying isCOBOL framework properties?
Question ID : 3
Created on 2009-08-28 at 12:03 PM
Author : Veryant Support [email@example.com]
Online URL : http://support.veryant.com/support/phpkb/question.php?ID=3
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?
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:
In addition, you can specify:
- system environment variables
- 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
- -Discobol.* at command line
- -Discobol.remote.conf=remoteconfigurationfile and -c remoteconfigurationfile (set at the client command line in Thin Client environment)
In this case iscobol.properties is loaded from the same directory as class_name
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:
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:
- 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
java -Discobol.conf=FILENAME com.iscobol.rts.Isrun PROGRAM
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
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
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
java -Discobol.env_var=VALUE com.iscobol.rts.Isrun PROGRAM
Back to Original Question