Setting directory path in Visual Cobol for .NET

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:


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:




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!  


  • Verified Answer

    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 into the folder E:\mycopys.

    In my program I have the following:

    copy "".

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


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





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




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