Highlighted
Super Contributor.
Super Contributor.
5569 views

How to set copybook paths in shared directives file in Visual COBOL

Jump to solution

Scot Nielson said you could do this in the webinar Getting Started with Visual Studio 2010.

On the COBOL page of my native project's properties, I am setting Additional Directives to: USE"..\MYDIRECTIVES.DIR".

In MYDIRECTIVES.DIR I am using the COPYPATH directive to point to where the copybooks are and am leaving Copybook Paths in project properties

blank.  This will make it easy for us the change directives and copybook paths for all projects.  Is COPYPATH the correct way to do this ?

The documentation on this directive says:

"You should only use the COPYPATH directive when compiling using the cobol command line utility, and not when

building programs from within the IDE".

Phil Levin

Tags (1)
0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Yes, If you have a copy path specified in the project properties it will be searched first and then the locations specified within the COBCPY environment variable will be searched next.

The COBCPY environment variable has default settings that are stored in the System Registry entries for both Net Express and Visual COBOL products, so depending on which IDE you are using it will look in the correct location for that product.

For Visual COBOL the default locations are set to:

%COBCPY%;C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\;C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\basecl

Thanks.

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Yes, setting COBCPY in a .bat file prior to executing devenv.exe will override the value set in the control panel as long as you don't include the %COBCPY% as part of the value.

This will work:

SET COBCPY=c:\vcobol\cpy

devenv.exe

This will not:

SET COBCPY=%COBCPY%;c:\vcobol\cpy

devenv.exe

View solution in original post

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

It has this warning about the COPYPATH directive because the IDE itself sets COPYPATH depending on the values set in the project properties.

The IDE also makes use of the COBCPY environment variable to locate certain system source files.

When you set COPYPATH yourself, the IDE will no longer look at COBCPY so it may not find some required system copybook files.

It is recommended that if you are using the Visual Studio IDE to build your projects that you either set the copy path in the project properties or for global use set the locations in the COBCPY environment variable at the system level.

Scot may have a different recommendation here but this is my understanding of the issue...

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Ok, so we removed the COPYPATH directive from the shared directives file.  I have a further question.

Our machine has both Net Express 5.1 and Visual Studio 2010 with Visual COBOL 2.1.  We are porting our NX projects to Visual COBOL.  The NX and Visual COBOL versions of our application each have their own copybook directories.  COBCPY on the control panel's environmental variables screen points to the

NX copybook directory.  NX also has its own system copybooks under "Program Files (x86)" and Visual COBOL has its system copybooks under "Program Files (x86)".  By system copybooks I mean the ones that are provided by Micro Focus.

For a Visual COBOL project, we set the Copybook Paths property on the properties screen to point

to the copybooks directory of the Visual COBOL version of our application.  This directory holds the copybooks we have created and has none of the system copybooks.  When we build the project, the

compiler first looks in this directory then looks in the directory defined by COBCPY.  Is that correct ?

For system copybooks (such as mfole.cpy and createactivex.cpy) the compiler looks under "C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib".  Is that right ?

Phil Levin

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Yes, If you have a copy path specified in the project properties it will be searched first and then the locations specified within the COBCPY environment variable will be searched next.

The COBCPY environment variable has default settings that are stored in the System Registry entries for both Net Express and Visual COBOL products, so depending on which IDE you are using it will look in the correct location for that product.

For Visual COBOL the default locations are set to:

%COBCPY%;C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\;C:\Program Files (x86)\Micro Focus\Visual COBOL\cpylib\basecl

Thanks.

View solution in original post

0 Likes
Highlighted
Super Contributor.
Super Contributor.

We have two copybook directories:

s:\v54\awcbl\cpy  for the NX version of our application

c:\vcobol\cpy for the Visual COBOL version of our application

COBCPY (on the Control Panel) is set to s:\v54\awcbl\cpy

We do not want Visual COBOL to look for a copybook in this directory.

Would this work ?

 We are already running Visual Studio from a shortcut to a batch file.

 The batch file sets COBDIR for the Visual COBOL version of our application.

 This overrides the COBDIR setting on the Control Panel, which is set for our

 Net Express application.

 We could also add COPCPY to this batch file to point to c:\vcobol\cpy.  This way

 Visual COBOL will never look in s:\v54\awcbl\cpy.

Phil Levin

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Yes, setting COBCPY in a .bat file prior to executing devenv.exe will override the value set in the control panel as long as you don't include the %COBCPY% as part of the value.

This will work:

SET COBCPY=c:\vcobol\cpy

devenv.exe

This will not:

SET COBCPY=%COBCPY%;c:\vcobol\cpy

devenv.exe

View solution in original post

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.