By adding comments to a procedure, you can document its logic, making it easier to maintain. You can place a comment on its own line, at the end of a command, or even in the middle of a command. You can also place a comment in the middle of the procedure, at the very beginning of the procedure before the MAINTAIN command, or at the very end of the procedure following the END command. You can place any text within a comment.
There are two types of comments:
For example:
MAINTAIN $* This is a stream comment *$ TYPE "Hello world"; $* This is a second stream comment. This is still inside the second comment! This is the end of the second comment *$ $* Document the TYPE statement--> *$ TYPE "Hello again!"; $* Goodbye *$ END
MAINTAIN FILE Employee FOR ALL NEXT Emp_ID INTO Pay; -* This entire line is a comment. COMPUTE Pay.NewSal/D12.2; . . . END
You can also place a comment at the end of a line of code:
MAINTAIN FILE Employee FOR ALL NEXT Emp_ID INTO Pay; $$ Put root seg into a stack COMPUTE Pay.NewSal/D12.2; . . . END
You can place a comment at the end of a line containing a command that continues onto the next line:
MAINTAIN FILE Employee FOR ALL NEXT Emp_ID INTO Pay -* Put root seg into a stack WHERE Department IS 'MIS'; COMPUTE Pay.NewSal/D12.2; . . . END
You can include all types of comments in the same procedure:
MAINTAIN TYPE "Hello world"; -* This is a TYPE command $* This is a stream comment that runs onto a second line *$ $* Document the TYPE statement--> *$ TYPE "Hello again!"; $$ Goodbye . . . END
While Maintain Data uses the same comment characters (-*) as Dialogue Manager, it is only in a Maintain Data procedure that comments can be placed at the end of a line of code.