You can specify how your native COBOL application should be run, by specifying the required settings in an application configuration file.
Restriction: The following applies to native code only.
The application configuration file has a
.config extension, and you can specify the following in it:
- Environment variables - these set or modify the environment that is required for your native COBOL applications
- COBOL switches - the COBOL programmable switches (numbered from 0 to 8) must be defined using a condition name in the special-names paragraph in your program. Then you set the switches on and off when your app is started. Their state can be read by your application at any time when it is running.
- Run-time configuration settings - you can specify settings such as the search order for called programs, command line handling and file handling options, and input/output settings. See
Run-time configuration settings available in the IDE for descriptions of these settings.
You can add an application configuration file to your project as follows:
- In Solution Explorer, right-click your project.
- Click
Add > New Item.
- Select
Application Configuration File.
- Specify a filename in the
Name field.
- Click
OK.
To set run-time configuration settings in the application configuration file:
- In Solution Explorer, right-click the application configuration file in the project, and click
Open.
By default, an application configuration file has a
.config extension. If the file does not exist, add one for the project - see
Related information.
- On the
Environment tab, type a variable name and its value in the
Name and
Value fields, and click
Set.
- On the
COBOL Switches tab, check the switches you require.
- On the
Run-time Configuration tab, configure settings such as the search order for called programs, command line handling and file handling options, and input/output settings.
- Click
OK.
You can add an application configuration file for all types of native projects except for Mainframe Subsystem Applications. This is because under Enterprise Server you configure the environment in a different way. You specify them either on the MFDS region configuration page or from the command line environment if you start Enterprise Server from the command line.
If you run your application outside of the IDE, you need to set the environment variable COBCONFIG.BLOCK to the location of the application configuration file in order for the switches and environment variables set for the application to be applied.
When you build an executable within Visual Studio, the build process automatically copies the application configuration file into the output folder and renames it to
<executable-base-name>.exe.mfgcf.
The run-time system automatically applies the settings included in the file without the need to set the COBCONFIG.BLOCK environment variable. If COBCONFIG.BLOCK is already set, it takes precedence over the settings specified in the
.exe.mfgcf file.