Characters

In COBOL, the indivisible unit of data is the character. The letters of the alphabet, digits, and special characters that form the COBOL character set are shown in Table 1.

The Integrated Language Environment®* (ILE*) COBOL * language is restricted to the defined character set. The contents of nonnumeric literals, comment lines, comment entries, and the values held in data items, can include any of the characters from the character set currently specified for the system (by the primary source file's code character set identifier (CCSID)).

IBM Extension

IBM Extension Characters from the Double-Byte Character Set (DBCS) are valid characters in certain COBOL character-strings. Double-byte characters occupy two adjacent bytes to represent one character. (See the DBCS information under Character-Strings for more information.) End of IBM Extension

End of IBM Extension

Individual characters are joined to form character strings, separators, and text words.

A character-string is a character or sequence of contiguous characters that form a COBOL word, a literal, a PICTURE character-string, or a comment. A character-string is delimited by separators.

A separator is a string of one or two contiguous punctuation characters used to delimit character-strings. Separators are described in detail under Separators.

A text word is a character or sequence of contiguous characters between margin A (between column 7 and column 8) and margin R (between column 72 and column 73) in a COBOL library, source program, or in pseudo-text that is any of the following:
  • A separator, except for spaces, pseudo-text delimiters, and the delimiters of non-numeric literals
  • A literal, including any required delimiters
  • Any other sequence of contiguous COBOL characters bounded by separators, except comment lines and the word COPY.
Table 1. COBOL Characters—Their Meanings and Uses
Character Meaning Use
A–Z Alphabet (uppercase) Alphabetic characters
a–z Alphabet (lowercase) Alphabetic characters
0–9 Arabic numerals (digits) Numeric characters
  Space Punctuation character
. Decimal point or Period
Editing character
Punctuation character
< Less than Relation character
( Left parenthesis Punctuation character
+ Plus sign
Arithmetic operator
Editing character
$ Dollar sign Editing character
* Asterisk
Arithmetic operator
Editing character
Comment character
) Right parenthesis Punctuation character
; Semicolon Punctuation character
: Colon Punctuation character
- Minus sign or Hyphen
Arithmetic operator
Editing character
Continuation character
Element of COBOL word
_ Underscore Element of user-defined word
Stroke or Slash
Arithmetic operator
Editing character
Continuation character
, Comma
Editing character
Punctuation character
> Greater than Relation character
= Equal sign
Punctuation character
Relation character
" Quotation mark Punctuation character
' Apostrophe Punctuation character
Note:
  1. The Apostrophe (') and underscore (_) characters are IBM extensions.
  2. Certain other characters may be required within non-numeric literals used to define the names of system objects, or date and time formats:
    • The characters # and @ are valid elements within IBM® i system names.
    • The characters @ and % are conversion specifiers that may be used when defining a date or time format.