Skip to main content

I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

COBPATH perhaps?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

COBDATA should work to cause the file handler to search the specified directory name for the file you are trying to open provided that the file name does not already have a path specified.

Is this a managed code or native code project and what does your select statement look like? What does your COBPATH look like?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

This is a managed cobol application using rm files

COBDATA is set to the location of the data files

COBPATH is not set since I am not compiling into int, gnt or lbr files.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

This works fine for me even with RM data files.

Is this program part of an .exe or is it in a .dll that is being called? If it is in a .dll and is being called then the app.config file containing COBDATA must be specified for the main executable of the application as app.config will be ignored if it is specified for the .dll project.

Can you show me what the content of COBDATA looks like?.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I have a main c# project that is the entry point for the application. my managed cobol programs are being compiled in to class libraries.

this if from the config file in the cobol project

<add key="COBDATA" value="Z:\\*************\\dataFiles" />

what format should I add COBDATA to the main config?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

Like I said you cannot use an app.config in a Class Library project as it will not be loaded. You would have to add the COBDATA environment variable to the app.config of the C# main program, or set the environment variable prior to starting the application or within the C# program using something like environment.SetEnvironmentVariable, etc.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

should the select statement have quotes in it for the file name?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

should the select statement have quotes in it for the file name?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

should the select statement have quotes in it for the file name?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

The quotes are fine. This does a static assignment to a file named Z-SOMPR-FL that resides on disk.

The problem is in how you are setting COBDATA.

Try setting this in the computers environment to see if your program then works as expected.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

set COBDATA in windows but still nothing, I this seems to be a setting issue more than anything else.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

Which product version are you using? I am testing with 2.3 update 2. It could be that RM data files did not use COBDATA in earlier releases but I would have to do some checking. If I know the version you are using then I can test this.

If you hard code the name "Z:\\FDAMainMenuSolution\\dataFiles\\Z-SOMPR-FL" into the select statement does it find it OK?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

Micro Focus Visual COBOL 2.3 Version 2.3.02187.

I can hard code the file path into the program and it finds the file.


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I have an rm project with COBDATA set and this program can find the data files. Would the project structure make a difference?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I have an rm project with COBDATA set and this program can find the data files. Would the project structure make a difference?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I have an rm project with COBDATA set and this program can find the data files. Would the project structure make a difference?


I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I am not sure what you mean by "rm project". Do you mean a managed console application that generates an .exe file? This should work with the app.config.

I can get this to work in a Class Library project called from C# using the following simple example:

      $set ilsmartlinkage
       program-id. testcobdata as "testcobdata.testcobdata".
      $set filetype"21"
           select test-file assign to "Z-SOMPR-FL"
                            organization is indexed
                            access mode is dynamic
                            record key is key1
                            file status is file-status.
       data division.
       file section.
       fd test-file.
       01 test-record.
          05 key1  pic 9(3).
          05 rest  pic x(20).
       working-storage section.
       01 file-status  pic x(2)  value spaces.
       01 ws-field  pic x(30) value spaces.
       linkage section.
       01 myparams  pic x(20).
       procedure division using myparams.
           display "COBDATA" upon environment-name
           accept ws-field from environment-value
           open input test-file
           display file-status
           goback.


C# main program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace testcsMain
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("In C#");
            Environment.SetEnvironmentVariable("COBDATA", "c:\\\\testcobdata\\\\files");
            testcobdata.testcobdata tc = new testcobdata.testcobdata();
            Myparams param = new Myparams();
            param.Myparams = "from C#";
            tc.testcobdata(param);

        }

I'm trying to set the data file path for an mf cobol project. I've tried setting COBDATA in App.config but that get a fil status 35 on the file. If I move the file to the object code directory the file reads no problem. Is there maybe another variable to set in MF cobol

I set COBDATA like you did and the cobol program found the file.