CL command delimiter characters

Command delimiter characters are special characters or spaces that identify the beginning or end of a group of characters in a command.

Delimiter characters are used to separate a character string into the individual parts that form a command: command label, command name, parameter keywords, and parameter values. Parameter values can be constants, variable names, lists, or expressions. The following figure shows various delimiter characters for a command.

Command Delimiter Characters

The following delimiter characters are used in the IBM® i control language:

  • The colon (:) ends the command label, and it can be used to separate the command label from the command name.
  • Blank spaces separate the command name from its parameters and separate parameters from each other. They also separate values in a list. Multiple blanks are treated as a single blank except in a quoted character string or comment enclosed in single quotation marks. A blank cannot separate a keyword and the left parenthesis for the value.
  • Parentheses ( ) are used to separate parameter values from their keywords, to group lists of values, and to group lists within lists.
  • Slashes (/) connect the parts of a qualified name or the parts of a path name.
    • For a qualified object name, the two parts are the library qualifier and the object name (LIBX/OBJA).
    • For a path name, the parts are the directory or directories searched and the object name ('/Dir1/Dir2/Dir3/ObjA').
  • Either a period or a comma can be used as a decimal point in a decimal value (3.14 or 3,14). Only one decimal point is allowed in a value.
  • Single quotation marks specify the beginning and ending of a quoted character string, which is a combination of any of the 256 extended binary-coded decimal interchange code (EBCDIC) characters that can be used as a constant. For example, 'YOU CAN USE $99@123.45 ()*></ and lowercase letters' is a valid quoted string that is a constant.

    Because a single quotation mark inside a quoted string is paired with the opening single quotation mark (delimiter) and is interpreted as the ending delimiter, a single quotation mark inside a quoted string must be specified as two single quotation marks. A pair of adjacent single quotation marks used this way is counted as a single character.

  • A special character is used to separate a date into three parts: month, day, and year (two parts for Julian dates: year and day). The special characters that may be used as date separators are the slash (/), the hyphen (-), the period (.), a blank ( ), and the comma (,). The special character used to code as separators in a command date must be the same as the special character specified as the date separator for the job.
  • The characters /* and */ can indicate the beginning and ending of a comment, or can be used in a character string. To begin a comment, the characters /* must begin in the first position of the command, be preceded by a blank, or be followed by either a blank or an asterisk. If the characters /* or */ occur in a later position of a command, they will typically be enclosed in single quotation marks and can represent, for example, all objects in the current directory for a path name.
  • A question mark (?) preceding the command name indicates that the command is prompted. If the command is specified with a label, the question mark may either precede the label, or it may follow the label and precede the command name.

    Within a CL program, when a question mark precedes a command name, a prompt display is presented. You can enter parameter values not specified on the command in the program.

    Prompting characters may be put into a command in two forms. A single question mark (?) may be coded before the command name (either before or after the command label in a CL program) to cause the entire command to be prompted. Selective prompt characters (?? or ?*) may be coded before any parameter keyword to cause that parameter to be prompted when the command is run.

    If a question mark is entered before the command name on the command entry display, the effect is the same as pressing the F4 (Prompt) key after the command is entered.

    Within a CL program, when a question mark precedes the command name, a prompt display is presented. This display is of the same format as that presented when pressing the F4 key from the command entry display. Parameters of the command for which the program has coded values are shown for informational purposes, but the user cannot change the values supplied by the program. Parameters for which no value was coded are shown as input fields so you can enter values to be used in processing the command.

    Selective prompting allows you to identify specific command parameters to be prompted. To call selective prompting, the characters ??, ?*, or ?- are coded immediately preceding the keyword name of the parameter(s) to be prompted.

    Notes:
    1. Selective prompting is not allowed with command string (*CMDSTR) parameters.
    2. Parameters of the command that are preceded by the characters ?* are shown, but you cannot change the values that are supplied by the program. Parameters preceded by the characters ?? are shown as input fields containing the values coded in the program or command defaults so you can enter or change the values used in processing the command. Parameters preceded by the characters ?- are omitted from the display. All selectively prompted parameters must be coded in keyword or keyword-with-value form. Several parameters may be selectively prompted within one command. When selective prompting is called, only keywords that are immediately preceded by the selective prompt characters are prompted. All other parameters are processed using the values as coded on the command or, if not coded, using command defaults.

      Either form of prompting, but not both, is allowed on a single command in a CL program. If the character ? precedes the command name and selective prompt characters (except ?-) precede any keyword, an error message is returned and the program is not created.