Previous Topic Next topic Print topic


Format of a Configuration File for .NET COBOL

When a required option to configure the run-time behavior is not available in the IDE, use a .config file to set a run-time tunable in your .NET COBOL applications.

In Visual Studio, add the correct .config file for the type of application you are using; for example:
  • Add an application configuration file (exe.config) for a console application.
  • Add a web configuration file (web.config) for an ASP.NET application.
Note: You do not need to configure the COBCONFIG_ environment variable to point to this file, because the file is part of the application managed at run-time.

When you add the configuration to your .NET COBOL application, the Tunables section group is already declared. Add the section details, using the section details in bold below as an example.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <configSections>
  <sectionGroup name="MicroFocus.COBOL.Application">
   <section name="Switches" type="System.Configuration.NameValueSectionHandler" />
   <section name="Environment" type="System.Configuration.NameValueSectionHandler" />
   <sectionGroup name="Interop">
    <section name="PreLoad" type="System.Configuration.NameValueSectionHandler" /> 
   </sectionGroup>
  </sectionGroup>

  <sectionGroup name="MicroFocus.COBOL.Runtime">
   <section name="Tunables" type="System.Configuration.NameValueSectionHandler" />
   <section name="Switches" type="System.Configuration.NameValueSectionHandler" />
  </sectionGroup>
</configSections>

<MicroFocus.COBOL.Application>
 <Switches></Switches>
 <Environment></Environment>
 <Interop> <PreLoad> </PreLoad> </Interop>
</MicroFocus.COBOL.Application>

 <MicroFocus.COBOL.Runtime>
  <Tunables>
   <add key="printer_redirection" value="true" /> 
   <add key="printer_defaults" value="size=20;font=Courier New" /> 
  </Tunables>
  <Switches></Switches>
 </MicroFocus.COBOL.Runtime>
</configuration>
Previous Topic Next topic Print topic