Character string

A character string is a string of any EBCDIC characters (alphanumeric and special) that are used as a value.

These EBCDIC values can include date and hexadecimal values. A character string can have two forms: quoted string or unquoted string. Either form of character string can contain as many as 5000 characters.

A quoted character string is a string of alphanumeric and special characters that are enclosed in apostrophes. For example, 'Credit limit has been exceeded' is a quoted character string. The quoted string is used for character data that is not valid in an unquoted character string. For example, user-specified text can be entered in several commands to describe the functions of the commands. Those descriptions must be enclosed in apostrophes if they contain more than one word because blanks are not allowed in an unquoted string.

An unquoted character string is a string consisting of only alphanumeric characters and the special characters that are shown in the Unquoted String column in the table below table. The table summarizes the main EBCDIC characters that are valid in unquoted and quoted character string values. An X in the last column indicates that the character on the left is valid; refer to the specific notes following the figure that indicate why the character is valid as described. The special characters allow the following to be unquoted character string values:

Any of these unquoted strings can be specified for parameters defined to accept character strings. In addition, some parameters are defined to accept predefined values, names, or decimal values either singly or in combinations.

Table 1. Quoted and Unquoted Character Strings
Name of Character Character Unquoted String Quoted String
Ampersand & See Note 5 X
Apostrophe ' See Note 7 -
Asterisk (*) * See Notes 5, 6 X
At sign @ X X
Blank     X
Colon :   X
Comma , See Note 1 X
Digits 0-9 See Note 1 X
Dollar sign $ X X
Equal = See Notes 5, 8 X
Greater than > See Notes 5, 8 X
Left parenthesis ( See Note 4 X
Less than < See Notes 5, 8 X
Letters (lowercase) a-z See Note 2 X
Letters (uppercase) A-Z X X
Minus - See Notes 1, 5 X
Not
not symbol
See Notes 5, 8 X
Number sign # X X
Percent %   X
Period . See Notes 1, 11 X
Plus + See Notes 1, 5 X
Question mark ?   X
Quotation marks " " See Note 10 X
Right parenthesis ) See Note 4 X
Semicolon ;   X
Slash / See Notes 3, 5 X
Underscore _ See Note 9 X
Vertical bar | See Notes 5, 8 X
Note:
  1. An unquoted string of all numeric characters, an optional single decimal point (. or ,), and an optional leading sign (+ or -) are valid unquoted strings. Depending on the parameter attributes in the command definition, this unquoted string is treated as either a numeric or character value. On the CALL command or in an expression, this unquoted string is treated as a numeric value; a quoted string is required if character representation is desired. Numeric characters used in any combination with alphanumeric characters are also valid in an unquoted string.
  2. In an unquoted string, lowercase letters are translated into uppercase letters unless the string is specified for a parameter that has the attribute CASE(*MIXED).
  3. A slash can be used as a connector in qualified names and path names.
  4. In an unquoted string, parentheses are valid when used to delimit keyword values and lists, or in expressions to indicate the order of evaluation.
  5. In an unquoted string, the characters +, -, *, /, &, |, not symbol, <, >, and = are valid by themselves. If they are specified on a parameter that is defined in the command definition with the EXPR(*NO) attribute, they are treated as character values. If they are specified on a parameter that is defined in the command definition with the EXPR(*YES) attribute, they are treated as expression operators.
  6. In an unquoted string, the asterisk is valid when followed immediately by a name (such as in a predefined value) and when preceded immediately by a name (such as in a generic name).
  7. Because an apostrophe within a quoted string is paired with the opening apostrophe (delimiter) and is interpreted as the ending delimiter, an adjacent pair of apostrophes ('') must be used inside a quoted string to represent an apostrophe that is not a delimiter. When characters are counted in a quoted string, a pair of adjacent apostrophes is counted as a single character.
  8. In an unquoted string, the characters <, >, =, not symbol, and | are valid in some combinations with another character in the same set. Valid combinations are: <=, >=, not symbol=, not symbol>, not symbol<, ||, |<, and |>. If the combination is specified on a parameter that is defined in the command definition with the EXPR(*NO) attribute, it is treated as a character value. If it is specified on a parameter that is defined in the command definition with the EXPR(*YES) attribute, it is treated as an expression operator.
  9. In an unquoted string, the underscore is not valid as the first character or when used by itself.
  10. Quotation marks are used to delimit a quoted name.
  11. A period is valid in a basic name, except as the first character.

The following are examples of quoted string constants:

Table 2. Quoted string constants
Constant Value
'1,2,' 1,2,
'DON''T' DON'T
'24 12 20' 24 12 20

The following are examples of unquoted string constants:

Table 3. Unquoted string constants
Constant Meaning
CHICAGO CHICAGO
FILE1 FILE1
*LIBL Library list
LIBX/PGMA Program PGMA in library LIBX
1.2 1.2
Related reference
Date values
Hexadecimal values
Expressions
Character string expressions