Separators


A separator is a single or group of characters that separates words or strings. The table below shows the separators list -

SeparatorMeaningDescription & Example
SpaceSpace is always a delimiter except within quotation marks.

For example -
IDENTIFICATION DIVISION.
01 WS-VAR PIC X(20).
MOVE "ABC" TO WS-VAR.
,CommaA comma followed by a space is a delimiter to separate two variables.

For example -
MOVE 10            TO WS-VAR1, WS-VAR2.
ADD  10            TO WS-VAR1, WS-VAR2.
.PeriodEvery statement or sentence should end with a separator period(.) in the COBOL program.

For example -
IDENTIFICATION DIVISION.
01 WS-VAR PIC X(20).
MOVE "ABC" TO WS-VAR.
;SemicolonSemicolons may separate clauses and operands within clauses.
( ) Left & right parenthesis These are used as separators in reference modification, arithmetic expressions, and conditions. These two parameters always code together.

For example -
MOVE WS-VAR(1:10)            TO WS-VAR1.
COMPUTE WS-A = (WS-A + WS-B) - WS-C.
IF (WS-A > WS-B)
:ColonUses in reference modification and COPY statement with REPLACING.

For example -
MOVE WS-VAR(1:10)            TO WS-VAR1.
COPY copybook-name REPLACING 
    ==:WS:== BY ==WS1==.
"Quotation markThey delimit non-numeric literals, except when the literal is continued in more than one line. One quotation should always end with the same quotation.

For example -
  01 WS-VAR1       PIC X(20) 
                VALUE "THIS IS LITERAL".
'ApostropheThey delimit non-numeric literals, except when the literal is continued in more than one line. One apostrophe should always end with the same apostrophe.

For example -
  01 WS-VAR1       PIC X(20) 
	            VALUE 'THIS IS LITERAL'.
==Pseudo-text delimiterIt uses to replace the string with a COPY statement.

For example -
COPY copybook-name REPLACING 
    ==:WS:== BY ==WS1==.
Note!
  • Single space or multiple spaces can be used anywhere as a separator.
  • The separators can use as – Space {b}, Period {.b}, Comma {,b}, Semicolon {;b}, Parentheses { ( } ... { ) }, Colon { : }, Quotation marks {"} ... {"}, Apostrophes {'} ... {'} and Pseudo-text delimiters {b==} ... {==b}. b represents the blank or space.