NOTICE: Our Community is moving. Get more information.
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?
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.
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.
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 StudioREM *REM *REM * Call createenv.bat to set the COBOL environmentREM *CALL "C:\Program Files (x86)\Micro Focus\Visual COBOL\createenv.bat"REM *REM * Add the project / solution copyfile locationREM *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.0REM *REM * Close the command promptREM *EXIT