Comments
A comment is a sequence of characters (on one or more lines) delimited by
/* and */. Any characters are allowed within these delimiters.
Comments can contain other comments, as long as each begins and ends with the necessary
delimiters. They are called nested comments. Comments can be anywhere and can be of any
length. They have no effect on the program, but they do act as separators. Two tokens with only a
comment in between are not treated as a single token.
/* This is an example of a valid REXX comment */Take special care when commenting out lines of code that contain
/* or
*/ as part of a literal string. Consider the following program segment:
01 parse pull input
02 if substr(input,1,5) = '/*123'
03 then call process
04 dept = substr(input,32,5)To comment out lines 2 and 3, the following change would be incorrect because the language
processor would interpret the
/* that is part of the literal string
/*123 as the start of a nested comment. It would not process the rest of the
program because it would be looking for a matching comment end (*/).:
01 parse pull input
02 /* if substr(input,1,5) = '/*123'
03 then call process
04 */ dept = substr(input,32,5)You can avoid this type of problem by using concatenation for literal strings that contain
/* or */; line 2 would be:
if substr(input,1,5) = '/' || '*123'You could comment out lines 2 and 3 correctly as follows:
01 parse pull input
02 /* if substr(input,1,5) = '/' || '*123'
03 then call process
04 */ dept = substr(input,32,5)
For information about Double-Byte Character Set characters, see Double-Byte Character Set (DBCS) Support
and the OPTIONS instruction.