Highlighted
Valued Contributor.
Valued Contributor.
2172 views

Setting directory path in Visual Cobol for .NET

Jump to solution

Is there a way in Visual Cobol for .NET to specify a directory path somewhere in the project properties?

As an example, we have a copybook in a program as follows:

K:EMPESLCT.WS

The K: drive on our server houses all of our source code and copybooks and each 'project' has its own sub-folder on the K: drive.

In our old command line version of MF we would run a batch file for each individual project that would change to the appropriate directory:

ex:  

K:

cd\source\proj1\

Now we would launch the old workbench from K:\source\proj1\ and any reference in our programs to K: would be fine. 

If I import this old code into Visual Cobol for .NET how do I tell the environment that any reference to K: should really be K:\source\proj1 ?

When I am trying to compile any of my programs I am getting 'Unknown Copybook' errors because it is looking in the root of K: instead of K:\source\proj1

Hopefully this hasn't been too convoluted!  

Thanks

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Setting directory path in Visual Cobol for .NET

Jump to solution

Hi Chris,

You should be able to add the folder in which the copybook is actually located to the Dependency Path tab of the project properties and it should find the copybook even if it is referenced in the program with the E: in the name.

I just tested this here by placing copybook named copyfile1.ws into the folder E:\mycopys.

In my program I have the following:

copy "E:copyfile1.ws".

On the dependency path tab I added the folder e:\mycopys and when I compile everything is found without a problem.

Thanks

View solution in original post

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Setting directory path in Visual Cobol for .NET

Jump to solution

Hi Chris,

You should be able to add the folder in which the copybook is actually located to the Dependency Path tab of the project properties and it should find the copybook even if it is referenced in the program with the E: in the name.

I just tested this here by placing copybook named copyfile1.ws into the folder E:\mycopys.

In my program I have the following:

copy "E:copyfile1.ws".

On the dependency path tab I added the folder e:\mycopys and when I compile everything is found without a problem.

Thanks

View solution in original post

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

RE: Setting directory path in Visual Cobol for .NET

Jump to solution

Hey Chris,

You are the man!  That worked like a charm.  

Now, can something similar be done if we have data files in different directories for the same project?

ex:

F:\data\proj1\master

G:\data\proj1\trans

etc...

Again, our program would just refer to the file as:

F:EMPLOYEE.DAT

G:DEPOSIT.DAT

Thanks!

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Setting directory path in Visual Cobol for .NET

Jump to solution

Well if you only specified the filename in the select such as:

  select test-file assign to "EMPLOYEE.DAT"

Then you could set the environment variable COBDATA to point to the location of the file such as:

SET COBDATA=F:\data\proj1\master

and then it would find the file in the appropriate folder.

The problem is that this only works if you specify a filename without a drive or path specifier.

If you specify a drive or path specifier, like you are doing then the file handler assumes that this is the location in which the file exists and it will not go through the search of COBDATA.

If your application is only looking for the files in the current folder then an alternative might be to change the Working Directory parameter under Properties-->Debug to the folder in which the data files exist.

Then when you start running your program in the IDE it will automatically make the specified drive and directory the current one.

Another option is to just map your drive specifier to the approriate network share at the system level so the F: points to \data\proj1\master, etc.

Thanks.

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.