Setting COBCPY outside of Visual COBOL project

0 Likes
over 5 years ago

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

Comment List
Anonymous
Related Discussions
Recommended