Summary -

In this topic, we have explained Character set with detailed examples.

The character is the fundamental and essential unit of any programming language.

The set of valid characters creates the character-set for any programming language that contains the alphabets(A-Z/a-z), digits(0-9), and special characters.

Similarly, the character is a basic and essential unit for the COBOL. COBOL language has its own set of the character-set like other programming languages.

Below is the list of basic COBOL character sets –

CharacterMeaningUsage
Space Punctuation character
+ Plus sign Arithmetic operator
Editing character
- Minus sign or hyphen Arithmetic operator
Editing character
Continuation character
COBOL word element
* Asterisk Arithmetic operator
Editing character
Comment character
/ Forward slash or solidus Arithmetic operator
Editing character
Continuation character
= Equal sign Punctuation character
Relation character
$ Currency sign Editing character
, Comma Editing character
Punctuation character
; Semicolon Punctuation character
. Decimal point or period Editing character
Punctuation character
" Quotation mark Punctuation character
' Apostrophe Punctuation character
( Left parenthesis Punctuation character
) Right parenthesis Punctuation character
Greater than Relational character
Less than Relational character
: Colon Relational character
_ Underscore User-defined word element
A - Z Alphabet (uppercase) Alphabetic characters
a - z Alphabet (lowercase) Alphabetic characters
0 - 9 Numeric characters Numeric characters

Individual characters are joined to form character-strings, text words and separators in COBOL language.

Character-strings and separators are again used to form words, literals, phrases, clauses, statements, and sentences.

Examples -

COBOL character-set is basic to form any words, literals, phrases, clauses, statements, and sentences. Below examples shows how they are formed -

Type Some Examples
User-defined Words
WS-VAR
VAR
PARA-ADD
PARA-SUBTRACT
...
Keywords/Reserved Words
MOVE
IF
PERFORM
...
Literals
"HELLO WORLD"
"123"
123
9
...
Phases
USING
CORRESPONDING
...
Clause
REDEFINES
PICTURE
VALUE
...
Variables
WS-VAR1
WS-VAR2
WS-VAR3
...
Statements
IDENTIFICATION DIVISION.
DATA DIVISION.
WORKING-STORAGE-SECTION.
MOVE 10 TO WS-VAR1.
...
Sentences
MOVE 10 to WS-VAR1
PERFORM 10 TIMES.
...