Rules for separators
A separator is a string of one or more punctuation characters.
In the following description, {} (curly braces) enclose each separator, and b represents a space. Anywhere a space is used as a separator or as part of a separator, more than one space can be used.
- Space {b}
- A space can immediately precede or follow any separator except:
- The opening pseudo-text delimiter, where the preceding space is required.
- Within quotation marks. Spaces between quotation marks are considered part of the alphanumeric literal; they are not considered separators.
- Period {.b}, Comma {,b}, Semicolon {;b}
- A separator comma is composed of a comma followed by a space.
A separator period is composed of a period followed by a space. A
separator semicolon is composed of a semicolon followed by a space.
The separator period must be used only to indicate the end of a sentence, or as shown in formats. The separator comma and separator semicolon can be used anywhere the separator space is used.
- In the IDENTIFICATION DIVISION, each paragraph must end with a separator period.
- In the ENVIRONMENT DIVISION, the SOURCE-COMPUTER, OBJECT-COMPUTER, SPECIAL-NAMES, and I-O-CONTROL paragraphs must each end with a separator period. In the FILE-CONTROL paragraph, each file-control entry must end with a separator period.
- In the DATA DIVISION, file (FD), sort/merge file (SD), and data description entries must each end with a separator period.
- In the PROCEDURE DIVISION, separator commas or separator semicolons can separate statements within a sentence and operands within a statement. Each sentence and each procedure must end with a separator period.
- Parentheses { ( } ... { ) }
- Except in pseudo-text, parentheses can appear only in balanced pairs of left and right parentheses. They delimit subscripts, a list of function arguments, reference-modifiers, arithmetic expressions, or conditions.
- Colon { : }
- The colon is a separator and is required when shown in general formats.
- Quotation marks {
"
} ... {"
} - An opening quotation mark must be immediately preceded by a space or a left parenthesis. A closing quotation mark must be immediately followed by a separator space, comma, semicolon, period, right parenthesis, or pseudo-text delimiter. Quotation marks must appear as balanced pairs. They delimit alphanumeric literals, except when the literal is continued (see Continuation lines).
- Apostrophes {
'
} ... {'
} - An opening apostrophe must be immediately preceded by a space or a left parenthesis. A closing apostrophe must be immediately followed by a separator space, comma, semicolon, period, right parenthesis, or pseudo-text delimiter. Apostrophes must appear as balanced pairs. They delimit alphanumeric literals, except when the literal is continued (see Continuation lines).
- Null-terminated literal delimiters {
Z"
} ... {"
}, {Z'
} ... {'
} - The opening delimiter must be immediately preceded by a space or a left parenthesis. The closing delimiter must be immediately followed by a separator space, comma, semicolon, period, right parenthesis, or pseudo-text delimiter.
- DBCS literal delimiters {
G"
} ... {"
}, {G'
} ... {'
}, {N"
} ... {"
}, {N'
} ... {'
} - The opening delimiter must be immediately preceded by a space
or a left parenthesis. The closing delimiter must be immediately followed
by a separator space, comma, semicolon, period, right parenthesis,
or pseudo-text delimiter.
N"
andN'
are DBCS literal delimiters when the NSYMBOL(DBCS) compiler option is in effect. - UTF-8 literal delimiters {
U"
} ... {"
}, {U'
} ... {'
}, {UX"
} ... {"
}, {UX'
} ... {'
} - The opening delimiter must be immediately preceded by a space or a left parenthesis. The closing delimiter must be immediately followed by a separator space, comma, semicolon, period, right parenthesis, or pseudo-text delimiter.
- National literal delimiters {
N"
} ... {"
}, {N'
} ... {'
}, {NX"
} ... {"
}, {NX'
} ... {'
} - The opening delimiter must be immediately preceded by a space
or a left parenthesis. The closing delimiter must be immediately followed
by a separator space, comma, semicolon, period, right parenthesis,
or pseudo-text delimiter.
N"
andN'
are DBCS literal delimiters when the NSYMBOL(DBCS) compiler option is in effect. - Pseudo-text delimiters {b==} ... {==b}
- An opening pseudo-text delimiter must be immediately preceded by a space. A closing pseudo-text delimiter must be immediately followed by a separator space, comma, semicolon, or period. Pseudo-text delimiters must appear as balanced pairs. They delimit pseudo-text. (See COPY statement.)
Any punctuation character included in a PICTURE character-string, a comment character-string, or an alphanumeric literal is not considered a punctuation character, but is part of the character-string or literal.