Using autocorrect comments
You can use the autocorrect comment feature to automatically insert a small comment when you fix a source scan error in the compare editor or using the Autocorrect action. Using this feature, you can customize the content of the comment.
Procedure
To set the autocorrect comment preferences, complete the following steps:
- In the navigation pane of the Preferences window, double-click the TPF Toolkit node to expand the tree of available preference pages.
- From the TPF Toolkit tree, double-click the Source Scan node to expand the tree of available preference pages.
- Click Actions to open the Actions preference
page.
- Optional. Select the Keep original lines of
file as comments checkbox to specify that you want to
keep the original line in the file where the source scan error occurred.
When you use the Autocorrect action or the Compare File action to
fix source scan errors, the original line is commented and the repaired
line is displayed beneath the original commented line. Note: In HLASM files, the original line is commented by prefixing an asterisk (*) character to the line. In C/C++ files, the original line is commented by prefixing a comment delimiter to the line. The comment delimiter is determined by the append start and append end characters from the auto comment profile set in the Autocomment preference page. If the auto comment profile specifies // as the comment syntax for the file type, original lines are prefixed with this delimiter and saved. The file extension is used to determine which auto comment profile to use for the file type.In the following example, the Autocorrect action fixed a source scan problem, kept the original line as a comment (<tpfregs.h>), and then added a change flag to the changed line (// PJ29593a).If the auto comment profile specifies /**/ as the comment syntax for the file type, the original line is enclosed in that syntax. A check is made to determine if either the /* or */ syntax already appears in the original line; comments will not be nested. For example, the original line:
becomes the following commented line:long count = 0; /* Start count at zero */
In addition, the original line:/*long count = 0; *//* Start count at zero */
becomes the following commented line:#include <tpfregs.h>
/*#include <tpfregs.h>*/
- Optional. Select the Add change flag to autocorrected
lines checkbox to specify that you want to use a custom
autocorrect comment when you fix source scan errors. In the Base
flag field, type the custom autocorrect comment that you
want to use. Tip: You can use the following substitution variables in the Base flag field:
- &RULEID - the ID of the source scan rule that detected the fixed problem. For example, if the Rule ID is PJ29218a, then &RULEID=PJ29218a.
- &SHORTID - the prefix of the ID of the rule that detected the fixed problem. The last letter used as a subrule identifier is omitted. This variable always results in a value that is 7 characters in length. For example, if the Rule ID is PJ29218a, then &RULEID=PJ29218.
- &APARNUM - if the rule originates from a single source APAR, the APAR number is substituted; if the rule does not originate from a single source APAR, this is blank. For example, if the Rule ID is PJ29218a, then &APARNUM=PJ29218. If the Rule ID is OTR24BTa, then &APARNUM=
Each Rule ID is 8 characters in length. When a comment is inserted into changed lines in the source file, the Auto Comment preference settings are used. By default, the comments are prefixed with a comment symbol. For example, an Assembler file might display a comment such as @PJ29218a; a C/CPP file might display a comment such as /*PJ29218a*/.
Depending on the settings in the Auto Comment language profile, the comment that results from using the rule ID might be too long to insert in the file. The allowable length of a comment is determined by settings in the Auto Comment language profile. By default, both the HLASM and C profiles do not accept 8 character base flags; you must increase the maximum size in the Autocomment preference page.
- Do one of the following actions:
- Click Apply to save your selections.
- Click Restore Defaults to revert to the default autocorrect comment preferences where original lines are kept and the base flag is &RULEID
The autocorrect comment preferences that you specified are used when source scan errors are fixed in the compare editor or using the Autocorrect action.Tip: The commenting options specified in this preference page do not apply when using Quick Fix. If you set an auto comment for the source file you are editing, that comment is inserted into the changed line, but the source scan tools do not add an auto comment.