Skip to Content

How do I specify properties or a properties file on the command line?

Estimated Reading Time: 2 Minutes

Question:

With other COBOLs I can specify a configuration file on the command line and runtime configuration variables in the environment.
How do I accomplish this with isCOBOL?

Answer:

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 -c FILENAME PROGRAM
or
   java com.iscobol.invoke.Isrun -c FILENAME PROGRAM
When using the debugger, the properties must be specified after the -d:
   iscrun -d -c FILENAME PROGRAM
or
   java com.iscobol.invoke.Isrun -d -c 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.invoke.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.invoke.Isrun PROGRAM 
If you want to set a property for the debugger itself, such as specifying memory sizes, set it on the java command line before the -d.
The following command sets the memory size for the debugger at 512Mg, and for the program to run in at 3Gb:
   java com.iscobol.invoke.Isrun -Xmx512m -d -Xmx3g -c FILENAME PROGRAM
If you use version 2021R1 or later, you can set any configuration variable in your environment by using underscores instead of periods (because Windows doesn't allow periods in environment variables).
For instance you can set this in your environment:
   Set MYAPP_VAR=Company1
And in your program:
   accept var from environment "myapp.var"

How do I specify properties or a properties file on the command line?

Powered by PHPKB (Knowledge Base Software)