Skip to main content

I saw a post that was created many years ago (https://community.rocketsoftware.com/forums/forum-home?CommunityKey=fc99efc3-3189-48e3-860f-01928efec020 about only compiling changed source.  I have a NetExpress project that was loaded into Visual Studio 2017 and converted to Visual COBOL 4.0.  The project contains hundreds of cbl files.  If I change only one of the cbl files and click BUILD on the project, I would expect only that one changed cbl to compile (into a GNT) but instead all cbls in the project start compiling.  Is this expected behavior?  


#VisualCOBOL
#VisualStudio

I saw a post that was created many years ago (https://community.rocketsoftware.com/forums/forum-home?CommunityKey=fc99efc3-3189-48e3-860f-01928efec020 about only compiling changed source.  I have a NetExpress project that was loaded into Visual Studio 2017 and converted to Visual COBOL 4.0.  The project contains hundreds of cbl files.  If I change only one of the cbl files and click BUILD on the project, I would expect only that one changed cbl to compile (into a GNT) but instead all cbls in the project start compiling.  Is this expected behavior?  


#VisualCOBOL
#VisualStudio

Hi,

No, that is not expected behavior for Build. Build should only build the programs that have changed or programs that are dependant on that changed program. Rebuild should build all sources. When you change one program and click on build what is the message that shows in the Visual Studio output window for number of programs compiled?

I tested here using Visual COBOL V9.0 and a project comtaining 4 programs. I changed 2 of them and those are the only ones that are compiled
I get the message:

1> * Compiling D:\\tests\\testbuild\\testbuild\\Program2.cbl
1> * Generating D:obj\\x64\\Debug\\Program2
1> * Data: 112 Code: 453 Literals: 0
1> * Compiling D:\\tests\\testbuild\\testbuild\\Program3.cbl
1> * Generating D:obj\\x64\\Debug\\Program3
1> * Data: 112 Code: 453 Literals: 0

Visual COBOL 4.0 is a very old product and has not been supported for a couple years.
I suggest you upgrade to the current version and try this again.

Thanks


Hi,

No, that is not expected behavior for Build. Build should only build the programs that have changed or programs that are dependant on that changed program. Rebuild should build all sources. When you change one program and click on build what is the message that shows in the Visual Studio output window for number of programs compiled?

I tested here using Visual COBOL V9.0 and a project comtaining 4 programs. I changed 2 of them and those are the only ones that are compiled
I get the message:

1> * Compiling D:\\tests\\testbuild\\testbuild\\Program2.cbl
1> * Generating D:obj\\x64\\Debug\\Program2
1> * Data: 112 Code: 453 Literals: 0
1> * Compiling D:\\tests\\testbuild\\testbuild\\Program3.cbl
1> * Generating D:obj\\x64\\Debug\\Program3
1> * Data: 112 Code: 453 Literals: 0

Visual COBOL 4.0 is a very old product and has not been supported for a couple years.
I suggest you upgrade to the current version and try this again.

Thanks

Thank you for your response, Chris.  Unfortunately we are stuck on this version until our vendor upgrades their version of VC.  I think VS believes that something is different between the original build that was created and loaded into the Azure GIT repo, and what was cloned down to my local drive because if I click BUILD and let VS build all the CBLs into GNTs and then immediately click BUILD again without changing anything, nothing builds.  Here's an example from the output: 1>  COBOL compile: 632 item(s) succeeded or up-to-date, 1 failed. 

I will try committing all the GNTs again and re-clone and see if that fixes it.  Thanks for your help!  


Thank you for your response, Chris.  Unfortunately we are stuck on this version until our vendor upgrades their version of VC.  I think VS believes that something is different between the original build that was created and loaded into the Azure GIT repo, and what was cloned down to my local drive because if I click BUILD and let VS build all the CBLs into GNTs and then immediately click BUILD again without changing anything, nothing builds.  Here's an example from the output: 1>  COBOL compile: 632 item(s) succeeded or up-to-date, 1 failed. 

I will try committing all the GNTs again and re-clone and see if that fixes it.  Thanks for your help!  

 candee_tipler 

When you run Build, all programs for which the outputs are older than the inputs, or don't exist, are compiled. The inputs may include external copybooks and configuration files used during the compile, not just the source files themselves. The build dependency tracking must have identified something in the inputs as newer that the outputs, triggering a compile on all of the sources which is why it compiled everything the first time around but not the second.

Identifying what was causing everything to compile first time around would require setting MSBuild project build output verbosity to Diagnostic in Tools -> Options -> Projects and Solutions -> Build and Run and scanning through the large amount of information that that produces.

Alternatively, if you want to ensure that only a single program is compiled you can right-click the program in Solution Explorer and select the Compile menu item.

Gael 


 candee_tipler 

When you run Build, all programs for which the outputs are older than the inputs, or don't exist, are compiled. The inputs may include external copybooks and configuration files used during the compile, not just the source files themselves. The build dependency tracking must have identified something in the inputs as newer that the outputs, triggering a compile on all of the sources which is why it compiled everything the first time around but not the second.

Identifying what was causing everything to compile first time around would require setting MSBuild project build output verbosity to Diagnostic in Tools -> Options -> Projects and Solutions -> Build and Run and scanning through the large amount of information that that produces.

Alternatively, if you want to ensure that only a single program is compiled you can right-click the program in Solution Explorer and select the Compile menu item.

Gael 

Thanks for all the info, Gael.  I had changed the output verbosity and combed through the mountain of data and it looked to me unless i was reading it wrong, that it thought the directives were different and that's why it was recompiling the programs.  I tried switching around the directives to see if i could get it to not rebuild everything every time but it kept seeing something different in the directives. My ultimate goal is to get an automated DevOps Build & Release pipeline created for our COBOL solution like we have for our C# solutions so my first step was in trying to get a BUILD to only compile what was changed. Do you know if there are any How Tos on that subject? 

Thank you for your time and assistance,

Candee


Thanks for all the info, Gael.  I had changed the output verbosity and combed through the mountain of data and it looked to me unless i was reading it wrong, that it thought the directives were different and that's why it was recompiling the programs.  I tried switching around the directives to see if i could get it to not rebuild everything every time but it kept seeing something different in the directives. My ultimate goal is to get an automated DevOps Build & Release pipeline created for our COBOL solution like we have for our C# solutions so my first step was in trying to get a BUILD to only compile what was changed. Do you know if there are any How Tos on that subject? 

Thank you for your time and assistance,

Candee

Candee,

There aren't any How Tos that I am aware of because the underlying functionality should, in theory at least, be completely transparent.

In your reply to Chris you said that once everything had compiled the next Build didn't compile anything, but in your reply to me you said it rebuilds everything every time so I'm not sure of the exact sequence of events.

When the build checks to see if the directives have changed it compares the current directives to those it gets from a log file for a previous build. If that log file does not exist, which presumably it won't on a first build after you have checked out from Git, that could explain the initial build. If it really is rebuilding every time as a result of it thinking that the directives have changed the directives used in the compile are in obj\\[x86\\x64]\\[Debug|Release]\\<projectname>.TrackingLogs\\cobol.options.1.tlog so you could look at that after each build to see what has changed.  

Gael 


Candee,

There aren't any How Tos that I am aware of because the underlying functionality should, in theory at least, be completely transparent.

In your reply to Chris you said that once everything had compiled the next Build didn't compile anything, but in your reply to me you said it rebuilds everything every time so I'm not sure of the exact sequence of events.

When the build checks to see if the directives have changed it compares the current directives to those it gets from a log file for a previous build. If that log file does not exist, which presumably it won't on a first build after you have checked out from Git, that could explain the initial build. If it really is rebuilding every time as a result of it thinking that the directives have changed the directives used in the compile are in obj\\[x86\\x64]\\[Debug|Release]\\<projectname>.TrackingLogs\\cobol.options.1.tlog so you could look at that after each build to see what has changed.  

Gael 

Hi Gael,

   Sorry, I wasn't very clear. I meant to say that in trying to discover the issue with the directives,I would start from scratch and adjust the directives and then click BUILD to see what it would do - if it started recompiling everything, I would start once again from scratch, make another directive adjustment and click BUILD, etc.  My aim was to see if i could figure out which directive(s) were causing it to think that it had changed. Hope this makes it a little clearer on why i said it was recompiling everything each time - it was because i kept starting from scratch.  If I didn't start from scratch, then yes, subsequent BUILDS would only recompile the changed items.  And thank you for explaining where the directives are.  I will check on that. 

I appreciate all your information!

-Candee