Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Setting COBCPY outside of Visual COBOL project

Setting COBCPY outside of Visual COBOL project

Problem:

Many Visual COBOL projects may use the same copybooks, this usually would require setting the Copybook Paths within the properties of a project.

How can the Copybook Paths be set for a Visual COBOL project externally in the environment?

Resolution:

Setting up COBOL Copybook Paths within a Project

The location of copybooks can be specified in the project properties of a project, on the Copybooks tab, or adding them to the project as linked files or folders.

This would need to be set for each project within a solution.

  • Select the Copybook Paths tab and select the New Line icon.
  • Enter the value or browse to location and select the Check Entries icon.

 

Setting up COBOL Copybook Paths within the environment

The COBCPY environment variable can be set in the environment before launching Visual COBOL.

When Visual COBOL is started, it will inherit the settings from the environment, a batch file or script can be used to set up various environment variables and file mappings etc. before launching Visual COBOL.

In the example below Visual COBOL has been started and the COBCPYSAMP project has been loaded. The copybook search path has not been defined.

When the COBOL source program is loaded into the text editor the copybooks cannot be found.

The most straight-forward way to set the COBCPY variable externally is to start a Visual COBOL command prompt, then set COBCPY and start Visual Studio:

When Visual COBOL is started, it will inherit the settings from the environment.

In the example below Visual COBOL has been started and the COBCPYSAMP project has been loaded. The copybook search path has not been defined.

When the COBOL source program is loaded into the text editor the copybooks are found.

Creating a script to set COBCPY and launch Visual Studio

 

REM *
REM * Set COBCPY externally then start Visual Studio
REM *
REM *
REM * Call createenv.bat to set the COBOL environment
REM *
CALL "C:\Program Files (x86)\Micro Focus\Visual COBOL\createenv.bat"
REM *
REM * Add the project / solution copyfile location
REM *
SET COBCPY=C:\COBCPYSAMP\CPY;%COBCPY%
REM *
REM * Start Visual Studio ( use MFDEVENVnn - where nn represents version of Visual Studio)
REM * Alternatively start Visual Studio using DEVENV ("C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\DEVENV:)
REM * The example above uses Visual Studio 2015.
REM *
mfdevenv14.0
REM *
REM * Close the command prompt
REM *
EXIT

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2016-06-02 19:01
Updated by:
 
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.