Writing comments in CL programs or procedures
To write comments or add comments to commands
in your CL programs or procedures, use the character pairs /*
and */
.
The comment is written between these symbols.
The starting comment delimiter, /*
,
requires three characters unless the /*
characters
appear in the first two positions of the command string. In the latter
situation, /*
can be used without a following blank
before a command.
You can enter the three-character starting comment delimiters in any of the following ways (b represents a blank):
/*b
b/*
/**
Therefore, the starting comment delimiter can be entered
in different ways. The starting comment delimiter, /*
,
can:
- Begin in the first position of the command string
- Be preceded by a blank
- Be followed by a blank
- Be followed by an asterisk (
/**
)
Note: A comment cannot be embedded within a comment.
For example, in the following procedure, comments are written to describe possible user responses to a set of menu options.
Note: By using
the code example, you agree to the terms of the Code license and disclaimer information.
PGM /* ORD040C ORDER DEPT GENERAL MENU */
DCLF FILE(ORD040CD)
START: SNDRCVF RCDFMT(MENU)
SELECT
WHEN (&RESP=1) THEN(CALL CUS210) /* CUSTOMER INQUIRY */
WHEN (&RESP=2) THEN(CALL ITM210) /* ITEM INQUIRY */
WHEN (&RESP=3) THEN(CALL CUS210) /* CUSTOMER NAME SEARCH */
WHEN (&RESP=4) THEN(CALL ORD215) /* ORDERS BY CUST */
WHEN (&RESP=5) THEN(CALL ORD220) /* EXISTING ORDER */
WHEN (&RESP=6) THEN(CALL ORD410C) /* ORDER ENTRY */
WHEN (&RESP=7) THEN(RETURN)
ENDSELECT
GOTO START
ENDPGM