Skip to main content

Problem:

External file mapper (mfextmap) seems not to work in a managed (.NET) application).

Resolution:

1.

MFEXTMAP is not supported in .NET

2.

Use app.config (i.e. set environment variables) instead to avoid having multiple configuration files as in using external file mapping

3.

It may be overwhelming to think of setting each one of the dd names as an environment variable in the project settings, but this can be done outside of Visual Studio. You may want to build your own program or script to import your MFEXTMAP.DAT file into the app.config file

Here is a content of an app.config file:

-----

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <configSections>

    <!--The following code declares a section group for application configuration -->

    <sectionGroup name="MicroFocus.COBOL.Application">

      <section name="Switches" type="System.Configuration.NameValueSectionHandler" />

      <section name="Environment" type="System.Configuration.NameValueSectionHandler" />

    </sectionGroup>

    <!--The following code declares a section group for run-time configuration -->

    <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 />

    <Environment>

      <add key="env-var1" value="C:\\dir1\\file1.dat" />

      <add key="env-var2" value="$variable-name\\file2.dat" />

    </Environment>

  </MicroFocus.COBOL.Application>

</configuration>

-----

As shown above, the dd name can be inserted below <Environment> with the format of <add key="YourDDname" value="YourValue" />.

You may also have an environment variable as part of the value of the key as shown above (see $variable-name).

Old KB# 1483