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 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
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 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.
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:
|