Highlighted
Absent Member.
Absent Member.
1646 views

COBDATA question

I'm running Micro Focus Enterprise Developer and can't seem to get it to recognize the directory where all my data files(.dat) are. I'm running a PowerShell script that sets up an environment variable, i.e.;

$env:dd_MYFILE = "MYFILE.dat"

In the script I also try to set COBDATA, before running the batch program,i.e.;

[Environment]::SetEnvironmentVariable("COBDATA", "c:\data", "User")

Then I run the batch program that opens this file but am getting an error 35 in the file status after the open. In the COBOL, the select looks like:

SELECT MYFILE         ASSIGN TO "MYFILE"

                                       ORGANIZATION IS INDEXED

If I change the PowerShell script to the full path, i.e.;

$env:dd_MYFILE = "c:\data\MYFILE.dat"

then the file opens successfully.

For Visual COBOL is there a different way to specify data file locations?

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: COBDATA question

The problem is that when you are assigning the file to an environment variable as in dd_MYFILE then it will not search the location specified in COBDATA.

It instead expects you to provide the complete path name including the filename within dd_MYFILE.

If you assign to just the actual filename in the select assign instead of to an environment variable then it will search COBDATA.

Example:

    SELECT MYFILE ASSIGN TO "MYFILE.dat"

                                       ORGANIZATION IS INDEXED

and COBDATA is set to c:\data then it will combine them and look for c:\data\myfile.dat

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: COBDATA question

So is there no way to combine an environment variable with COBDATA?

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.