How to dynamically set a filename at runtime

For example, let's say the COBOL filename is MYFILE1.  The mapping can be provided at runtime by passing "-DMYFILE1=myfile.dat".

Within the IDE this can be set by doing the following:

1) Set the COBOL Compiler property:

a) right-click on the COBOL project

b) select Properties

c) select "COBOL Compiler Settings"

d) in "Additional Parameters" enter "-source:assignenv"

e) click OK

 2) Specify a runtime setting or set up a cbldonfig file for use at runtime:

To specify a runtime setting for the filename:

a) right-click on the program to be executed

b) select "Run As"

c) select "Run Configurations"

d) select the COBOL program under COBOL Applications on the left side of the window

e) select the Runtime tab

f) deselect "Use global runtime execution settings" and add "-DMYFILE1=myfile.dat" to "Additional Options:".  

g) Click Apply

To specify a cblconfig file for use at runtime:

a)  create a "cblconfig" (no file extension) file and place it in the "resource" folder of the project.  The "cblconfig" file should have an entry like: MYFILE1=myfile.dat

Outside of the IDE, this would be accomplished by using the export wizard and invoking the application from the command line. After export, the app would be invoked with a command similar to:

java -DMYFILE1=myfile.dat myapp.jar

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk