Skip to main content

I've just downloaded and installed VC 8 in Visual Studio Code. When I open a cbl source file I get lots of errors because VS Code can't find my copybook paths, preprocessors, preprocessor directives etc. In other words, VS Code can't find the things I had in Project Properties and Application.config in my Visual Cobol project.

I have tried to find somewhere in VS Code to enter these values, but I've failed so far ... Where can I enter these values?

I've just downloaded and installed VC 8 in Visual Studio Code. When I open a cbl source file I get lots of errors because VS Code can't find my copybook paths, preprocessors, preprocessor directives etc. In other words, VS Code can't find the things I had in Project Properties and Application.config in my Visual Cobol project.

I have tried to find somewhere in VS Code to enter these values, but I've failed so far ... Where can I enter these values?

If you have a project file (.cblproj) or solution file (.sln)  from Visual Studio in the same folder as your source programs, they will be scanned and the settings within them such as copybook paths and compiler directives will be used in VSCode. 


I've just downloaded and installed VC 8 in Visual Studio Code. When I open a cbl source file I get lots of errors because VS Code can't find my copybook paths, preprocessors, preprocessor directives etc. In other words, VS Code can't find the things I had in Project Properties and Application.config in my Visual Cobol project.

I have tried to find somewhere in VS Code to enter these values, but I've failed so far ... Where can I enter these values?

To add to what Chris has said, you can also set directives for your VS Code workspace in the Settings in Micro Focus COBOL: Default Directives.


If you have a project file (.cblproj) or solution file (.sln)  from Visual Studio in the same folder as your source programs, they will be scanned and the settings within them such as copybook paths and compiler directives will be used in VSCode. 

Yes, that solved everything but Pro*Cobol. Is Pro*Cobol supported in VS Code? 


Yes, that solved everything but Pro*Cobol. Is Pro*Cobol supported in VS Code? 

It should be supported but there currently appears to be a problem in that support. We are looking into this.


To add to what Chris has said, you can also set directives for your VS Code workspace in the Settings in Micro Focus COBOL: Default Directives.

First...Nice Video Gael showing Visual Studio Code 🙂

I suppose I have a similar issue as Jens, Where I really want to set the COBCPY variable in the workspace. I can add the compile directives without a problem.

So in my case I have Source code in folder C:\\Soure
My Copy books reside in C:\\Source\\cpy and C:\\source\\Routines

I can't use an Environment variable because it affect Net Express code I have to maintain.

I do have a project which is NOT in my Source folder where I LINK files rather than add them, so it's a generic project where instead of having thousands of source files I can just link the ones I need to work on.

If I had an empty project in my source folder with all the required setting but without linked source would it use it?

Neil


First...Nice Video Gael showing Visual Studio Code 🙂

I suppose I have a similar issue as Jens, Where I really want to set the COBCPY variable in the workspace. I can add the compile directives without a problem.

So in my case I have Source code in folder C:\\Soure
My Copy books reside in C:\\Source\\cpy and C:\\source\\Routines

I can't use an Environment variable because it affect Net Express code I have to maintain.

I do have a project which is NOT in my Source folder where I LINK files rather than add them, so it's a generic project where instead of having thousands of source files I can just link the ones I need to work on.

If I had an empty project in my source folder with all the required setting but without linked source would it use it?

Neil

Hi Neil, 

Good to hear from you!

Is it not possible to pick up the copybooks by setting COPYPATH as a default directive for your folder/workspace ? That is the compiler directive that effectively does the same thing as setting the COBCPY environment variable and that is how copybooks defined in a project are passed to the compiler.

If you have a Visual Studio project then, yes, that will get used. 

Gael


Hi Neil, 

Good to hear from you!

Is it not possible to pick up the copybooks by setting COPYPATH as a default directive for your folder/workspace ? That is the compiler directive that effectively does the same thing as setting the COBCPY environment variable and that is how copybooks defined in a project are passed to the compiler.

If you have a Visual Studio project then, yes, that will get used. 

Gael


I'm still missing something here.

I have Micro Focus Visual COBOL 8.0 Version 8.0.00125 Patch Update 1. confirmed by going into Visual Studio 2022 and going the Help~About

If I have a Visual Studio Project that has the environment already has been configured and just 1 CBL linked.

So what I did first was copy the CBL project to the same source folder.

In the Source folder there are 3500+ .CBL files
If I open Visual Studio code and open that folder all the .CBL files are listed.

If I select a .CBL file it is colourized as expected but ALL the copybooks are NOT found the EXXCEPTION is the 1 .CBL that is linked in the project.

SO I removed the project.

Close Visual Studio code

Reopen Visual Studio Code - the 1 linked file that was in the project still finds the copybooks even though the project has been deleted.

Next step was to add copypath in the WORKSPACE as per image, this still didn't make a difference.

Yet the 1 file linked when the project was in the folder earlier still is correct. So this is stored somewhere.

Under the source folder a .vscode folder was created and the settings.json update with copypath (That I checked).

I don't want to add 3500+ .CBL's to my project file.


I'm still missing something here.

I have Micro Focus Visual COBOL 8.0 Version 8.0.00125 Patch Update 1. confirmed by going into Visual Studio 2022 and going the Help~About

If I have a Visual Studio Project that has the environment already has been configured and just 1 CBL linked.

So what I did first was copy the CBL project to the same source folder.

In the Source folder there are 3500+ .CBL files
If I open Visual Studio code and open that folder all the .CBL files are listed.

If I select a .CBL file it is colourized as expected but ALL the copybooks are NOT found the EXXCEPTION is the 1 .CBL that is linked in the project.

SO I removed the project.

Close Visual Studio code

Reopen Visual Studio Code - the 1 linked file that was in the project still finds the copybooks even though the project has been deleted.

Next step was to add copypath in the WORKSPACE as per image, this still didn't make a difference.

Yet the 1 file linked when the project was in the folder earlier still is correct. So this is stored somewhere.

Under the source folder a .vscode folder was created and the settings.json update with copypath (That I checked).

I don't want to add 3500+ .CBL's to my project file.

Neil,

I have recreated the problem myself so we are investigating now. Sorry about that.

Gael


I'm still missing something here.

I have Micro Focus Visual COBOL 8.0 Version 8.0.00125 Patch Update 1. confirmed by going into Visual Studio 2022 and going the Help~About

If I have a Visual Studio Project that has the environment already has been configured and just 1 CBL linked.

So what I did first was copy the CBL project to the same source folder.

In the Source folder there are 3500+ .CBL files
If I open Visual Studio code and open that folder all the .CBL files are listed.

If I select a .CBL file it is colourized as expected but ALL the copybooks are NOT found the EXXCEPTION is the 1 .CBL that is linked in the project.

SO I removed the project.

Close Visual Studio code

Reopen Visual Studio Code - the 1 linked file that was in the project still finds the copybooks even though the project has been deleted.

Next step was to add copypath in the WORKSPACE as per image, this still didn't make a difference.

Yet the 1 file linked when the project was in the folder earlier still is correct. So this is stored somewhere.

Under the source folder a .vscode folder was created and the settings.json update with copypath (That I checked).

I don't want to add 3500+ .CBL's to my project file.

NeilH1 

The problem should be fixed in 8.0 patch update 4. In the meantime you can work around the problem by creating a cobol.dir in your workspace which contains the copypath directive.

Gael