Created On:  01 July 2011

Problem:

When running an ACUCOBOL program, can you get the name of the configuration file that was passed to the runtime?

Resolution:

With ACU, there are a number of ways for the runtime to pick up the configuration file that it will use, so it can be useful to get the name of the configuration file that is being used.

The name of the configuration file is stored within the runtime, but is not directly available to the programs in the run unit.

As part of the information that is put into the runtime log file, which is generated by the –lex option, is the name of the configuration file together with the options that were used. The line that holds the configuration file name is of the format:

                 Configuration file = ''

Within a Cobol program it is possible to define a line sequential file and open up the log file to get the name of the configuration file. The configuration file entry will be near the start of the log file, so if you have read more than 10 lines you will have gone past the configuration file entry. You need to be careful that you do not read too many lines into the log file as the runtime has it open and will start generating error lines should you try to read past the end of the file. In this situation you could go into an endless loop.

Attached to  this article is an example program that will get the name of the configuration file from the log file.

Incident #2524366