Highlighted
Absent Member.
Absent Member.
3693 views

mf cobol data file path

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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

View solution in original post

0 Likes
14 Replies
Highlighted
New Member.

RE: mf cobol data file path

Jump to solution

COBPATH perhaps?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: mf cobol data file path

Jump to solution

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?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: mf cobol data file path

Jump to solution

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?.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: mf cobol data file path

Jump to solution

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.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: mf cobol data file path

Jump to solution

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.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: mf cobol data file path

Jump to solution

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?

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: mf cobol data file path

Jump to solution

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.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.