You can use the .strsub command to swap one string for
another in files; a common use is to replace a standard token with
a system variable such as the $B variable that provides the current
job number.
You can use the .strsub dot command to embed build or version numbers
in code files. By placing a .strsub command early in your project,
a later step can compile files that contain the updated information.
For example, the following steps set up a project to embed build
numbers:
- Add a unique string such as _BUILD_ to a file
in your project. For example, modify a file README.TXT and
change the version declaration as follows:
Application version 5.0.123
Application version 5.0._BUILD_
- An early step in your project should check out the files to be
worked on. Add a step after README.TXT is checked
out that replaces _BUILD_ with the $B system variable.
For the command, use the following:
.strsub _BUILD_ $B README.TXT
- Run the project and verify that the README.TXT file contains the
current job number. For the third run of the project, the README.TXT
file should contain this line:
Application version 5.0.3
Enhancements
You can improve
this practice in the following ways: