Debugging .NET COBOL Using RM/COBOL Indexed Files

When you debug a .NET COBOL application, there is a danger that an RM/COBOL indexed file will become corrupted when debugging ends, as the file is not closed correctly by default.

To ensure the file is closed correctly when debugging ends, you should set the RMFM_PRETEND_FORCE_CLOSED=YES environment variable. For .NET COBOL applications, it is not strictly necessary to set this variable, as the File Handler can usually close the file correctly, although, setting this variable will ensure any data file is always closed correctly.

  1. In Solution Explorer, right-click project-name and select Add > New Item.
  2. In the Add New Item dialog box, select Application Configuration File, update the Name field (if required), then click Add.

    The application file is added to the project.

  3. In Solution Explorer, right-click the file, then select Edit.

    The Application Settings dialog box appears.

  4. On the Environment tab, enter the following, then click Set:
    • Name: RMFM_PRETEND_FORCE_CLOSED
    • Value: YES
  5. Click OK.
  6. Rebuild and then debug your project.