IBM Support

Use of Windows batch files in a Build Forge step

Troubleshooting


Problem

This technote goes over how to properly use multiple batch files in the same IBM® Rational® Build Forge® step.

Cause

Windows batch files return 0 upon successful completion, which tells Build Forge that the step has succeeded. However, any step commands following a batch file will not be executed due to this.

Example:

The two batch files contain a simple echo of the file name.

Step command:

c:\script1.bat


c:\script2.bat
echo Performed both batches

Build Log:

EXEC script1


EXEC end {c:\build\optimus\Windows_Batch_Files\BUILD_2@optimus-prime] c:\script1.bat c:\script2.bat echo Performed both batches (0)

The two commands after the first batch file do not get started.

.

Resolving The Problem

Use the call command to catch any batch file return codes, which will allow Build Forge to continue step processing past the first batch file.

Example:

Step command:

call c:\script1.bat


call c:\script2.bat
echo Performed both batch files

Build Log:

EXEC script1


EXEC script2
EXEC Performed both batch files
EXEC end [c:\build\optimus\Windows_Batch_Files\BUILD_2@optimus-prime] call c:\script1.bat call c:\script2.bat echo Performed both batch files (0)

The call command captured the return code allowing all of the step commands to run.

[{"Product":{"code":"SSB2MV","label":"Rational Build Forge"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Engine","Platform":[{"code":"PF033","label":"Windows"}],"Version":"3.8;7.0;7.0.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21267028