Pre- and post-build processing events

Within the Micro Focus > Events section of a project's properties, you can call your own script files to execute immediately before and after the .cobolBuild ANT script during the building of a project.

Pre-build events command line setting

Some of the contents of a pre-build script can affect the build process; you can:
  • Introduce error messages into the IDE.
  • Set a return code for the entire build.

Error messages

Code errors within the pre-build script that use the same error format as those usually shown within the IDE. For example, the following message can be broken down as follows:

** VALDN0003S Validation error : program1.cbl(12,14,5)
VALDN
The error message prefix.
0003
The error code.
S
The error severity: S for severe, W for warning, and I for information.
Validation error
The error message text.
program1.cbl
The relative (to the script file) or absolute path and file name of the program.
(12,14,5)
The location of the error in the source file: line number, end column, start column.
Tip: If you do not know the location, use (0,0,0).

By using this same format, you receive a similar behavior to that of errors generated by a background parse: they are listed in the Problems tab, under the sub-section relating to their severity. Double-clicking the entry also takes you to the specified location in the source code.

Return code

The following entry sends a return code (in this case '8') to the build process; a non-zero code will mark the build process as failed, as shown in the Console view:

exit /b 8