Use comments to explain, preferably in language comprehensible to anyone reading your program, what your code does. Comments also enable you to differentiate between PeopleCode delivered with the product and PeopleCode that you add or change. This differentiation helps in your analysis for debugging and upgrades.

Note: Use comments to place a unique identifier marking any changes or enhancements that you have made to a PeopleSoft application. This marker makes it possible for you to search for all the changes you have made, which is particularly helpful when you are upgrading a database.

You insert comments into PeopleCode in these ways:

  • You can insert C-style comments that span multiple lines with /* at the beginning and */ at the end.

  • You can use a Rem (remark) statement for commenting.

    Put a semicolon at the end of a Rem comment. If you do not, everything up to the end of the next statement is treated as part of the comment.

  • You can comment blocks of code and nested C-style comments using <* at the start and *> at the end.

    Use this type of comment to enclose one set of comments within another set. You generally use this when you are testing code and want to comment out a section that already contains comments.

Warning! In application classes, you will see the use of /+ +/ style comments. Do not use these in your PeopleCode programs. These annotations are generated by the compiler. If you use them, they are removed by the system the next time you validate, compile, or save your PeopleCode. They are used to provide signature information on application class methods and properties, and they are regenerated each time the compiler compiles your application class PeopleCode. Instead, use the standard commenting mechanisms listed above.

Note: Commented text cannot exceed a maximum of 16383 characters.

The following code sample shows comment formatting:

<* this program is no longer valid commenting out 
entire thing 

Rem This is an example of commenting PeopleCode; 
/* ----- Logic for Compensation Change ----- */ 
/* Recalculate compensation change for next row.  
Next row is based on prior value of EFFDT.  */ 

calc_next_compchg(&OLDDT, EFFSEQ, 0); 

/* Recalculate compensation change for current row and next row.  
Next row is based on new value of EFFDT.  */ 


calc_next_compchg(EFFDT, EFFSEQ, 0); 


Note: All text between the <* and *> comment markers is scanned. You may receive an error message for certain conditions, such as mismatched quotation marks, when using this type of comment.