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

Custom compile of single sourcefile in VC for Eclipse

I'm currently trying to use VisualCobol for Eclipse for our legacy code base, in order to modernize our development tools. Up until now we develop in a text editor and compile our cobol-programs via shell script directly on the AIX target. Essentially the script executes the call of the precompiler and the cobol compiler separately. Depending on project conventions (basically naming of the sourcecode), the programm is compiled as standalone binary or as member of one of our shared object libaries. This approach of course requires different arguments to the compilers to achieve this goal. Now I have tried to create a similar behavior running in Eclipse but unfortunately failed with different approaches.

What I like to achieve is that, when I start the compile of a single sourcecode in the IDE (via the option compile from the context menu of a cobol file in an remote cobol project), that my buildfile is executed instead of the project generated .cobolBuild.

Manipulating the .cobolBuild file instead does the trick, but the changes are not persistent. Changing anything in the project config triggers a re-generation of the whole buildfile and my changes are lost. 

When I use my own ant-build file with a custom run configuration , I am not able to trigger the compile as mentioned before (which I could accept). Worse, I cannot communicate with the rdoDeamon and have to make each call via ant sshexec calls. This will work, but renders the rdoDeamon and the added ant-functionality by Microfocus for the purpose of compiling source obsolete.

Using the run configuration as my costum builder (implementing the same enty-ant-targets as in the generated .cobolBuild-File) doesn't start a build at all -> no output on console.

I too tried to structure our code-base in different Remote Cobol Projects according to our conventions to configure the individually. Here I have the problem that with the provided functionality I cannot escape the project structure in the filesystem in order to get the binaries on the desired target location outside of the project structure. This would require an additional process outside of the IDE to move (copy) the generated binaries to their target-locations on the server.

To sum up: I like to use Visual Cobol for Eclipse under following cirumstances:

Use of a remote code base (all sources in a common location on AIX server)
Compile via Visual Cobol for Eclipse on an Windows machine on the remote server
Explicit call of oracle Pro*Cobol precompiler
Use of different compile settings dependend on legacy naming conventions
Different target locations for the binaries
Compile of single files and NOT the whole project

Ideally I like to achieve that my custom settings are called via compile from the context menu of an source item in the cobol explorer. Using a ant build-file with an eclipse (ant-)run configuration would also suffice as long I can use the mf specifics on the server - avoiding implementing every task via an ant sshexec task.


Does anybody have experience with such requirements? Have I missed something in the documentation? Or are these requirements too exotic and this toolset isn't made for these purpose?




2 Replies
Micro Focus Expert
Micro Focus Expert

RE: Custom compile of single sourcefile in VC for Eclipse

Hello Zed,

Welcome to Visual COBOL! Here's an idea of something you might try. You've mentioned creating COBOL projects. Within a COBOL Project, there is an Event page, which can define actions you'd like taken before or after a Build happens for that Project. You can find this page at:

   Project Properties->Micro Focus->Build Configuration->Events

In the Pre and Post Events fields, you can enter commands to be executed. So, you could have a command in the "Post-Build Event command line" that would copy the resulting file(s) to another desired location. Or, you could use this field to invoke a shell script to "deploy" your created build results to the desired directory.

You've also mentioned an interest in controlling which programs are being built within your project. For Native COBOL, if you turn off automatic build, you can then manually build the desired programs individually. You turn off automatic build on the Eclipse menu by clicking on Project, and then making sure "Build Automatically" is unchecked. Then you can build selected programs by right-clicking on the .cbl file in the COBOL Explorer view, and choosing "Compile".

Blair McDonald


RE: Custom compile of single sourcefile in VC for Eclipse

Hello Blair,

thanks for your reply!

Regarding the pre-/post- build events: I already tried to get things done with them. The problem I have with these events is, that seemingly they are only triggered for builds of the whole project and not when I want to compile one single sourcecode file. So in order to "publish" the changes made to one file I have to rebuild all sources of this project. Because more than one person can work on such a project concurrently, we are having difficulty in the syncronization of the work. Have I missed something and the events are also triggered compiling on single source file?

The "Build Automatically" option was one of the first things I have unchecked, but thanks for the suggestion. But this leads me to the initial problem. I'd like to explicitly compile one .cbl file, but customize this compile.

Do you know a possibility to achieve such a thing?
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.