This grammar has been been recovered from IBM's VS COBOL II Reference Summary (Document Number: SX26-3721-05) in a semi-automatic, formal process. In this unique process, many problems in the IBM document have been detected and fixed in a traceable way. The process is described by the authors of the grammar in the paper Semi-automatic Grammar Recovery (HTML, Postscript, Pdf). The process builds upon previous work of the authors in the field of program transformation, reverse engineering and specification environments. Note that the grammar should be regarded as a specification (of context-free syntax + lexical syntax) rather than a realistic parser + scanner description. So, for example, issues usually handled by a pre-processor are not covered by the formal definition. Also, the grammar specification is still ambigious. However, from this grammar we automatically derived a prototype parser. The grammar has been tested for large test sets of COBOL code: 8 test sets from different countries with 1.819.765 LOC (before preprocessing: 1.631.825) or 109.697.736 BYTES (before preprocessing: 113.481.950).
If you have any remark or a question, contact the authors of this grammar: Ralf Lämmel (CWI, Amsterdam, Email: ralf@cwi.nl) & Chris Verhoef (WINS, Universiteit van Amsterdam, Email: x@wins.uva.nl). This is Version 1.0.3 of the grammar. It has been released on May, 2nd, 2000. Version 1.0 (i.e., the first version) of the grammar has been released on December, 3rd, 1999. Refer to the ChangeLog for details. This document is maintained by Ralf Lämmel.
Acknowledgement
Many thanks to Bob Diertens for helping us with preprocessing the test sets.
Many thanks to Peter Aarnoutse for the answers to our COBOL questions.
The system LDL
supporting language-centric software protoyping has been used for
nearly all aspects of specification/implementation in this project,
namely grammar recovery, parsing test sets, generation of the actual
browsable grammar.
cobol-source-program | = | ( "IDENTIFICATION" | "ID" ) "DIVISION" "." program-id-cobol-source-program |
[ identification-division-content ] | ||
[ "ENVIRONMENT" "DIVISION" "." environment-division-content ] | ||
[ "DATA" "DIVISION" "." data-division-content ] | ||
[ procedure-division ] | ||
[ { nested-cobol-source-program }* "END" "PROGRAM" program-name "." ] |
program-id-cobol-source-program | = | "PROGRAM-ID" [ "." ] program-name |
[ [ "IS" ] "INITIAL" [ "PROGRAM" ] ] [ "." ] |
nested-cobol-source-program | = | ( "IDENTIFICATION" | "ID" ) "DIVISION" "." program-id-nested-cobol-source-program |
[ identification-division-content ] | ||
[ "ENVIRONMENT" "DIVISION" "." environment-division-content ] | ||
[ "DATA" "DIVISION" "." data-division-content ] | ||
[ procedure-division ] | ||
{ nested-cobol-source-program }* "END" "PROGRAM" program-name "." |
program-id-nested-cobol-source-program | = | "PROGRAM-ID" [ "." ] program-name |
[ [ "IS" ] ( "COMMON" [ "INITIAL" ] | "INITIAL" [ "COMMON" ] ) [ "PROGRAM" ] ] [ "." ] |
identification-division-content | = | ( [ "AUTHOR" [ "." ] { comment-entry }* ] |
|| [ "INSTALLATION" [ "." ] { comment-entry }* ] | ||
|| [ "DATE-WRITTEN" [ "." ] { comment-entry }* ] | ||
|| [ "DATE-COMPILED" [ "." ] { comment-entry }* ] | ||
|| [ "SECURITY" [ "." ] { comment-entry }* ] ) |
environment-division-content | = | [ configuration-section ] [ input-output-section ] |
configuration-section | = | "CONFIGURATION" "SECTION" "." configuration-section-paragraphs |
configuration-section-paragraphs | = | [ source-computer-paragraph ] [ object-computer-paragraph ] |
[ special-names-paragraph ] |
source-computer-paragraph | = | "SOURCE-COMPUTER" "." |
[ computer-name [ [ "WITH" ] "DEBUGGING" "MODE" ] "." ] |
object-computer-paragraph | = | "OBJECT-COMPUTER" "." |
[ computer-name [ "MEMORY" [ "SIZE" ] integer ( "WORDS" | "CHARACTERS" | "MODULES" ) ] object-computer-paragraph-sequence-phrase "." ] |
object-computer-paragraph-sequence-phrase | = | [ [ "PROGRAM" ] [ "COLLATING" ] "SEQUENCE" [ "IS" ] alphabet-name ] |
[ "SEGMENT-LIMIT" [ "IS" ] priority-number ] |
special-names-paragraph | = | "SPECIAL-NAMES" "." { ( environment-name [ "IS" ] mnemonic-name | environment-name ( [ "IS" ] mnemonic-name [ special-names-paragraph-status-phrase ] | special-names-paragraph-status-phrase ) ) }* |
special-names-paragraph-clauses [ "." ] |
special-names-paragraph-clauses | = | ( { alphabet-clause }* |
|| { symbolic-characters-clause }* | ||
|| { class-clause }* | ||
|| [ currency-sign-clause ] | ||
|| [ decimal-point-clause ] ) |
alphabet-clause | = | "ALPHABET" alphabet-name [ "IS" ] ( "STANDARD-1" | "STANDARD-2" | "NATIVE" | "EBCDIC" | { literal [ ( ( "THROUGH" | "THRU" ) literal | { "ALSO" literal }+ ) ] }+ ) |
symbolic-characters-clause | = | "SYMBOLIC" [ "CHARACTERS" ] { { symbolic-character }+ [ ( "ARE" | "IS" ) ] { integer }+ }+ [ "IN" alphabet-name ] |
class-clause | = | "CLASS" class-name [ "IS" ] { literal [ ( "THROUGH" | "THRU" ) literal ] }+ |
currency-sign-clause | = | "CURRENCY" [ "SIGN" ] [ "IS" ] literal |
decimal-point-clause | = | "DECIMAL-POINT" [ "IS" ] "COMMA" |
special-names-paragraph-status-phrase | = | ( "ON" [ "STATUS" ] [ "IS" ] condition [ "OFF" [ "STATUS" ] [ "IS" ] condition ] | "OFF" [ "STATUS" ] [ "IS" ] condition [ "ON" [ "STATUS" ] [ "IS" ] condition ] ) |
input-output-section | = | "INPUT-OUTPUT" "SECTION" "." [ file-control-paragraph ] |
[ i-o-control-paragraph ] |
file-control-paragraph | = | "FILE-CONTROL" "." |
{ file-control-entry }* |
file-control-entry | = | select-clause assign-clause |
( [ reserve-clause ] | ||
|| [ [ "ORGANIZATION" [ "IS" ] ] "SEQUENTIAL" ] | ||
|| [ padding-character-clause ] | ||
|| [ record-delimiter-clause ] | ||
|| [ "ACCESS" [ "MODE" ] [ "IS" ] "SEQUENTIAL" ] | ||
|| [ password-clause ] | ||
|| [ file-status-clause ] ) "." |
file-control-entry | = | select-clause assign-clause |
( [ reserve-clause ] | ||
|| [ "ORGANIZATION" [ "IS" ] ] "RELATIVE" | ||
|| [ "ACCESS" [ "MODE" ] [ "IS" ] ( "SEQUENTIAL" [ relative-key-clause ] | ( "RANDOM" | "DYNAMIC" ) relative-key-clause ) ] | ||
|| [ password-clause ] | ||
|| [ file-status-clause ] ) "." |
file-control-entry | = | select-clause assign-clause |
( [ reserve-clause ] | ||
|| [ "ORGANIZATION" [ "IS" ] ] "INDEXED" | ||
|| [ "ACCESS" [ "MODE" ] [ "IS" ] ( "SEQUENTIAL" | "RANDOM" | "DYNAMIC" ) ] | ||
|| record-key-clause | ||
|| [ password-clause ] | ||
|| { alternate-record-key-clause }* | ||
|| [ file-status-clause ] ) "." |
select-clause | = | "SELECT" [ "OPTIONAL" ] file-name |
assign-clause | = | "ASSIGN" [ "TO" ] { ( assignment-name | literal ) }+ |
reserve-clause | = | "RESERVE" integer [ ( "AREA" | "AREAS" ) ] |
padding-character-clause | = | "PADDING" [ "CHARACTER" ] [ "IS" ] ( qualified-data-name | literal ) |
record-delimiter-clause | = | "RECORD" "DELIMITER" [ "IS" ] ( "STANDARD-1" | assignment-name ) |
record-key-clause | = | "RECORD" [ "KEY" ] [ "IS" ] qualified-data-name |
alternate-record-key-clause | = | "ALTERNATE" [ "RECORD" ] [ "KEY" ] [ "IS" ] qualified-data-name |
[ password-clause ] [ [ "WITH" ] "DUPLICATES" ] |
relative-key-clause | = | "RELATIVE" [ "KEY" ] [ "IS" ] qualified-data-name |
password-clause | = | "PASSWORD" [ "IS" ] data-name |
file-status-clause | = | [ "FILE" ] "STATUS" [ "IS" ] qualified-data-name [ qualified-data-name ] |
i-o-control-paragraph | = | "I-O-CONTROL" "." [ { ( qsam-or-sam-i-o-control-entries | vsam-i-o-control-entries ) }+ "." ] |
[ sort-merge-i-o-control-entries "." ] |
qsam-or-sam-i-o-control-entries | = | ( "RERUN" "ON" ( assignment-name | file-name ) [ "EVERY" ] ( integer "RECORDS" | "END" [ "OF" ] ( "REEL" | "UNIT" ) ) [ "OF" ] file-name | "SAME" [ "RECORD" ] [ "AREA" ] [ "FOR" ] file-name { file-name }+ | "MULTIPLE" "FILE" [ "TAPE" ] [ "CONTAINS" ] { file-name [ "POSITION" integer ] }+ | "APPLY" "WRITE-ONLY" [ "ON" ] { file-name }+ ) |
vsam-i-o-control-entries | = | ( "RERUN" "ON" ( assignment-name | file-name ) [ "EVERY" ] integer "RECORDS" [ "OF" ] file-name | "SAME" [ "RECORD" ] [ "AREA" ] [ "FOR" ] file-name { file-name }+ ) |
sort-merge-i-o-control-entries | = | [ "RERUN" "ON" assignment-name ] |
{ "SAME" ( "RECORD" | "SORT" | "SORT-MERGE" ) [ "AREA" ] [ "FOR" ] file-name { file-name }+ }+ |
data-division-content | = | [ "FILE" "SECTION" "." { file-and-sort-description-entry { record-description-entry }+ }* ] |
[ "WORKING-STORAGE" "SECTION" "." { ( record-description-entry | data-item-description-entry ) }* ] | ||
[ "LINKAGE" "SECTION" "." { ( record-description-entry | data-item-description-entry ) }* ] |
data-item-description-entry | = | data-description-entry |
record-description-entry | = | data-description-entry |
file-and-sort-description-entry | = | ( "FD" | "SD" ) file-name file-and-sort-description-entry-clauses "." |
file-and-sort-description-entry-clauses | = | ( [ external-clause ] |
|| [ global-clause ] | ||
|| [ block-contains-clause ] | ||
|| [ record-clause ] | ||
|| [ label-records-clause ] | ||
|| [ value-of-clause ] | ||
|| [ data-records-clause ] | ||
|| [ linage-clause ] | ||
|| [ recording-mode-clause ] | ||
|| [ code-set-clause ] ) |
external-clause | = | [ "IS" ] "EXTERNAL" |
global-clause | = | [ "IS" ] "GLOBAL" |
block-contains-clause | = | "BLOCK" [ "CONTAINS" ] [ ( integer | zero ) "TO" ] ( integer | zero ) [ ( "CHARACTERS" | "RECORDS" ) ] |
record-clause | = | "RECORD" |
( [ "CONTAINS" ] ( integer | zero ) [ "CHARACTERS" ] | ||
| [ "CONTAINS" ] ( integer | zero ) "TO" ( integer | zero ) [ "CHARACTERS" ] | ||
| record-varying-phrase [ "DEPENDING" [ "ON" ] data-name ] | ||
) |
record-varying-phrase | = | [ "IS" ] "VARYING" [ "IN" ] [ "SIZE" ] [ [ "FROM" ] integer ] [ "TO" integer ] [ "CHARACTERS" ] |
label-records-clause | = | "LABEL" ( "RECORD" [ "IS" ] | "RECORDS" [ "ARE" ] ) ( "STANDARD" | "OMITTED" | { data-name }+ ) |
value-of-clause | = | "VALUE" "OF" { system-name [ "IS" ] ( qualified-data-name | literal ) }+ |
data-records-clause | = | "DATA" ( "RECORD" [ "IS" ] | "RECORDS" [ "ARE" ] ) { data-name }+ |
linage-clause | = | "LINAGE" [ "IS" ] ( data-name | integer ) [ "LINES" ] linage-footing-phrase |
linage-footing-phrase | = | [ [ "WITH" ] "FOOTING" [ "AT" ] ( data-name | integer ) ] [ [ "LINES" ] [ "AT" ] "TOP" ( data-name | integer ) ] |
[ [ "LINES" ] [ "AT" ] "BOTTOM" ( data-name | integer ) ] |
recording-mode-clause | = | "RECORDING" [ "MODE" ] [ "IS" ] mode |
code-set-clause | = | "CODE-SET" [ "IS" ] alphabet-name |
data-description-entry | = | level-number [ ( data-name | "FILLER" ) ] data-description-entry-clauses "." |
data-description-entry | = | "66" data-name renames-clause "." |
data-description-entry | = | "88" condition-name condition-value-clause "." |
data-description-entry-clauses | = | ( [ redefines-clause ] |
|| [ blank-when-zero-clause ] | ||
|| [ external-clause ] | ||
|| [ global-clause ] | ||
|| [ justified-clause ] | ||
|| [ occurs-clause ] | ||
|| [ picture-clause ] | ||
|| [ sign-clause ] | ||
|| [ synchronized-clause ] | ||
|| [ usage-clause ] | ||
|| [ data-value-clause ] ) |
redefines-clause | = | "REDEFINES" data-name |
blank-when-zero-clause | = | "BLANK" [ "WHEN" ] ( "ZERO" | "ZEROS" | "ZEROES" ) |
justified-clause | = | ( "JUSTIFIED" | "JUST" ) [ "RIGHT" ] |
occurs-clause | = | "OCCURS" integer [ "TIMES" ] |
{ ( "ASCENDING" | "DESCENDING" ) [ "KEY" ] [ "IS" ] { qualified-data-name }+ }* | ||
[ "INDEXED" [ "BY" ] { index-name }+ ] |
occurs-clause | = | "OCCURS" [ ( integer | zero ) "TO" ] integer [ "TIMES" ] "DEPENDING" |
[ "ON" ] qualified-data-name | ||
{ ( "ASCENDING" | "DESCENDING" ) [ "KEY" ] [ "IS" ] { qualified-data-name }+ }* | ||
[ "INDEXED" [ "BY" ] { index-name }+ ] |
picture-clause | = | ( "PICTURE" | "PIC" ) [ "IS" ] picture-string |
sign-clause | = | [ "SIGN" [ "IS" ] ] ( "LEADING" | "TRAILING" ) [ "SEPARATE" [ "CHARACTER" ] ] |
synchronized-clause | = | ( "SYNCHRONIZED" | "SYNC" ) [ ( "LEFT" | "RIGHT" ) ] |
usage-clause | = | [ "USAGE" [ "IS" ] ] ( "BINARY" | "COMP" | "COMP-1" | "COMP-2" | "COMP-3" | "COMP-4" | "COMPUTATIONAL" | "COMPUTATIONAL-1" | "COMPUTATIONAL-2" | "COMPUTATIONAL-3" | "COMPUTATIONAL-4" | "DISPLAY" | "DISPLAY-1" | "INDEX" | "PACKED-DECIMAL" | "POINTER" ) |
condition-value-clause | = | ( "VALUE" [ "IS" ] | "VALUES" [ "ARE" ] ) { literal [ ( "THROUGH" | "THRU" ) literal ] }+ |
data-value-clause | = | "VALUE" [ "IS" ] literal |
renames-clause | = | "RENAMES" qualified-data-name [ ( "THROUGH" | "THRU" ) qualified-data-name ] |
procedure-division | = | "PROCEDURE" "DIVISION" [ "USING" { data-name }+ ] "." |
[ "DECLARATIVES" "." { section-header "." use-statement "." paragraphs }+ "END" "DECLARATIVES" "." ] | ||
sections |
procedure-division | = | "PROCEDURE" "DIVISION" [ "USING" { data-name }+ ] "." |
paragraphs |
sections | = | paragraphs { section-header "." paragraphs }* |
section-header | = | section-name "SECTION" [ priority-number ] |
paragraphs | = | { sentence }* { paragraph }* |
paragraph | = | paragraph-name "." { sentence }* |
paragraph | = | altered-goto |
sentence | = | statement-list "." |
statement-list | = | { statement }+ |
accept-statement | = | "ACCEPT" identifier [ "FROM" ( mnemonic-name | environment-name ) ] |
accept-statement | = | "ACCEPT" identifier "FROM" ( "DATE" | "DAY" | "DAY-OF-WEEK" | "TIME" ) |
add-statement | = | "ADD" { ( identifier | literal ) }+ "TO" { identifier [ "ROUNDED" ] }+ |
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-ADD" ] |
add-statement | = | "ADD" { ( identifier | literal ) }+ [ "TO" ] ( identifier | literal ) |
"GIVING" { identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-ADD" ] |
add-statement | = | "ADD" ( "CORRESPONDING" | "CORR" ) identifier "TO" identifier |
[ "ROUNDED" ] [ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-ADD" ] |
alter-statement | = | "ALTER" |
{ procedure-name "TO" [ "PROCEED" "TO" ] procedure-name }+ |
call-statement | = | "CALL" ( identifier | literal ) |
[ "USING" { ( [ [ "BY" ] "REFERENCE" ] { ( identifier | "ADDRESS" "OF" identifier | file-name ) }+ | [ "BY" ] "CONTENT" { ( [ "LENGTH" "OF" ] identifier | "ADDRESS" "OF" identifier | literal ) }+ ) }+ ] | ||
[ [ "ON" ] "OVERFLOW" statement-list ] [ "END-CALL" ] |
call-statement | = | "CALL" ( identifier | literal ) |
[ "USING" { ( [ [ "BY" ] "REFERENCE" ] { ( identifier | "ADDRESS" "OF" identifier | file-name ) }+ | [ "BY" ] "CONTENT" { ( [ "LENGTH" "OF" ] identifier | "ADDRESS" "OF" identifier | literal ) }+ ) }+ ] | ||
[ [ "ON" ] "EXCEPTION" statement-list ] | ||
[ "NOT" [ "ON" ] "EXCEPTION" statement-list ] [ "END-CALL" ] |
cancel-statement | = | "CANCEL" { ( identifier | literal ) }+ |
close-statement | = | "CLOSE" |
{ file-name [ ( ( "REEL" | "UNIT" ) [ ( [ "FOR" ] "REMOVAL" | [ "WITH" ] "NO" "REWIND" ) ] | [ "WITH" ] ( "NO" "REWIND" | "LOCK" ) ) ] }+ |
close-statement | = | "CLOSE" { file-name [ [ "WITH" ] "LOCK" ] }+ |
compute-statement | = | "COMPUTE" { identifier [ "ROUNDED" ] }+ ( "=" | "EQUAL" ) |
arithmetic-expression | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-COMPUTE" ] |
continue-statement | = | "CONTINUE" |
delete-statement | = | "DELETE" file-name [ "RECORD" ] |
[ "INVALID" [ "KEY" ] statement-list ] | ||
[ "NOT" "INVALID" [ "KEY" ] statement-list ] | ||
[ "END-DELETE" ] |
display-statement | = | "DISPLAY" { ( identifier | literal ) }+ |
[ "UPON" ( mnemonic-name | environment-name ) ] | ||
[ [ "WITH" ] "NO" "ADVANCING" ] |
divide-statement | = | "DIVIDE" ( identifier | literal ) "INTO" { identifier [ "ROUNDED" ] }+ |
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-DIVIDE" ] |
divide-statement | = | "DIVIDE" ( identifier | literal ) "INTO" ( identifier | literal ) |
"GIVING" { identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-DIVIDE" ] |
divide-statement | = | "DIVIDE" ( identifier | literal ) "BY" ( identifier | literal ) |
"GIVING" { identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-DIVIDE" ] |
divide-statement | = | "DIVIDE" ( identifier | literal ) "INTO" ( identifier | literal ) |
"GIVING" identifier [ "ROUNDED" ] "REMAINDER" identifier | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-DIVIDE" ] |
divide-statement | = | "DIVIDE" ( identifier | literal ) "BY" ( identifier | literal ) |
"GIVING" identifier [ "ROUNDED" ] "REMAINDER" identifier | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-DIVIDE" ] |
entry-statement | = | "ENTRY" literal [ "USING" { data-name }+ ] |
evaluate-statement | = | "EVALUATE" ( identifier | literal | arithmetic-expression | condition | "TRUE" | "FALSE" ) { "ALSO" ( identifier | literal | arithmetic-expression | condition | "TRUE" | "FALSE" ) }* |
{ { "WHEN" evaluate-phrase { "ALSO" evaluate-phrase }* }+ statement-list }+ | ||
[ "WHEN" "OTHER" statement-list ] [ "END-EVALUATE" ] |
evaluate-phrase | = | ( "ANY" | condition | "TRUE" | "FALSE" | [ "NOT" ] ( identifier | literal | arithmetic-expression ) [ ( "THROUGH" | "THRU" ) ( identifier | literal | arithmetic-expression ) ] ) |
exit-statement | = | "EXIT" |
exit-program-statement | = | "EXIT" "PROGRAM" |
goback-statement | = | "GOBACK" |
go-to-statement | = | "GO" [ "TO" ] procedure-name |
go-to-statement | = | "GO" [ "TO" ] "MORE-LABELS" |
go-to-statement | = | "GO" [ "TO" ] { procedure-name }+ "DEPENDING" [ "ON" ] |
identifier |
altered-goto | = | paragraph-name "." "GO" [ "TO" ] "." |
if-statement | = | "IF" condition [ "THEN" ] ( { statement }+ | "NEXT" "SENTENCE" ) |
[ "ELSE" ( { statement }+ | "NEXT" "SENTENCE" ) ] [ "END-IF" ] |
initialize-statement | = | "INITIALIZE" { identifier }+ |
[ "REPLACING" { ( "ALPHABETIC" | "ALPHANUMERIC" | "NUMERIC" | "ALPHANUMERIC-EDITED" | "NUMERIC-EDITED" | "DBCS" | "EGCS" ) [ "DATA" ] "BY" ( identifier | literal ) }+ ] |
inspect-statement | = | "INSPECT" identifier "TALLYING" |
{ identifier "FOR" { ( "CHARACTERS" { before-after-phrase }* | ( "ALL" | "LEADING" ) { ( identifier | literal ) { before-after-phrase }* }+ ) }+ }+ |
inspect-statement | = | "INSPECT" identifier "CONVERTING" ( identifier | literal ) "TO" |
( identifier | literal ) { before-after-phrase }* |
inspect-statement | = | "INSPECT" identifier "TALLYING" |
{ identifier "FOR" { ( "CHARACTERS" { before-after-phrase }* | ( "ALL" | "LEADING" ) { ( identifier | literal ) { before-after-phrase }* }+ ) }+ }+ "REPLACING" | ||
{ ( "CHARACTERS" "BY" ( identifier | literal ) { before-after-phrase }* | ( "ALL" | "LEADING" | "FIRST" ) { ( identifier | literal ) "BY" ( identifier | literal ) { before-after-phrase }* }+ ) }+ |
inspect-statement | = | "INSPECT" identifier "REPLACING" |
{ ( "CHARACTERS" "BY" ( identifier | literal ) { before-after-phrase }* | ( "ALL" | "LEADING" | "FIRST" ) { ( identifier | literal ) "BY" ( identifier | literal ) { before-after-phrase }* }+ ) }+ |
before-after-phrase | = | ( "BEFORE" | "AFTER" ) [ "INITIAL" ] ( identifier | literal ) |
merge-statement | = | "MERGE" file-name { [ "ON" ] ( "ASCENDING" | "DESCENDING" ) [ "KEY" ] { qualified-data-name }+ }+ |
[ [ "COLLATING" ] "SEQUENCE" [ "IS" ] alphabet-name ] "USING" file-name { file-name }+ | ||
( "OUTPUT" "PROCEDURE" [ "IS" ] procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] | "GIVING" { file-name }+ ) |
move-statement | = | "MOVE" ( identifier | literal ) "TO" { identifier }+ |
move-statement | = | "MOVE" ( "CORRESPONDING" | "CORR" ) identifier "TO" { identifier }+ |
multiply-statement | = | "MULTIPLY" ( identifier | literal ) "BY" { identifier [ "ROUNDED" ] }+ |
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-MULTIPLY" ] |
multiply-statement | = | "MULTIPLY" ( identifier | literal ) "BY" ( identifier | literal ) |
"GIVING" { identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-MULTIPLY" ] |
open-statement | = | "OPEN" { ( "INPUT" { file-name [ ( "REVERSED" | [ "WITH" ] "NO" "REWIND" ) ] }+ | "OUTPUT" { file-name [ [ "WITH" ] "NO" "REWIND" ] }+ | "I-O" { file-name }+ | "EXTEND" { file-name }+ ) }+ |
open-statement | = | "OPEN" { ( "INPUT" { file-name }+ | "OUTPUT" { file-name }+ | "I-O" { file-name }+ | "EXTEND" { file-name }+ ) }+ |
perform-statement | = | "PERFORM" |
( procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] | statement-list "END-PERFORM" ) |
perform-statement | = | "PERFORM" ( procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] perform-varying-phrase perform-after-phrase | perform-varying-phrase statement-list "END-PERFORM" ) |
perform-statement | = | "PERFORM" ( procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] ( identifier | integer ) "TIMES" | ( identifier | integer ) "TIMES" statement-list "END-PERFORM" ) |
perform-statement | = | "PERFORM" |
( procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] perform-until-phrase | perform-until-phrase statement-list "END-PERFORM" ) |
perform-until-phrase | = | [ [ "WITH" ] "TEST" ( "BEFORE" | "AFTER" ) ] "UNTIL" condition |
perform-varying-phrase | = | [ [ "WITH" ] "TEST" ( "BEFORE" | "AFTER" ) ] "VARYING" ( identifier | index-name ) "FROM" ( identifier | index-name | literal ) "BY" ( identifier | literal ) "UNTIL" |
condition |
perform-after-phrase | = | { "AFTER" ( identifier | index-name ) "FROM" ( identifier | index-name | literal ) "BY" ( identifier | literal ) "UNTIL" condition }* |
read-statement | = | "READ" file-name [ "NEXT" ] [ "RECORD" ] |
[ "INTO" identifier ] | ||
[ [ "AT" ] "END" statement-list ] | ||
[ "NOT" [ "AT" ] "END" statement-list ] [ "END-READ" ] |
read-statement | = | "READ" file-name [ "RECORD" ] [ "INTO" identifier ] |
[ "KEY" [ "IS" ] qualified-data-name ] | ||
[ "INVALID" [ "KEY" ] statement-list ] | ||
[ "NOT" "INVALID" [ "KEY" ] statement-list ] [ "END-READ" ] |
release-statement | = | "RELEASE" record-name [ "FROM" identifier ] |
return-statement | = | "RETURN" file-name [ "RECORD" ] [ "INTO" identifier ] |
[ "AT" ] "END" statement-list | ||
[ "NOT" [ "AT" ] "END" statement-list ] [ "END-RETURN" ] |
rewrite-statement | = | "REWRITE" record-name [ "FROM" identifier ] |
[ "INVALID" [ "KEY" ] statement-list ] | ||
[ "NOT" "INVALID" [ "KEY" ] statement-list ] | ||
[ "END-REWRITE" ] |
search-statement | = | "SEARCH" identifier [ "VARYING" ( identifier | index-name ) ] |
[ [ "AT" ] "END" statement-list ] | ||
{ "WHEN" condition ( statement-list | "NEXT" "SENTENCE" ) }+ | ||
[ "END-SEARCH" ] |
search-statement | = | "SEARCH" "ALL" identifier [ [ "AT" ] "END" statement-list ] |
"WHEN" ( qualified-data-name [ "IS" ] ( "EQUAL" [ "TO" ] | "=" ) ( identifier | literal | arithmetic-expression ) | condition-name-reference ) | ||
{ "AND" ( qualified-data-name [ "IS" ] ( "EQUAL" [ "TO" ] | "=" ) ( identifier | literal | arithmetic-expression ) | condition-name-reference ) }* | ||
( statement-list | "NEXT" "SENTENCE" ) [ "END-SEARCH" ] |
set-statement | = | "SET" { ( index-name | identifier ) }+ "TO" ( index-name | identifier | integer ) |
set-statement | = | "SET" { index-name }+ ( "UP" "BY" | "DOWN" "BY" ) ( identifier | integer ) |
set-statement | = | "SET" { { mnemonic-name }+ "TO" ( "ON" | "OFF" ) }+ |
set-statement | = | "SET" { condition-name-reference }+ "TO" "TRUE" |
set-statement | = | "SET" { ( identifier | "ADDRESS" "OF" identifier ) }+ |
"TO" ( identifier | "ADDRESS" "OF" identifier | "NULL" | "NULLS" ) |
sort-statement | = | "SORT" file-name { [ "ON" ] ( "ASCENDING" | "DESCENDING" ) [ "KEY" ] { qualified-data-name }+ }+ |
[ [ "WITH" ] "DUPLICATES" [ "IN" ] [ "ORDER" ] ] | ||
[ [ "COLLATING" ] "SEQUENCE" [ "IS" ] alphabet-name ] | ||
( "USING" { file-name }+ | "INPUT" "PROCEDURE" [ "IS" ] procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] ) | ||
( "GIVING" { file-name }+ | "OUTPUT" "PROCEDURE" [ "IS" ] procedure-name [ ( "THROUGH" | "THRU" ) procedure-name ] ) |
start-statement | = | "START" file-name |
[ "KEY" [ "IS" ] ( "EQUAL" [ "TO" ] | "=" | "GREATER" [ "THAN" ] | ">" | "NOT" "LESS" [ "THAN" ] | "NOT" "<" | "GREATER" [ "THAN" ] "OR" "EQUAL" [ "TO" ] | ">=" ) qualified-data-name ] | ||
[ "INVALID" [ "KEY" ] statement-list ] | ||
[ "NOT" "INVALID" [ "KEY" ] statement-list ] [ "END-START" ] |
stop-statement | = | "STOP" ( "RUN" | literal ) |
string-statement | = | "STRING" |
{ { ( identifier | literal ) }+ "DELIMITED" [ "BY" ] ( identifier | literal | "SIZE" ) }+ | ||
"INTO" identifier [ [ "WITH" ] "POINTER" identifier ] | ||
[ [ "ON" ] "OVERFLOW" statement-list ] | ||
[ "NOT" [ "ON" ] "OVERFLOW" statement-list ] | ||
[ "END-STRING" ] |
subtract-statement | = | "SUBTRACT" { ( identifier | literal ) }+ "FROM" |
{ identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-SUBTRACT" ] |
subtract-statement | = | "SUBTRACT" { ( identifier | literal ) }+ "FROM" ( identifier | literal ) |
"GIVING" { identifier [ "ROUNDED" ] }+ | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-SUBTRACT" ] |
subtract-statement | = | "SUBTRACT" ( "CORRESPONDING" | "CORR" ) identifier "FROM" |
identifier [ "ROUNDED" ] | ||
[ [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "NOT" [ "ON" ] "SIZE" "ERROR" statement-list ] | ||
[ "END-SUBTRACT" ] |
unstring-statement | = | "UNSTRING" identifier |
[ "DELIMITED" [ "BY" ] [ "ALL" ] ( identifier | literal ) { "OR" [ "ALL" ] ( identifier | literal ) }* ] "INTO" | ||
{ identifier [ "DELIMITER" [ "IN" ] identifier ] [ "COUNT" [ "IN" ] identifier ] }+ | ||
[ [ "WITH" ] "POINTER" identifier ] [ "TALLYING" [ "IN" ] identifier ] | ||
[ [ "ON" ] "OVERFLOW" statement-list ] [ "NOT" [ "ON" ] "OVERFLOW" statement-list ] | ||
[ "END-UNSTRING" ] |
write-statement | = | "WRITE" record-name [ "FROM" identifier ] |
( [ ( "BEFORE" | "AFTER" ) [ "ADVANCING" ] ( ( identifier | integer ) [ ( "LINE" | "LINES" ) ] | mnemonic-name | "PAGE" ) ] write-statement-phrase | [ "INVALID" [ "KEY" ] statement-list ] [ "NOT" "INVALID" [ "KEY" ] statement-list ] ) [ "END-WRITE" ] |
write-statement | = | "WRITE" record-name [ "FROM" identifier ] |
[ "INVALID" [ "KEY" ] statement-list ] | ||
[ "NOT" "INVALID" [ "KEY" ] statement-list ] | ||
[ "END-WRITE" ] |
write-statement | = | "WRITE" record-name [ "FROM" identifier ] [ "END-WRITE" ] |
write-statement-phrase | = | [ [ "AT" ] ( "END-OF-PAGE" | "EOP" ) statement-list ] [ "NOT" [ "AT" ] ( "END-OF-PAGE" | "EOP" ) statement-list ] |
basis-statement | = | [ sequence-number ] "BASIS" ( basis-name | literal ) |
cbl-process-statement | = | ( "CBL" | "PROCESS" ) [ options-list ] |
control-cbl-statement | = | ( "*CONTROL" | "*CBL" ) { ( "SOURCE" | "NOSOURCE" | "LIST" | "NOLIST" | "MAP" | "NOMAP" ) }+ [ "." ] |
copy-statement | = | "COPY" ( text-name | literal ) [ ( "OF" | "IN" ) ( library-name | literal ) ] |
[ "SUPPRESS" ] | ||
[ "REPLACING" { copy-operand "BY" copy-operand }+ ] "." |
delete-compiler-directing-statement | = | [ sequence-number ] "DELETE" sequence-number-field |
eject-statement | = | "EJECT" [ "." ] |
enter-statement | = | "ENTER" language-name [ routine-name ] "." |
insert-statement | = | [ sequence-number ] "INSERT" sequence-number-field |
ready-or-reset-trace-statement | = | ( "READY" | "RESET" ) "TRACE" "." |
replace-statement | = | "REPLACE" { quoted-pseudo-text "BY" quoted-pseudo-text }+ "." |
replace-statement | = | "REPLACE" "OFF" "." |
service-label-statement | = | "SERVICE" "LABEL" |
service-reload-statement | = | "SERVICE" "RELOAD" identifier |
skip1-2-3-statement | = | ( "SKIP1" | "SKIP2" | "SKIP3" ) [ "." ] |
title-statement | = | "TITLE" literal [ "." ] |
use-statement | = | "USE" [ "GLOBAL" ] "AFTER" [ "STANDARD" ] ( "EXCEPTION" | "ERROR" ) "PROCEDURE" |
[ "ON" ] ( { file-name }+ | "INPUT" | "OUTPUT" | "I-O" | "EXTEND" ) |
use-statement | = | "USE" [ "GLOBAL" ] "AFTER" [ "STANDARD" ] [ ( "BEGINNING" | "ENDING" ) ] |
[ ( "FILE" | "REEL" | "UNIT" ) ] "LABEL" "PROCEDURE" [ "ON" ] ( { file-name }+ | "INPUT" | "OUTPUT" | "I-O" | "EXTEND" ) |
use-statement | = | "USE" [ "FOR" ] "DEGUGGING" [ "ON" ] ( { procedure-name }+ | "ALL" "PROCEDURES" ) |
condition | = | ( combinable-condition |
| combined-conditions ) |
combinable-condition | = | ( simple-condition |
| negated-simple-conditions | ||
| abbreviated-combined-relation-conditions ) |
simple-condition | = | ( class-condition |
| condition-name-condition | ||
| relation-condition | ||
| sign-condition | ||
| switch-status-condition | ||
| "(" condition ")" ) |
class-condition | = | identifier [ "IS" ] [ "NOT" ] ( "NUMERIC" | "ALPHABETIC" | "ALPHABETIC-LOWER" | "ALPHABETIC-UPPER" | class-name | "DBCS" | "KANJI" ) |
condition-name-condition | = | condition-name-reference |
relation-condition | = | arithmetic-expression relational-operator |
arithmetic-expression |
relational-operator | = | [ "IS" ] |
( [ "NOT" ] ( "GREATER" [ "THAN" ] | ">" | "LESS" [ "THAN" ] | "<" | "EQUAL" [ "TO" ] | "=" ) | ||
| "GREATER" [ "THAN" ] "OR" "EQUAL" [ "TO" ] | ||
| ">=" | ||
| "LESS" [ "THAN" ] "OR" "EQUAL" [ "TO" ] | ||
| "<" "=" ) |
sign-condition | = | arithmetic-expression [ "IS" ] [ "NOT" ] ( "POSITIVE" | "NEGATIVE" | "ZERO" ) |
switch-status-condition | = | condition-name-reference |
negated-simple-conditions | = | "NOT" condition |
abbreviated-combined-relation-conditions | = | relation-condition |
abbreviation-rest |
abbreviated-combined-relation-conditions | = | arithmetic-expression relational-operator |
"(" [ "NOT" ] arithmetic-expression abbreviation-rest ")" |
abbreviated-combined-relation-conditions | = | arithmetic-expression "(" [ "NOT" ] relational-operator arithmetic-expression abbreviation-rest ")" |
abbreviation-rest | = | { ( "AND" | "OR" ) [ "NOT" ] [ relational-operator ] abbreviation-leaf }+ |
abbreviation-leaf | = | ( arithmetic-expression | "(" arithmetic-expression abbreviation-rest ")" ) |
combined-conditions | = | combinable-condition { ( "AND" | "OR" ) combinable-condition }+ |
procedure-name | = | paragraph-name [ ( "IN" | "OF" ) section-name ] |
procedure-name | = | section-name |
identifier | = | qualified-data-name { "(" subscript ")" }* |
[ "(" leftmost-character-position ":" [ length ] ")" ] |
identifier | = | "LINAGE-COUNTER" [ ( "IN" | "OF" ) file-name ] |
qualified-data-name | = | data-name { ( "IN" | "OF" ) data-name }* [ ( "IN" | "OF" ) file-name ] |
qualified-data-name | = | special-register |
length | = | arithmetic-expression |
leftmost-character-position | = | arithmetic-expression |
condition-name-reference | = | condition-name { ( "IN" | "OF" ) data-name }* |
[ ( "IN" | "OF" ) file-name ] { "(" subscript ")" }* |
condition-name-reference | = | condition-name { ( "IN" | "OF" ) mnemonic-name }* |
subscript | = | { ( integer | qualified-data-name [ ( "+" | "-" ) integer ] | index-name [ ( "+" | "-" ) integer ] ) }+ |
arithmetic-expression | = | times-div { ( "+" | "-" ) times-div }* |
times-div | = | power { ( "*" | "/" ) power }* |
power | = | [ ( "+" | "-" ) ] basis { "**" basis }* |
basis | = | ( identifier | literal | "(" arithmetic-expression ")" ) |
copy-operand | = | ( quoted-pseudo-text | identifier | literal | cobol-word ) |
mode | = | ( "F" | "V" | "U" | "S" ) |
alphabet-name | = | alphabetic-user-defined-word |
class-name | = | alphabetic-user-defined-word |
condition-name | = | alphabetic-user-defined-word |
data-name | = | alphabetic-user-defined-word |
file-name | = | alphabetic-user-defined-word |
index-name | = | alphabetic-user-defined-word |
mnemonic-name | = | alphabetic-user-defined-word |
record-name | = | qualified-data-name |
routine-name | = | alphabetic-user-defined-word |
symbolic-character | = | alphabetic-user-defined-word |
library-name | = | user-defined-word |
program-name | = | user-defined-word |
text-name | = | user-defined-word |
paragraph-name | = | user-defined-word |
section-name | = | user-defined-word |
computer-name | = | system-name |
language-name | = | system-name |
environment-name | = | system-name |
assignment-name | = | system-name |
basis-name | = | program-name |
figurative-constant | = | ( "ZERO" | "ZEROS" | "ZEROES" |
| "SPACE" | "SPACES" | ||
| "HIGH-VALUE" | "HIGH-VALUES" | ||
| "LOW-VALUE" | "LOW-VALUES" | ||
| "QUOTE" | "QUOTES" | ||
| "ALL" literal | ||
| "NULL" | "NULLS" ) |
literal | = | ( nonnumeric | numeric | dbcs | figurative-constant ) |
special-register | = | ( "ADDRESS" "OF" data-name |
| "DEBUG-ITEM" | ||
| "LENGTH" "OF" identifier | ||
| "RETURN-CODE" | ||
| "SHIFT-OUT" | ||
| "SHIFT-IN" | ||
| "SORT-CONTROL" | ||
| "SORT-CORE-SIZE" | ||
| "SORT-FILE-SIZE" | ||
| "SORT-MESSAGE" | ||
| "SORT-MODE-SIZE" | ||
| "SORT-RETURN" | ||
| "TALLY" | ||
| "WHEN-COMPILED" ) |
The following lexical definition serves as a tendentious description of the terminals in the context-free syntax. It has been derived manually from IBM's VS COBOL II Application Programming Language Reference (Document Number: GC26-4047-07). Note that this lexical definition is not claimed to reflect the actual scanner we use to test the grammar. Note also that preprocessing issues (e.g., continuation lines and copy book expansion) are not addressed by this definition. This lexical definition is written using some standard notation for regular expressions in the spirit of the LEX notation. Details of the notation are explained elsewhere.
/*
Some kinds of user-defined words are required to contain at least one
alphabetic. A corresponding class of character-strings is defined below.
*/
= ([0-9]+ [\-]*)* [0-9]* [A-Za-z] [A-Za-z0-9]* ([\-]+ [A-Za-z0-9]+)*
/*
From the reference:
; A COBOL word is a character-string of not more than 30 characters which
; forms a user-defined word, a system-name, or a reserved word. Except for
; arithmetic operators and relation characters, each character of a COBOL
; word is selected from the set of letters, digits, and the hyphen; the
; hyphen cannot appear as the first or last character in such words. Each
; lowercase letter is considered to be equivalent to its corresponding
; uppercase letter.
We do not enforce the constraint on the maximum length of COBOL words.
*/
= [A-Za-z0-9]+ ([\-]+ [A-Za-z0-9]+)*
/*
From the reference:
; A comment is a character-string that can contain any combination of
; characters from the character set of the computer.
We do not provide a lexical definition because we prefer to regard the
problem of recognizing comment entries as a preprocessing issue.
*/
= ...
/*
DBCS literals are not specified in this version.
*/
= ...
/*
From the reference:
; In this manual, the word integer appearing in a format represents a
; numeric literal of nonzero value that contains no sign and no decimal
; point; any other restrictions are included with the description of the
; format.
It is actually questionable, if we should forbid nonzero values at the
lexical level. Moreover, for some uses of integer, zero is actually allowed
in contrast to the above rule.
*/
= [0]* [1-9] [0-9]*
/*
From the reference:
; Level-numbers: 01-49,66,77,88.
; Each word must be a 1-digit or 2-digit integer.
*/
=
( [0]? [1-9]
| [1-4] [0-9]
| "66"
| "77"
| "88" )
/*
From the reference:
; A nonnumeric literal is a character-string enclosed in quotation marks
; ("), and can contain any allowable character from the character set of the
; computer. The maximum length of a nonnumeric literal is 160 characters.
; The enclosing quotation marks are excluded from the literal when the
; program is compiled. An embedded quotation mark must be represented by a
; pair of quotation marks (""). For example, "THIS ISN""T WRONG"
;x A nonnumeric literal can be enclosed in apostrophes ('). If the APOST
;x option is specified, these apostrophes are excluded from the literal when
;x the program is compiled. An embedded apostrophe must be represented by a
;x pair of apostrophes (''). For example, 'THIS ISN''T WRONG'
...
;x Hexadecimal notation can be used for nonnumeric literals. This
;x hexadecimal notation has the following format:
;x ___ Hexadecimal Notation Format for Nonnumeric Literals ________________
; | |
;x | X"hexadecimal_digits" |
; | |
; |________________________________________________________________________|
;x X"
;x The opening delimiter for hexadecimal notation of a nonnumeric literal
;x (If the compiler option APOST is specified, the opening delimiter is
;x X'.)
;x "
;x The closing delimiter for the hexadecimal notation of a nonnumeric
;x literal. (If the compiler option APOST is specified, the closing
;x delimiter is '.)
Nonnumeric literals with double-byte characters are not supported in this
version of this lexical definition.
*/
=
( [\"] (~[\"] | [\"] [\"])* [\"]
| [\'] (~[\'] | [\'] [\'])* [\']
| [Xx] [\"] hexdigits [\"]
| [Xx] [\'] hexdigits [\'] )
auxiliaries
begin
hexdigits = [0-9A-Fa-f]+
end
/*
From the reference:
; A numeric literal is a character-string whose characters are selected from
; the digits 0 through 9, a sign character (+ or -), and the decimal point.
; If the literal contains no decimal point, it is an integer. (In this
; manual, the word integer appearing in a format represents a numeric
; literal of nonzero value that contains no sign and no decimal point; any
; other restrictions are included with the description of the format.) The
; following rules apply:
; o One through 18 digits are allowed.
; o Only one sign character is allowed. If included, it must be the
; leftmost character of the literal. If the literal is unsigned, it is
; positive in value.
; o Only one decimal point is allowed. If a decimal point is included, it
; is treated as an assumed decimal point (that is, as not taking up a
; character position in the literal). The decimal point can appear
; anywhere within the literal except as the rightmost character.
We do not enforce the constraint on the length of numeric literals in the
definition below. We omit a definition of floating-point literal values
available as an IBM extension.
*/
= [\+\-]? ([0-9]* [\.] [0-9]+ | [0-9]+)
/*
options-list is meant to model compiler options for the CBL (PROCESS)
Statement. We consider this compiler directing statement as a preprocessing
problem. Thus, we omit a definition.
*/
= ...
/*
From the reference:
; A PICTURE character-string is composed of the currency symbol and certain
; combinations of characters in the COBOL character set. PICTURE
; character-strings are delimited only by the separator space, separator
; comma, separator semicolon, or separator period.
; Any punctuation character that appears as part of the specification of a
; PICTURE character-string is not considered as a punctuation character, but
; rather as a symbol used in the specification of that PICTURE
; character-string.
There are various rules on the order and the valid combination of
characters. We do not enforce these constraints in the following
simplified definition. The definition of picture character-strings is
definitely subject to improvement.
*/
= currency? (picchar+ repeat?)+ (punctuation (picchar+ repeat?)+)*
auxiliaries
begin
currency = ~[0-9ABCDPRSVXZa-z\*\+\-\/\,\.\;\(\)\=\'\"\ \n]
picchar =
( [ABEGPSVXZabegpsvxz90\+\-\*\$]
| "CR"
| "DB" )
repeat = "(" [0-9]+ ")"
punctuation = [\/\,\.\:]
end
/*
From the reference:
Priority-numbers: 00-99
Each word must be a 1-digit or 2-digit integer.
*/
= [0-9] [0-9]
/*
From the reference:
; pseudo-text
; A sequence of character-strings and/or separators bounded by, but not
; including, pseudo-text-1 delimiters (==). Both characters of each
; pseudo-text-1 delimiter must appear on one line; however,
; character-strings within pseudo-text-1 can be continued.
*/
= "==" ~[\=]* "=="
/*
Sequence numbers are needed for compiler-directing statements.
These preprocessing issues are not addressed in the version.
*/
= ...
/*
See sequence-number.
*/
= ...
/*
From the reference:
; A system-name is a character string that is defined by IBM to have a
; specific meaning to the system. There are three types of system-names:
;| o computer-name
;| o language-name
;| o implementor-name.
; There are two types of implementor-names:
;| o environment-name
;| o assignment-name.
If we abstract from the problem to reject reserved words as user-defined
words, user-defined words are COBOL words.
*/
= cobol-word
/*
From the reference:
;| Within a source program the following rules apply for all COBOL words:
;| o A reserved word cannot be used as a user-defined word or as a
;| system-name.
;| o The same COBOL word, however, can be used as both a user-defined word
;| and as a system-name. The classification of a specific occurrence of
;| a COBOL word is determined by the context of the clause or phrase in
;| which it occurs.
If we abstract from the problem to reject reserved words as user-defined
words, user-defined words are COBOL words.
*/
= cobol-word
/*
The class zero were introduced by us in the context of correcting the
uses of the sort integer. The reference constrains integer to be a nonzero
value, whereas some use sites allow zero. We relaxed those use sites from
integer to (integer|zero). Now we have to define the trivial class zero.
*/
= [0]+
[a] [b] [c] [d] [e] [f] [g] h [i] [j] k [l] [m] [n] [o] [p] [q] [r] [s] [t] [u] [v] [w] x y [z]
[A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] X Y [Z]
_____________________________________________________________________________________ | | | >>_____IDENTIFICATION_____DIVISION__.__program-id-cobol-source-program____________> | | |__ID______________| | | >_________________________________________________________________________________> | | |__identification-division-content__| | | >_________________________________________________________________________________> | | |__ENVIRONMENT__DIVISION__.__environment-division-content__| | | >_________________________________________________________________________________> | | |__DATA__DIVISION__.__data-division-content__| | | >_________________________________________________________________________________> | | |__procedure-division__| | | >________________________________________________________________________________>< | | |__________________________________________END__PROGRAM__program-name__.__| | | | <______________________________ | | | |____nested-cobol-source-program__|__| | |_____________________________________________________________________________________|
|
_________________________________________________________ | | | >>__PROGRAM-ID___________program-name_________________> | | |__.__| | | >____________________________________________________>< | | |____________INITIAL_________________| |__.__| | | |__IS__| |__PROGRAM__| | |_________________________________________________________|
|
___________________________________________________________________________________ | | | >>_____IDENTIFICATION_____DIVISION__.__program-id-nested-cobol-source-program___> | | |__ID______________| | | >_______________________________________________________________________________> | | |__identification-division-content__| | | >_______________________________________________________________________________> | | |__ENVIRONMENT__DIVISION__.__environment-division-content__| | | >_______________________________________________________________________________> | | |__DATA__DIVISION__.__data-division-content__| | | >_______________________________________________________________________________> | | |__procedure-division__| | | >___________________________________________END__PROGRAM__program-name__.______>< | | | <______________________________ | | | |____nested-cobol-source-program__|__| | |___________________________________________________________________________________|
|
_____________________________________________________________________________ | | | >>__PROGRAM-ID___________program-name_____________________________________> | | |__.__| | | >________________________________________________________________________>< | | |_______________COMMON___________________________________| |__.__| | | |__IS__| | |__INITIAL__| | |__PROGRAM__| | | |__INITIAL________________| | | |__COMMON__| | |_____________________________________________________________________________|
|
________________________________________________________________________ | | | >>__________________________________________________________________>< | | || |__AUTHOR_____________________________________| || | | || |__.__| | <________________ | || | | || |____comment-entry__|__| || | | ||__________________________________________________________|| | | || |__INSTALLATION_____________________________________| || | | || |__.__| | <________________ | || | | || |____comment-entry__|__| || | | ||__________________________________________________________|| | | || |__DATE-WRITTEN_____________________________________| || | | || |__.__| | <________________ | || | | || |____comment-entry__|__| || | | ||__________________________________________________________|| | | || |__DATE-COMPILED_____________________________________| || | | || |__.__| | <________________ | || | | || |____comment-entry__|__| || | | ||__________________________________________________________|| | | |__SECURITY_____________________________________| | | |__.__| | <________________ | | | |____comment-entry__|__| | |________________________________________________________________________|
|
_________________________________________________________________ | | | >>___________________________________________________________>< | | |__configuration-section__| |__input-output-section__| | |_________________________________________________________________|
|
_____________________________________________________________________ | | | >>__CONFIGURATION__SECTION__.__configuration-section-paragraphs__>< | |_____________________________________________________________________|
|
__________________________________________________________________________ | | | >>_____________________________________________________________________> | | |__source-computer-paragraph__| |__object-computer-paragraph__| | | >_____________________________________________________________________>< | | |__special-names-paragraph__| | |__________________________________________________________________________|
|
___________________________________________________________________ | | | >>__SOURCE-COMPUTER__.__________________________________________> | | >______________________________________________________________>< | | |__computer-name_____________________________________.__| | | |______________DEBUGGING__MODE__| | | |__WITH__| | |___________________________________________________________________|
|
________________________________________________________________________________________________________________________________ | | | >>__OBJECT-COMPUTER__._______________________________________________________________________________________________________> | | >___________________________________________________________________________________________________________________________>< | | |__computer-name_______________________________________________________object-computer-paragraph-sequence-phrase__.__| | | |__MEMORY______________integer_____WORDS__________| | | |__SIZE__| |__CHARACTERS__| | | |__MODULES_____| | |________________________________________________________________________________________________________________________________|
|
_________________________________________________________________________________ | | | >>____________________________________________________________________________> | | |__________________________________SEQUENCE____________alphabet-name__| | | |__PROGRAM__| |__COLLATING__| |__IS__| | | >____________________________________________________________________________>< | | |__SEGMENT-LIMIT____________priority-number__| | | |__IS__| | |_________________________________________________________________________________|
|
_________________________________________________________________________________________________________________________________________ | | | >>__SPECIAL-NAMES__.__________________________________________________________________________________________________________________> | | | <_____________________________________________________________________________________________________ | | | |_______environment-name____________mnemonic-name________________________________________________________|__| | | | |__IS__| | | | |__environment-name_______________mnemonic-name__________________________________________________| | | | |__IS__| |__special-names-paragraph-status-phrase__| | | | |__special-names-paragraph-status-phrase_________________________________| | | >___special-names-paragraph-clauses__________________________________________________________________________________________________>< | | |__.__| | |_________________________________________________________________________________________________________________________________________|
|
_______________________________________________________ | | | >>_________________________________________________>< | | || | <__________________ | || | | || |____alphabet-clause__|__| || | | ||_________________________________________|| | | || | <_____________________________ | || | | || |____symbolic-characters-clause__|__| || | | ||_________________________________________|| | | || | <_______________ | || | | || |____class-clause__|__| || | | ||_________________________________________|| | | || |__currency-sign-clause__| || | | ||_________________________________________|| | | |__decimal-point-clause__| | |_______________________________________________________|
|
___________________________________________________________________________________________________ | | | >>__ALPHABET__alphabet-name_______________STANDARD-1___________________________________________>< | | |__IS__| |__STANDARD-2________________________________________| | | |__NATIVE____________________________________________| | | |__EBCDIC____________________________________________| | | | <______________________________________________ | | | |____literal______________________________________|__| | | |________THROUGH_____literal_____| | | | |__THRU_____| | | | | <________________ | | | |____ALSO__literal__|______| | |___________________________________________________________________________________________________|
|
__________________________________________________________________________________________________________________________ | | | <_________________________________________________________ | | <_____________________ <__________ | | | >>__SYMBOLIC________________________symbolic-character__|_____________________integer__|__|___________________________>< | | |__CHARACTERS__| |_____ARE_____| |__IN__alphabet-name__| | | |__IS___| | |__________________________________________________________________________________________________________________________|
|
_________________________________________________________________________________ | | | <________________________________________ | | >>__CLASS__class-name______________literal________________________________|__>< | | |__IS__| |_____THROUGH_____literal__| | | |__THRU_____| | |_________________________________________________________________________________|
|
_________________________________________________ | | | >>__CURRENCY________________________literal__>< | | |__SIGN__| |__IS__| | |_________________________________________________|
|
________________________________________ | | | >>__DECIMAL-POINT____________COMMA__>< | | |__IS__| | |________________________________________|
|
___________________________________________________________________________________________________ | | | >>_____ON__________________________condition___________________________________________________>< | | | |__STATUS__| |__IS__| |__OFF__________________________condition__| | | | | |__STATUS__| |__IS__| | | | |__OFF__________________________condition_______________________________________________| | | |__STATUS__| |__IS__| |__ON__________________________condition__| | | |__STATUS__| |__IS__| | |___________________________________________________________________________________________________|
|
________________________________________________________________ | | | >>__INPUT-OUTPUT__SECTION__._________________________________> | | |__file-control-paragraph__| | | >___________________________________________________________>< | | |__i-o-control-paragraph__| | |________________________________________________________________|
|
_______________________________________ | | | >>__FILE-CONTROL__._________________> | | >__________________________________>< | | | <_____________________ | | | |____file-control-entry__|__| | |_______________________________________|
|
___________________________________________________________________ | | | >>__select-clause__assign-clause________________________________> | | >___________________________________________________________.__>< | | || |__reserve-clause__| || | | ||__________________________________________________|| | | || |________________________________SEQUENTIAL__| || | | || |__ORGANIZATION____________| || | | || |__IS__| || | | ||__________________________________________________|| | | || |__padding-character-clause__| || | | ||__________________________________________________|| | | || |__record-delimiter-clause__| || | | ||__________________________________________________|| | | || |__ACCESS________________________SEQUENTIAL__| || | | || |__MODE__| |__IS__| || | | ||__________________________________________________|| | | || |__password-clause__| || | | ||__________________________________________________|| | | |__file-status-clause__| | |___________________________________________________________________| ____________________________________________________________________________________________________ | | | >>__select-clause__assign-clause_________________________________________________________________> | | >____________________________________________________________________________________________.__>< | | || |__reserve-clause__| || | | ||________________________________RELATIVE___________________________________________|| | | || |__ORGANIZATION____________| || | | || |__IS__| || | | ||___________________________________________________________________________________|| | | || |__ACCESS___________________________SEQUENTIAL________________________________| || | | || |__MODE__| |__IS__| | |__relative-key-clause__| | || | | || |_____RANDOM______relative-key-clause_____| || | | || |__DYNAMIC__| || | | ||___________________________________________________________________________________|| | | || |__password-clause__| || | | ||___________________________________________________________________________________|| | | |__file-status-clause__| | |____________________________________________________________________________________________________| _________________________________________________________________________ | | | >>__select-clause__assign-clause______________________________________> | | >_________________________________________________________________.__>< | | || |__reserve-clause__| || | | ||________________________________INDEXED_________________|| | | || |__ORGANIZATION____________| || | | || |__IS__| || | | ||________________________________________________________|| | | || |__ACCESS___________________________SEQUENTIAL_____| || | | || |__MODE__| |__IS__| |__RANDOM______| || | | || |__DYNAMIC_____| || | | ||__record-key-clause_____________________________________|| | | ||________________________________________________________|| | | || |__password-clause__| || | | ||________________________________________________________|| | | || | <______________________________ | || | | || |____alternate-record-key-clause__|__| || | | ||________________________________________________________|| | | |__file-status-clause__| | |_________________________________________________________________________|
|
___________________________________________ | | | >>__SELECT__________________file-name__>< | | |__OPTIONAL__| | |___________________________________________|
|
______________________________________________________ | | | <________________________ | | >>__ASSIGN_________________assignment-name_____|__>< | | |__TO__| |__literal__________| | |______________________________________________________|
|
_____________________________________________ | | | >>__RESERVE__integer_____________________>< | | |_____AREA______| | | |__AREAS__| | |_____________________________________________|
|
_______________________________________________________________________ | | | >>__PADDING________________________________qualified-data-name_____>< | | |__CHARACTER__| |__IS__| |__literal______________| | |_______________________________________________________________________|
|
____________________________________________________________ | | | >>__RECORD__DELIMITER_______________STANDARD-1__________>< | | |__IS__| |__assignment-name__| | |____________________________________________________________|
|
__________________________________________________________ | | | >>__RECORD_______________________qualified-data-name__>< | | |__KEY__| |__IS__| | |__________________________________________________________|
|
___________________________________________________________________________ | | | >>__ALTERNATE_____________________________________qualified-data-name___> | | |__RECORD__| |__KEY__| |__IS__| | | >______________________________________________________________________>< | | |__password-clause__| |______________DUPLICATES__| | | |__WITH__| | |___________________________________________________________________________|
|
____________________________________________________________ | | | >>__RELATIVE_______________________qualified-data-name__>< | | |__KEY__| |__IS__| | |____________________________________________________________|
|
_______________________________________ | | | >>__PASSWORD____________data-name__>< | | |__IS__| | |_______________________________________|
|
______________________________________________________________________________________ | | | >>______________STATUS____________qualified-data-name_____________________________>< | | |__FILE__| |__IS__| |__qualified-data-name__| | |______________________________________________________________________________________|
|
_____________________________________________________________________________ | | | >>__I-O-CONTROL__.________________________________________________________> | | | <________________________________________ | | | |_______qsam-or-sam-i-o-control-entries_____|__.__| | | |__vsam-i-o-control-entries_________| | | >________________________________________________________________________>< | | |__sort-merge-i-o-control-entries__.__| | |_____________________________________________________________________________|
|
___________________________________________________________________________________________________________________ | | | >>_____RERUN__ON_____assignment-name_____________________integer__RECORDS________________________file-name_____>< | | | |__file-name________| |__EVERY__| |__END_______________REEL_____| |__OF__| | | | | |__OF__| |__UNIT__| | | | | <____________ | | | |__SAME_______________________________________file-name____file-name__|_________________________________| | | | |__RECORD__| |__AREA__| |__FOR__| | | | | <_____________________________________ | | | |__MULTIPLE__FILE________________________________file-name___________________________|__________________| | | | |__TAPE__| |__CONTAINS__| |__POSITION__integer__| | | | | <____________ | | | |__APPLY__WRITE-ONLY______________file-name__|__________________________________________________________| | | |__ON__| | |___________________________________________________________________________________________________________________|
|
____________________________________________________________________________________________________ | | | >>_____RERUN__ON_____assignment-name__________________integer__RECORDS____________file-name_____>< | | | |__file-name________| |__EVERY__| |__OF__| | | | | <____________ | | | |__SAME_______________________________________file-name____file-name__|__________________| | | |__RECORD__| |__AREA__| |__FOR__| | |____________________________________________________________________________________________________|
|
_______________________________________________________________________________________ | | | >>__________________________________________________________________________________> | | |__RERUN__ON__assignment-name__| | | <___________________________________________________________________________ | | <____________ | | | >_____SAME_____RECORD________________________________file-name____file-name__|__|__>< | | |__SORT________| |__AREA__| |__FOR__| | | |__SORT-MERGE__| | |_______________________________________________________________________________________|
|
___________________________________________________________________________________________________________ | | | >>______________________________________________________________________________________________________> | | |__FILE__SECTION__._____________________________________________________________________________| | | | <_________________________________________________________________ | | | | <___________________________ | | | | |____file-and-sort-description-entry____record-description-entry__|__|__| | | >_______________________________________________________________________________________________________> | | |__WORKING-STORAGE__SECTION__.________________________________________________| | | | <____________________________________ | | | |_______record-description-entry________|__| | | |__data-item-description-entry__| | | >______________________________________________________________________________________________________>< | | |__LINKAGE__SECTION__.________________________________________________| | | | <____________________________________ | | | |_______record-description-entry________|__| | | |__data-item-description-entry__| | |___________________________________________________________________________________________________________|
|
________________________________ | | | >>__data-description-entry__>< | |________________________________|
|
________________________________ | | | >>__data-description-entry__>< | |________________________________|
|
_________________________________________________________________________ | | | >>_____FD_____file-name__file-and-sort-description-entry-clauses__.__>< | | |__SD__| | |_________________________________________________________________________|
|
_____________________________________________ | | | >>_______________________________________>< | | || |__external-clause__| || | | ||_______________________________|| | | || |__global-clause__| || | | ||_______________________________|| | | || |__block-contains-clause__| || | | ||_______________________________|| | | || |__record-clause__| || | | ||_______________________________|| | | || |__label-records-clause__| || | | ||_______________________________|| | | || |__value-of-clause__| || | | ||_______________________________|| | | || |__data-records-clause__| || | | ||_______________________________|| | | || |__linage-clause__| || | | ||_______________________________|| | | || |__recording-mode-clause__| || | | ||_______________________________|| | | |__code-set-clause__| | |_____________________________________________|
|
____________________________ | | | >>____________EXTERNAL__>< | | |__IS__| | |____________________________|
|
__________________________ | | | >>____________GLOBAL__>< | | |__IS__| | |__________________________|
|
_______________________________________________________________________________________________ | | | >>__BLOCK______________________________________________integer_____________________________>< | | |__CONTAINS__| |_____integer_____TO__| |__zero_____| |_____CHARACTERS_____| | | |__zero_____| |__RECORDS_____| | |_______________________________________________________________________________________________|
|
____________________________________________________________________________________ | | | >>__RECORD_______________________________________________________________________> | | >_________________________integer_______________________________________________>< | | | |__CONTAINS__| |__zero_____| |__CHARACTERS__| | | | |_____________________integer_____TO_____integer_________________________| | | | |__CONTAINS__| |__zero_____| |__zero_____| |__CHARACTERS__| | | | |__record-varying-phrase_________________________________________________| | | |__DEPENDING____________data-name__| | | |__ON__| | |____________________________________________________________________________________|
|
_________________________________________________________________________________________________________________ | | | >>____________VARYING________________________________________________________________________________________>< | | |__IS__| |__IN__| |__SIZE__| |______________integer__| |__TO__integer__| |__CHARACTERS__| | | |__FROM__| | |_________________________________________________________________________________________________________________|
|
_______________________________________________________________ | | | >>__LABEL_____RECORD____________________STANDARD___________>< | | | |__IS__| | |__OMITTED_________| | | |__RECORDS_____________| | <____________ | | | |__ARE__| |____data-name__|__| | |_______________________________________________________________|
|
__________________________________________________________________________ | | | <___________________________________________________ | | >>__VALUE__OF____system-name_______________qualified-data-name_____|__>< | | |__IS__| |__literal______________| | |__________________________________________________________________________|
|
________________________________________________________ | | | <____________ | | >>__DATA_____RECORD___________________data-name__|__>< | | | |__IS__| | | | |__RECORDS_____________| | | |__ARE__| | |________________________________________________________|
|
_______________________________________________________________________________ | | | >>__LINAGE_______________data-name__________________linage-footing-phrase__>< | | |__IS__| |__integer____| |__LINES__| | |_______________________________________________________________________________|
|
_________________________________________________________________________________________________________________ | | | >>____________________________________________________________________________________________________________> | | |______________FOOTING_______________data-name_____| |_________________________TOP_____data-name_____| | | |__WITH__| |__AT__| |__integer____| |__LINES__| |__AT__| |__integer____| | | >____________________________________________________________________________________________________________>< | | |_________________________BOTTOM_____data-name_____| | | |__LINES__| |__AT__| |__integer____| | |_________________________________________________________________________________________________________________|
|
_______________________________________________ | | | >>__RECORDING________________________mode__>< | | |__MODE__| |__IS__| | |_______________________________________________|
|
___________________________________________ | | | >>__CODE-SET____________alphabet-name__>< | | |__IS__| | |___________________________________________|
|
________________________________________________________________________________ | | | >>__level-number_________________________data-description-entry-clauses__.__>< | | |_____data-name_____| | | |__FILLER_____| | |________________________________________________________________________________| __________________________________________ | | | >>__66__data-name__renames-clause__.__>< | |__________________________________________| _______________________________________________________ | | | >>__88__condition-name__condition-value-clause__.__>< | |_______________________________________________________|
|
______________________________________________ | | | >>________________________________________>< | | || |__redefines-clause__| || | | ||________________________________|| | | || |__blank-when-zero-clause__| || | | ||________________________________|| | | || |__external-clause__| || | | ||________________________________|| | | || |__global-clause__| || | | ||________________________________|| | | || |__justified-clause__| || | | ||________________________________|| | | || |__occurs-clause__| || | | ||________________________________|| | | || |__picture-clause__| || | | ||________________________________|| | | || |__sign-clause__| || | | ||________________________________|| | | || |__synchronized-clause__| || | | ||________________________________|| | | || |__usage-clause__| || | | ||________________________________|| | | |__data-value-clause__| | |______________________________________________|
|
______________________________ | | | >>__REDEFINES__data-name__>< | |______________________________|
|
_________________________________________ | | | >>__BLANK_________________ZERO_______>< | | |__WHEN__| |__ZEROS___| | | |__ZEROES__| | |_________________________________________|
|
______________________________________ | | | >>_____JUSTIFIED__________________>< | | |__JUST_______| |__RIGHT__| | |______________________________________|
|
____________________________________________________________________________________ | | | >>__OCCURS__integer______________________________________________________________> | | |__TIMES__| | | >________________________________________________________________________________> | | | <__________________________________________________________________ | | | | <______________________ | | | | |_______ASCENDING_____________________________qualified-data-name__|__|__| | | |__DESCENDING__| |__KEY__| |__IS__| | | >_______________________________________________________________________________>< | | | <_____________ | | | |__INDEXED______________index-name__|__| | | |__BY__| | |____________________________________________________________________________________| ____________________________________________________________________________________ | | | >>__OCCURS___________________________integer_______________DEPENDING_____________> | | |_____integer_____TO__| |__TIMES__| | | |__zero_____| | | >_____________qualified-data-name________________________________________________> | | |__ON__| | | >________________________________________________________________________________> | | | <__________________________________________________________________ | | | | <______________________ | | | | |_______ASCENDING_____________________________qualified-data-name__|__|__| | | |__DESCENDING__| |__KEY__| |__IS__| | | >_______________________________________________________________________________>< | | | <_____________ | | | |__INDEXED______________index-name__|__| | | |__BY__| | |____________________________________________________________________________________|
|
_________________________________________________ | | | >>_____PICTURE_______________picture-string__>< | | |__PIC______| |__IS__| | |_________________________________________________|
|
_______________________________________________________________________________ | | | >>___________________________LEADING_______________________________________>< | | |__SIGN____________| |__TRAILING__| |__SEPARATE___________________| | | |__IS__| |__CHARACTER__| | |_______________________________________________________________________________|
|
_______________________________________________ | | | >>_____SYNCHRONIZED________________________>< | | |__SYNC__________| |_____LEFT______| | | |__RIGHT__| | |_______________________________________________|
|
______________________________________________________ | | | >>____________________________BINARY______________>< | | |__USAGE____________| |__COMP_____________| | | |__IS__| |__COMP-1___________| | | |__COMP-2___________| | | |__COMP-3___________| | | |__COMP-4___________| | | |__COMPUTATIONAL____| | | |__COMPUTATIONAL-1__| | | |__COMPUTATIONAL-2__| | | |__COMPUTATIONAL-3__| | | |__COMPUTATIONAL-4__| | | |__DISPLAY__________| | | |__DISPLAY-1________| | | |__INDEX____________| | | |__PACKED-DECIMAL___| | | |__POINTER__________| | |______________________________________________________|
|
_____________________________________________________________________________ | | | <________________________________________ | | >>_____VALUE___________________literal________________________________|__>< | | | |__IS__| | |_____THROUGH_____literal__| | | |__VALUES_____________| |__THRU_____| | | |__ARE__| | |_____________________________________________________________________________|
|
__________________________________ | | | >>__VALUE____________literal__>< | | |__IS__| | |__________________________________|
|
________________________________________________________________________________ | | | >>__RENAMES__qualified-data-name____________________________________________>< | | |_____THROUGH_____qualified-data-name__| | | |__THRU_____| | |________________________________________________________________________________|
|
___________________________________________________________________________________________________________ | | | >>__PROCEDURE__DIVISION_______________________________._________________________________________________> | | | <____________ | | | |__USING____data-name__|__| | | >_______________________________________________________________________________________________________> | | | <__________________________________________________ | | | |__DECLARATIVES__.____section-header__.__use-statement__.__paragraphs__|__END__DECLARATIVES__.__| | | >___sections___________________________________________________________________________________________>< | |___________________________________________________________________________________________________________| _____________________________________________________________ | | | >>__PROCEDURE__DIVISION_______________________________.___> | | | <____________ | | | |__USING____data-name__|__| | | >___paragraphs___________________________________________>< | |_____________________________________________________________|
|
______________________________________________________________ | | | >>__paragraphs____________________________________________>< | | | <________________________________ | | | |____section-header__.__paragraphs__|__| | |______________________________________________________________|
|
______________________________________________________ | | | >>__section-name__SECTION_________________________>< | | |__priority-number__| | |______________________________________________________|
|
___________________________________________________ | | | >>_____________________________________________>< | | | <___________ | | <____________ | | | |____sentence__|__| |____paragraph__|__| | |___________________________________________________|
|
________________________________________________ | | | >>__paragraph-name__._______________________>< | | | <___________ | | | |____sentence__|__| | |________________________________________________| ______________________ | | | >>__altered-goto__>< | |______________________|
|
___________________________ | | | >>__statement-list__.__>< | |___________________________|
|
________________________ | | | <____________ | | >>____statement__|__>< | |________________________|
|
________________________________________ | | | >>_____accept-statement_____________>< | | |__add-statement_____________| | | |__alter-statement___________| | | |__call-statement____________| | | |__cancel-statement__________| | | |__close-statement___________| | | |__compute-statement_________| | | |__continue-statement________| | | |__delete-statement__________| | | |__display-statement_________| | | |__divide-statement__________| | | |__entry-statement___________| | | |__evaluate-statement________| | | |__exit-statement____________| | | |__exit-program-statement____| | | |__goback-statement__________| | | |__go-to-statement___________| | | |__if-statement______________| | | |__initialize-statement______| | | |__inspect-statement_________| | | |__merge-statement___________| | | |__move-statement____________| | | |__multiply-statement________| | | |__open-statement____________| | | |__perform-statement_________| | | |__read-statement____________| | | |__release-statement_________| | | |__return-statement__________| | | |__rewrite-statement_________| | | |__search-statement__________| | | |__set-statement_____________| | | |__sort-statement____________| | | |__start-statement___________| | | |__stop-statement____________| | | |__string-statement__________| | | |__subtract-statement________| | | |__unstring-statement________| | | |__write-statement___________| | |________________________________________|
|
________________________________________________________________ | | | >>__ACCEPT__identifier______________________________________>< | | |__FROM_____mnemonic-name________| | | |__environment-name__| | |________________________________________________________________| _____________________________________________________ | | | >>__ACCEPT__identifier__FROM_____DATE____________>< | | |__DAY__________| | | |__DAY-OF-WEEK__| | | |__TIME_________| | |_____________________________________________________|
|
________________________________________________________________________ | | | <___________________ <____________________________ | | >>__ADD_______identifier_____|__TO____identifier_________________|___> | | |__literal_____| |__ROUNDED__| | | >____________________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >____________________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >___________________________________________________________________>< | | |__END-ADD__| | |________________________________________________________________________| ________________________________________________________________ | | | <___________________ | | >>__ADD_______identifier_____|_______________identifier______> | | |__literal_____| |__TO__| |__literal_____| | | <____________________________ | | >___GIVING____identifier_________________|___________________> | | |__ROUNDED__| | | >____________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >____________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >___________________________________________________________>< | | |__END-ADD__| | |________________________________________________________________| ____________________________________________________________________ | | | >>__ADD_____CORRESPONDING_____identifier__TO__identifier_________> | | |__CORR___________| | | >________________________________________________________________> | | |__ROUNDED__| |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >________________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_______________________________________________________________>< | | |__END-ADD__| | |____________________________________________________________________|
|
____________________________________________________________________ | | | >>__ALTER________________________________________________________> | | <________________________________________________________ | | >_____procedure-name__TO_____________________procedure-name__|__>< | | |__PROCEED__TO__| | |____________________________________________________________________|
|
_______________________________________________________________________________________________ | | | >>__CALL_____identifier_____________________________________________________________________> | | |__literal_____| | | >___________________________________________________________________________________________> | | | <______________________________________________________________________ | | | | <________________________________ | | | | |__USING_______________________________________identifier__________________|_____|__| | | | |____________REFERENCE__| |__ADDRESS__OF__identifier__| | | | | |__BY__| |__file-name________________| | | | | <_____________________________________ | | | |____________CONTENT_________________________identifier_____|_____| | | |__BY__| | |__LENGTH__OF__| | | | |__ADDRESS__OF__identifier_______| | | |__literal_______________________| | | | | >__________________________________________________________________________________________>< | | |____________OVERFLOW__statement-list__| |__END-CALL__| | | |__ON__| | |_______________________________________________________________________________________________| _______________________________________________________________________________________________ | | | >>__CALL_____identifier_____________________________________________________________________> | | |__literal_____| | | >___________________________________________________________________________________________> | | | <______________________________________________________________________ | | | | <________________________________ | | | | |__USING_______________________________________identifier__________________|_____|__| | | | |____________REFERENCE__| |__ADDRESS__OF__identifier__| | | | | |__BY__| |__file-name________________| | | | | <_____________________________________ | | | |____________CONTENT_________________________identifier_____|_____| | | |__BY__| | |__LENGTH__OF__| | | | |__ADDRESS__OF__identifier_______| | | |__literal_______________________| | | | | >___________________________________________________________________________________________> | | |____________EXCEPTION__statement-list__| | | |__ON__| | | >__________________________________________________________________________________________>< | | |__NOT____________EXCEPTION__statement-list__| |__END-CALL__| | | |__ON__| | |_______________________________________________________________________________________________|
|
_______________________________________ | | | <___________________ | | >>__CANCEL_______identifier_____|__>< | | |__literal_____| | |_______________________________________|
|
____________________________________________________________________________________ | | | >>__CLOSE________________________________________________________________________> | | <________________________________________________________________________ | | >_____file-name______________________________________________________________|__>< | | |________REEL____________________________________________| | | | |__UNIT__| |________________REMOVAL_________| | | | | | |__FOR__| | | | | | |______________NO__REWIND__| | | | | |__WITH__| | | | |_________________NO__REWIND_______________________| | | |__WITH__| |__LOCK________| | |____________________________________________________________________________________| _______________________________________________________ | | | <____________________________________ | | >>__CLOSE____file-name__________________________|__>< | | |______________LOCK__| | | |__WITH__| | |_______________________________________________________|
|
______________________________________________________________ | | | <____________________________ | | >>__COMPUTE____identifier_________________|_____=__________> | | |__ROUNDED__| |__EQUAL__| | | >___arithmetic-expression__________________________________> | | >__________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >__________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_________________________________________________________>< | | |__END-COMPUTE__| | |______________________________________________________________|
|
__________________ | | | >>__CONTINUE__>< | |__________________|
|
_______________________________________________________ | | | >>__DELETE__file-name_______________________________> | | |__RECORD__| | | >___________________________________________________> | | |__INVALID_____________statement-list__| | | |__KEY__| | | >___________________________________________________> | | |__NOT__INVALID_____________statement-list__| | | |__KEY__| | | >__________________________________________________>< | | |__END-DELETE__| | |_______________________________________________________|
|
____________________________________________ | | | <___________________ | | >>__DISPLAY_______identifier_____|_______> | | |__literal_____| | | >________________________________________> | | |__UPON_____mnemonic-name________| | | |__environment-name__| | | >_______________________________________>< | | |______________NO__ADVANCING__| | | |__WITH__| | |____________________________________________|
|
________________________________________________________________________ | | | <____________________________ | | >>__DIVIDE_____identifier_____INTO____identifier_________________|___> | | |__literal_____| |__ROUNDED__| | | >____________________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >____________________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >___________________________________________________________________>< | | |__END-DIVIDE__| | |________________________________________________________________________| __________________________________________________________ | | | >>__DIVIDE_____identifier_____INTO_____identifier______> | | |__literal_____| |__literal_____| | | <____________________________ | | >___GIVING____identifier_________________|_____________> | | |__ROUNDED__| | | >______________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________>< | | |__END-DIVIDE__| | |__________________________________________________________| __________________________________________________________ | | | >>__DIVIDE_____identifier_____BY_____identifier________> | | |__literal_____| |__literal_____| | | <____________________________ | | >___GIVING____identifier_________________|_____________> | | |__ROUNDED__| | | >______________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________>< | | |__END-DIVIDE__| | |__________________________________________________________| __________________________________________________________________ | | | >>__DIVIDE_____identifier_____INTO_____identifier______________> | | |__literal_____| |__literal_____| | | >___GIVING__identifier_________________REMAINDER__identifier___> | | |__ROUNDED__| | | >______________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________________>< | | |__END-DIVIDE__| | |__________________________________________________________________| __________________________________________________________________ | | | >>__DIVIDE_____identifier_____BY_____identifier________________> | | |__literal_____| |__literal_____| | | >___GIVING__identifier_________________REMAINDER__identifier___> | | |__ROUNDED__| | | >______________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________________>< | | |__END-DIVIDE__| | |__________________________________________________________________|
|
_____________________________________________________ | | | >>__ENTRY__literal_______________________________>< | | | <____________ | | | |__USING____data-name__|__| | |_____________________________________________________|
|
_____________________________________________________________________________________________ | | | >>__EVALUATE_____identifier_______________________________________________________________> | | |__literal________________| | <____________________________________ | | | |__arithmetic-expression__| |____ALSO_____identifier________________|__| | | |__condition______________| |__literal________________| | | |__TRUE___________________| |__arithmetic-expression__| | | |__FALSE__________________| |__condition______________| | | |__TRUE___________________| | | |__FALSE__________________| | | <_______________________________________________________________________________ | | <__________________________________________________________ | | | >_______WHEN__evaluate-phrase____________________________________|__statement-list__|_____> | | | <________________________ | | | |____ALSO__evaluate-phrase__|__| | | >________________________________________________________________________________________>< | | |__WHEN__OTHER__statement-list__| |__END-EVALUATE__| | |_____________________________________________________________________________________________|
|
________________________________________________________________________________________________________ | | | >>_____ANY__________________________________________________________________________________________>< | | |__condition_________________________________________________________________________________| | | |__TRUE______________________________________________________________________________________| | | |__FALSE_____________________________________________________________________________________| | | |________________identifier__________________________________________________________________| | | |__NOT__| |__literal________________| |_____THROUGH________identifier________________| | | |__arithmetic-expression__| |__THRU_____| |__literal________________| | | |__arithmetic-expression__| | |________________________________________________________________________________________________________|
|
______________ | | | >>__EXIT__>< | |______________|
|
_______________________ | | | >>__EXIT__PROGRAM__>< | |_______________________|
|
________________ | | | >>__GOBACK__>< | |________________|
|
______________________________________ | | | >>__GO____________procedure-name__>< | | |__TO__| | |______________________________________| ___________________________________ | | | >>__GO____________MORE-LABELS__>< | | |__TO__| | |___________________________________| ________________________________________________________________ | | | <_________________ | | >>__GO______________procedure-name__|__DEPENDING_____________> | | |__TO__| |__ON__| | | >___identifier______________________________________________>< | |________________________________________________________________|
|
____________________________________________ | | | >>__paragraph-name__.__GO____________.__>< | | |__TO__| | |____________________________________________|
|
_________________________________________________________ | | | <____________ | | >>__IF__condition___________________statement__|______> | | |__THEN__| |__NEXT__SENTENCE__| | | | | >____________________________________________________>< | | | <____________ | |__END-IF__| | | |__ELSE_______statement__|_____| | | |__NEXT__SENTENCE__| | | | |_________________________________________________________|
|
___________________________________________________________________________________________ | | | <_____________ | | >>__INITIALIZE____identifier__|_________________________________________________________> | | >______________________________________________________________________________________>< | | | <______________________________________________________________ | | | |__REPLACING_______ALPHABETIC__________________________BY_____identifier_____|__| | | |__ALPHANUMERIC_________| |__DATA__| |__literal_____| | | |__NUMERIC______________| | | |__ALPHANUMERIC-EDITED__| | | |__NUMERIC-EDITED_______| | | |__DBCS_________________| | | |__EGCS_________________| | |___________________________________________________________________________________________|
|
_______________________________________________________________________________________________________________ | | | >>__INSPECT__identifier__TALLYING___________________________________________________________________________> | | <___________________________________________________________________________________________________ | | <_____________________________________________________________________________ | | | >_____identifier__FOR_______CHARACTERS_______________________________________________________________|__|__>< | | | | <______________________ | | | | | |____before-after-phrase__|__| | | | | <___________________________________________________ | | | |_____ALL______________identifier_____________________________________|__| | | |__LEADING__| |__literal_____| | <______________________ | | | |____before-after-phrase__|__| | |_______________________________________________________________________________________________________________| _______________________________________________________________ | | | >>__INSPECT__identifier__CONVERTING_____identifier_____TO___> | | |__literal_____| | | >______identifier__________________________________________>< | | |__literal_____| | <______________________ | | | |____before-after-phrase__|__| | |_______________________________________________________________| __________________________________________________________________________________________________________________________ | | | >>__INSPECT__identifier__TALLYING______________________________________________________________________________________> | | <___________________________________________________________________________________________________ | | <_____________________________________________________________________________ | | | >_____identifier__FOR_______CHARACTERS_______________________________________________________________|__|__REPLACING___> | | | | <______________________ | | | | | |____before-after-phrase__|__| | | | | <___________________________________________________ | | | |_____ALL______________identifier_____________________________________|__| | | |__LEADING__| |__literal_____| | <______________________ | | | |____before-after-phrase__|__| | | <___________________________________________________________________________________________________ | | >________CHARACTERS__BY_____identifier__________________________________________________________________|_____________>< | | | |__literal_____| | <______________________ | | | | | |____before-after-phrase__|__| | | | | <_________________________________________________________________________ | | | |_____ALL______________identifier_____BY_____identifier_____________________________________|__| | | |__LEADING__| |__literal_____| |__literal_____| | <______________________ | | | |__FIRST____| |____before-after-phrase__|__| | |__________________________________________________________________________________________________________________________| _______________________________________________________________________________________________________________ | | | >>__INSPECT__identifier__REPLACING__________________________________________________________________________> | | <___________________________________________________________________________________________________ | | >________CHARACTERS__BY_____identifier__________________________________________________________________|__>< | | | |__literal_____| | <______________________ | | | | | |____before-after-phrase__|__| | | | | <_________________________________________________________________________ | | | |_____ALL______________identifier_____BY_____identifier_____________________________________|__| | | |__LEADING__| |__literal_____| |__literal_____| | <______________________ | | | |__FIRST____| |____before-after-phrase__|__| | |_______________________________________________________________________________________________________________|
|
_______________________________________________________ | | | >>_____BEFORE_______________________identifier_____>< | | |__AFTER___| |__INITIAL__| |__literal_____| | |_______________________________________________________|
|
____________________________________________________________________________________________________ | | | <__________________________________________________________________ | | <______________________ | | | >>__MERGE__file-name_________________ASCENDING___________________qualified-data-name__|__|_______> | | |__ON__| |__DESCENDING__| |__KEY__| | | <____________ | | >_____________________________________________________________USING__file-name____file-name__|___> | | |___________________SEQUENCE____________alphabet-name__| | | |__COLLATING__| |__IS__| | | >______OUTPUT__PROCEDURE____________procedure-name______________________________________________>< | | | |__IS__| |_____THROUGH_____procedure-name__| | | | | |__THRU_____| | | | | <____________ | | | |__GIVING____file-name__|____________________________________________________________| | |____________________________________________________________________________________________________|
|
_____________________________________________________ | | | <_____________ | | >>__MOVE_____identifier_____TO____identifier__|__>< | | |__literal_____| | |_____________________________________________________| ____________________________________________________________________ | | | <_____________ | | >>__MOVE_____CORRESPONDING_____identifier__TO____identifier__|__>< | | |__CORR___________| | |____________________________________________________________________|
|
________________________________________________________________________ | | | <____________________________ | | >>__MULTIPLY_____identifier_____BY____identifier_________________|___> | | |__literal_____| |__ROUNDED__| | | >____________________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >____________________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >___________________________________________________________________>< | | |__END-MULTIPLY__| | |________________________________________________________________________| __________________________________________________________ | | | >>__MULTIPLY_____identifier_____BY_____identifier______> | | |__literal_____| |__literal_____| | | <____________________________ | | >___GIVING____identifier_________________|_____________> | | |__ROUNDED__| | | >______________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________>< | | |__END-MULTIPLY__| | |__________________________________________________________|
|
____________________________________________________________________________________ | | | <__________________________________________________________________ | | <________________________________________________ | | | >>__OPEN_______INPUT____file-name______________________________________|_____|__>< | | | |_____REVERSED___________________| | | | | |______________NO__REWIND__| | | | | |__WITH__| | | | | <__________________________________________ | | | |__OUTPUT____file-name________________________________|_______| | | | |______________NO__REWIND__| | | | | |__WITH__| | | | | <____________ | | | |__I-O____file-name__|________________________________________| | | | <____________ | | | |__EXTEND____file-name__|_____________________________________| | | | |____________________________________________________________________________________| _________________________________________________ | | | <_______________________________ | | <____________ | | | >>__OPEN_______INPUT____file-name__|______|__>< | | | <____________ | | | |__OUTPUT____file-name__|__| | | | <____________ | | | |__I-O____file-name__|_____| | | | <____________ | | | |__EXTEND____file-name__|__| | | | |_________________________________________________|
|
___________________________________________________________________ | | | >>__PERFORM_____________________________________________________> | | >______procedure-name__________________________________________>< | | | |_____THROUGH_____procedure-name__| | | | | |__THRU_____| | | | |__statement-list__END-PERFORM__________________________| | |___________________________________________________________________| __________________________________________________________________________________________________________________________ | | | >>__PERFORM_____procedure-name_______________________________________perform-varying-phrase__perform-after-phrase_____>< | | | |_____THROUGH_____procedure-name__| | | | | |__THRU_____| | | | |__perform-varying-phrase__statement-list__END-PERFORM________________________________________________| | |__________________________________________________________________________________________________________________________| _____________________________________________________________________________________________________ | | | >>__PERFORM_____procedure-name__________________________________________identifier_____TIMES_____>< | | | |_____THROUGH_____procedure-name__| |__integer_____| | | | | |__THRU_____| | | | |_____identifier_____TIMES__statement-list__END-PERFORM__________________________| | | |__integer_____| | |_____________________________________________________________________________________________________| _________________________________________________________________________________________ | | | >>__PERFORM___________________________________________________________________________> | | >______procedure-name_______________________________________perform-until-phrase_____>< | | | |_____THROUGH_____procedure-name__| | | | | |__THRU_____| | | | |__perform-until-phrase__statement-list__END-PERFORM__________________________| | |_________________________________________________________________________________________|
|
________________________________________________________________ | | | >>________________________________________UNTIL__condition__>< | | |______________TEST_____BEFORE_____| | | |__WITH__| |__AFTER___| | |________________________________________________________________|
|
______________________________________________________________________________________________________________________________ | | | >>________________________________________VARYING_____identifier_____FROM_____identifier_____BY_____identifier_____UNTIL___> | | |______________TEST_____BEFORE_____| |__index-name__| |__index-name__| |__literal_____| | | |__WITH__| |__AFTER___| |__literal_____| | | >___condition_____________________________________________________________________________________________________________>< | |______________________________________________________________________________________________________________________________|
|
____________________________________________________________________________________________________________ | | | >>______________________________________________________________________________________________________>< | | | <__________________________________________________________________________________________ | | | |____AFTER_____identifier_____FROM_____identifier_____BY_____identifier_____UNTIL__condition__|__| | | |__index-name__| |__index-name__| |__literal_____| | | |__literal_____| | |____________________________________________________________________________________________________________|
|
__________________________________________________________________ | | | >>__READ__file-name____________________________________________> | | |__NEXT__| |__RECORD__| | | >______________________________________________________________> | | |__INTO__identifier__| | | >______________________________________________________________> | | |____________END__statement-list__| | | |__AT__| | | >_____________________________________________________________>< | | |__NOT____________END__statement-list__| |__END-READ__| | | |__AT__| | |__________________________________________________________________| _______________________________________________________________________ | | | >>__READ__file-name_________________________________________________> | | |__RECORD__| |__INTO__identifier__| | | >___________________________________________________________________> | | |__KEY____________qualified-data-name__| | | |__IS__| | | >___________________________________________________________________> | | |__INVALID_____________statement-list__| | | |__KEY__| | | >__________________________________________________________________>< | | |__NOT__INVALID_____________statement-list__| |__END-READ__| | | |__KEY__| | |_______________________________________________________________________|
|
______________________________________________________ | | | >>__RELEASE__record-name__________________________>< | | |__FROM__identifier__| | |______________________________________________________|
|
____________________________________________________________________ | | | >>__RETURN__file-name____________________________________________> | | |__RECORD__| |__INTO__identifier__| | | >_____________END__statement-list________________________________> | | |__AT__| | | >_______________________________________________________________>< | | |__NOT____________END__statement-list__| |__END-RETURN__| | | |__AT__| | |____________________________________________________________________|
|
_______________________________________________________ | | | >>__REWRITE__record-name____________________________> | | |__FROM__identifier__| | | >___________________________________________________> | | |__INVALID_____________statement-list__| | | |__KEY__| | | >___________________________________________________> | | |__NOT__INVALID_____________statement-list__| | | |__KEY__| | | >__________________________________________________>< | | |__END-REWRITE__| | |_______________________________________________________|
|
_____________________________________________________________ | | | >>__SEARCH__identifier____________________________________> | | |__VARYING_____identifier_____| | | |__index-name__| | | >_________________________________________________________> | | |____________END__statement-list__| | | |__AT__| | | <________________________________________ | | >_____WHEN__condition_____statement-list_____|____________> | | |__NEXT__SENTENCE__| | | >________________________________________________________>< | | |__END-SEARCH__| | |_____________________________________________________________| _________________________________________________________________________________________________________________ | | | >>__SEARCH__ALL__identifier___________________________________________________________________________________> | | |____________END__statement-list__| | | |__AT__| | | >___WHEN_____qualified-data-name_______________EQUAL__________________identifier______________________________> | | | |__IS__| | |__TO__| | |__literal________________| | | | | |__=________________| |__arithmetic-expression__| | | | |__condition-name-reference___________________________________________________________| | | >_____________________________________________________________________________________________________________> | | | <_______________________________________________________________________________________________ | | | |____AND_____qualified-data-name_______________EQUAL__________________identifier___________________|__| | | | |__IS__| | |__TO__| | |__literal________________| | | | | |__=________________| |__arithmetic-expression__| | | | |__condition-name-reference___________________________________________________________| | | >______statement-list________________________________________________________________________________________>< | | |__NEXT__SENTENCE__| |__END-SEARCH__| | |_________________________________________________________________________________________________________________|
|
__________________________________________________________ | | | <___________________ | | >>__SET_______index-name_____|__TO_____index-name_____>< | | |__identifier__| |__identifier__| | | |__integer_____| | |__________________________________________________________| ________________________________________________________________ | | | <_____________ | | >>__SET____index-name__|_____UP__BY__________identifier_____>< | | |__DOWN__BY__| |__integer_____| | |________________________________________________________________| _____________________________________________________ | | | <____________________________________ | | <________________ | | | >>__SET______mnemonic-name__|__TO_____ON______|__>< | | |__OFF__| | |_____________________________________________________| ______________________________________________________ | | | <___________________________ | | >>__SET____condition-name-reference__|__TO__TRUE__>< | |______________________________________________________| _________________________________________________ | | | <________________________________ | | >>__SET_______identifier__________________|___> | | |__ADDRESS__OF__identifier__| | | >___TO_____identifier________________________>< | | |__ADDRESS__OF__identifier__| | | |__NULL_____________________| | | |__NULLS____________________| | |_________________________________________________|
|
________________________________________________________________________________________________ | | | <__________________________________________________________________ | | <______________________ | | | >>__SORT__file-name_________________ASCENDING___________________qualified-data-name__|__|____> | | |__ON__| |__DESCENDING__| |__KEY__| | | >____________________________________________________________________________________________> | | |______________DUPLICATES_________________________| | | |__WITH__| |__IN__| |__ORDER__| | | >____________________________________________________________________________________________> | | |___________________SEQUENCE____________alphabet-name__| | | |__COLLATING__| |__IS__| | | <____________ | | >______USING____file-name__|_________________________________________________________________> | | |__INPUT__PROCEDURE____________procedure-name_______________________________________| | | |__IS__| |_____THROUGH_____procedure-name__| | | |__THRU_____| | | | | <____________ | | >______GIVING____file-name__|_______________________________________________________________>< | | |__OUTPUT__PROCEDURE____________procedure-name_______________________________________| | | |__IS__| |_____THROUGH_____procedure-name__| | | |__THRU_____| | | | |________________________________________________________________________________________________|
|
__________________________________________________________________________________________________ | | | >>__START__file-name___________________________________________________________________________> | | >______________________________________________________________________________________________> | | |__KEY_______________EQUAL________________________________________qualified-data-name__| | | |__IS__| | |__TO__| | | | |__=_________________________________________| | | |__GREATER___________________________________| | | | |__THAN__| | | | |__>_________________________________________| | | |__NOT__LESS_________________________________| | | | |__THAN__| | | | |__NOT__<____________________________________| | | |__GREATER______________OR__EQUAL____________| | | | |__THAN__| |__TO__| | | | |__>=________________________________________| | | >______________________________________________________________________________________________> | | |__INVALID_____________statement-list__| | | |__KEY__| | | >_____________________________________________________________________________________________>< | | |__NOT__INVALID_____________statement-list__| |__END-START__| | | |__KEY__| | |__________________________________________________________________________________________________|
|
_____________________________ | | | >>__STOP_____RUN_________>< | | |__literal__| | |_____________________________|
|
___________________________________________________________________________ | | | >>__STRING______________________________________________________________> | | <_______________________________________________________________ | | <___________________ | | | >__________identifier_____|__DELIMITED_______________identifier_____|___> | | |__literal_____| |__BY__| |__literal_____| | | |__SIZE________| | | >___INTO__identifier____________________________________________________> | | |______________POINTER__identifier__| | | |__WITH__| | | >_______________________________________________________________________> | | |____________OVERFLOW__statement-list__| | | |__ON__| | | >_______________________________________________________________________> | | |__NOT____________OVERFLOW__statement-list__| | | |__ON__| | | >______________________________________________________________________>< | | |__END-STRING__| | |___________________________________________________________________________|
|
__________________________________________________________ | | | <___________________ | | >>__SUBTRACT_______identifier_____|__FROM______________> | | |__literal_____| | | <____________________________ | | >_____identifier_________________|_____________________> | | |__ROUNDED__| | | >______________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________>< | | |__END-SUBTRACT__| | |__________________________________________________________| _________________________________________________________________ | | | <___________________ | | >>__SUBTRACT_______identifier_____|__FROM_____identifier______> | | |__literal_____| |__literal_____| | | <____________________________ | | >___GIVING____identifier_________________|____________________> | | |__ROUNDED__| | | >_____________________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >____________________________________________________________>< | | |__END-SUBTRACT__| | |_________________________________________________________________| __________________________________________________________ | | | >>__SUBTRACT_____CORRESPONDING_____identifier__FROM____> | | |__CORR___________| | | >___identifier_________________________________________> | | |__ROUNDED__| | | >______________________________________________________> | | |____________SIZE__ERROR__statement-list__| | | |__ON__| | | >______________________________________________________> | | |__NOT____________SIZE__ERROR__statement-list__| | | |__ON__| | | >_____________________________________________________>< | | |__END-SUBTRACT__| | |__________________________________________________________|
|
__________________________________________________________________________________________________________________ | | | >>__UNSTRING__identifier_______________________________________________________________________________________> | | >_______________________________________________________________________________________________________INTO___> | | |__DELIMITED__________________________identifier_________________________________________________| | | |__BY__| |__ALL__| |__literal_____| | <__________________________________ | | | |____OR________________identifier_____|__| | | |__ALL__| |__literal_____| | | <_______________________________________________________________________________________ | | >_____identifier____________________________________________________________________________|__________________> | | |__DELIMITER____________identifier__| |__COUNT____________identifier__| | | |__IN__| |__IN__| | | >______________________________________________________________________________________________________________> | | |______________POINTER__identifier__| |__TALLYING____________identifier__| | | |__WITH__| |__IN__| | | >______________________________________________________________________________________________________________> | | |____________OVERFLOW__statement-list__| |__NOT____________OVERFLOW__statement-list__| | | |__ON__| |__ON__| | | >_____________________________________________________________________________________________________________>< | | |__END-UNSTRING__| | |__________________________________________________________________________________________________________________|
|
_______________________________________________________________________________________________________________________________________ | | | >>__WRITE__record-name______________________________________________________________________________________________________________> | | |__FROM__identifier__| | | >______________________________________________________________________________________write-statement-phrase______________________>< | | | |_____BEFORE____________________________identifier___________________________| | |__END-WRITE__| | | | |__AFTER___| |__ADVANCING__| | |__integer_____| |_____LINE______| | | | | | | |__LINES__| | | | | | |__mnemonic-name________________________| | | | | |__PAGE_________________________________| | | | |__________________________________________________________________________________________________________| | | |__INVALID_____________statement-list__| |__NOT__INVALID_____________statement-list__| | | |__KEY__| |__KEY__| | |_______________________________________________________________________________________________________________________________________| _______________________________________________________ | | | >>__WRITE__record-name______________________________> | | |__FROM__identifier__| | | >___________________________________________________> | | |__INVALID_____________statement-list__| | | |__KEY__| | | >___________________________________________________> | | |__NOT__INVALID_____________statement-list__| | | |__KEY__| | | >__________________________________________________>< | | |__END-WRITE__| | |_______________________________________________________| _____________________________________________________________________ | | | >>__WRITE__record-name___________________________________________>< | | |__FROM__identifier__| |__END-WRITE__| | |_____________________________________________________________________|
|
___________________________________________________________________________________________________________________ | | | >>_____________________________________________________________________________________________________________>< | | |_______________END-OF-PAGE_____statement-list__| |__NOT_______________END-OF-PAGE_____statement-list__| | | |__AT__| |__EOP__________| |__AT__| |__EOP__________| | |___________________________________________________________________________________________________________________|
|
_____________________________________________________ | | | >>_____basis-statement___________________________>< | | |__cbl-process-statement__________________| | | |__control-cbl-statement__________________| | | |__copy-statement_________________________| | | |__delete-compiler-directing-statement____| | | |__eject-statement________________________| | | |__enter-statement________________________| | | |__insert-statement_______________________| | | |__ready-or-reset-trace-statement_________| | | |__replace-statement______________________| | | |__replace-statement______________________| | | |__service-label-statement________________| | | |__service-reload-statement_______________| | | |__skip1-2-3-statement____________________| | | |__title-statement________________________| | | |__use-statement__________________________| | |_____________________________________________________|
|
________________________________________________________ | | | >>_________________________BASIS_____basis-name_____>< | | |__sequence-number__| |__literal_____| | |________________________________________________________|
|
___________________________________________ | | | >>_____CBL_____________________________>< | | |__PROCESS__| |__options-list__| | |___________________________________________|
|
______________________________________________________ | | | <_________________ | | >>_____*CONTROL__________SOURCE_______|___________>< | | |__*CBL______| |__NOSOURCE__| |__.__| | | |__LIST______| | | |__NOLIST____| | | |__MAP_______| | | |__NOMAP_____| | |______________________________________________________|
|
___________________________________________________________________ | | | >>__COPY_____text-name__________________________________________> | | |__literal____| |_____OF________library-name_____| | | |__IN__| |__literal_______| | | >_______________________________________________________________> | | |__SUPPRESS__| | | >_________________________________________________________.____>< | | | <_________________________________ | | | |__REPLACING____copy-operand__BY__copy-operand__|__| | |___________________________________________________________________|
|
______________________________________________________________ | | | >>_________________________DELETE__sequence-number-field__>< | | |__sequence-number__| | |______________________________________________________________|
|
________________________ | | | >>__EJECT___________>< | | |__.__| | |________________________|
|
_____________________________________________________ | | | >>__ENTER__language-name______________________.__>< | | |__routine-name__| | |_____________________________________________________|
|
______________________________________________________________ | | | >>_________________________INSERT__sequence-number-field__>< | | |__sequence-number__| | |______________________________________________________________|
|
_______________________________ | | | >>_____READY_____TRACE__.__>< | | |__RESET__| | |_______________________________|
|
_____________________________________________________________________ | | | <_____________________________________________ | | >>__REPLACE____quoted-pseudo-text__BY__quoted-pseudo-text__|__.__>< | |_____________________________________________________________________| _________________________ | | | >>__REPLACE__OFF__.__>< | |_________________________|
|
________________________ | | | >>__SERVICE__LABEL__>< | |________________________|
|
_____________________________________ | | | >>__SERVICE__RELOAD__identifier__>< | |_____________________________________|
|
______________________________ | | | >>_____SKIP1______________>< | | |__SKIP2__| |__.__| | | |__SKIP3__| | |______________________________|
|
_________________________________ | | | >>__TITLE__literal___________>< | | |__.__| | |_________________________________|
|
______________________________________________________________________________ | | | >>__USE________________AFTER_____________________EXCEPTION_____PROCEDURE___> | | |__GLOBAL__| |__STANDARD__| |__ERROR______| | | <____________ | | >__________________file-name__|___________________________________________>< | | |__ON__| |__INPUT___________| | | |__OUTPUT__________| | | |__I-O_____________| | | |__EXTEND__________| | | | |______________________________________________________________________________| ____________________________________________________________________________ | | | >>__USE________________AFTER_____________________________________________> | | |__GLOBAL__| |__STANDARD__| |_____BEGINNING_____| | | |__ENDING_____| | | <____________ | | >_____________________LABEL__PROCEDURE_________________file-name__|_____>< | | |_____FILE_____| |__ON__| |__INPUT___________| | | |__REEL__| |__OUTPUT__________| | | |__UNIT__| |__I-O_____________| | | |__EXTEND__________| | | | |____________________________________________________________________________| ________________________________________________________________________ | | | <_________________ | | >>__USE_____________DEGUGGING_________________procedure-name__|_____>< | | |__FOR__| |__ON__| |__ALL__PROCEDURES______| | | | |________________________________________________________________________|
|
______________________________________ | | | >>_____combinable-condition_______>< | | |__combined-conditions_____| | |______________________________________|
|
________________________________________________________ | | | >>_____simple-condition_____________________________>< | | |__negated-simple-conditions_________________| | | |__abbreviated-combined-relation-conditions__| | |________________________________________________________|
|
__________________________________________ | | | >>_____class-condition________________>< | | |__condition-name-condition____| | | |__relation-condition__________| | | |__sign-condition______________| | | |__switch-status-condition_____| | | |__(__condition__)_____________| | |__________________________________________|
|
_________________________________________________________________ | | | >>__identifier__________________________NUMERIC______________>< | | |__IS__| |__NOT__| |__ALPHABETIC________| | | |__ALPHABETIC-LOWER__| | | |__ALPHABETIC-UPPER__| | | |__class-name________| | | |__DBCS______________| | | |__KANJI_____________| | |_________________________________________________________________|
|
__________________________________ | | | >>__condition-name-reference__>< | |__________________________________|
|
____________________________________________________ | | | >>__arithmetic-expression__relational-operator___> | | >___arithmetic-expression_______________________>< | |____________________________________________________|
|
__________________________________________________________ | | | >>_____________________________________________________> | | |__IS__| | | >____________________GREATER__________________________>< | | | |__NOT__| | |__THAN__| | | | | | |__>____________________| | | | | |__LESS_________________| | | | | | |__THAN__| | | | | | |__<____________________| | | | | |__EQUAL________________| | | | | | |__TO__| | | | | | |__=____________________| | | | |__GREATER______________OR__EQUAL______________| | | | |__THAN__| |__TO__| | | | |__>=__________________________________________| | | |__LESS______________OR__EQUAL_________________| | | | |__THAN__| |__TO__| | | | |__<__=________________________________________| | |__________________________________________________________|
|
____________________________________________________________________ | | | >>__arithmetic-expression__________________________POSITIVE_____>< | | |__IS__| |__NOT__| |__NEGATIVE__| | | |__ZERO______| | |____________________________________________________________________|
|
__________________________________ | | | >>__condition-name-reference__>< | |__________________________________|
|
________________________ | | | >>__NOT__condition__>< | |________________________|
|
____________________________ | | | >>__relation-condition___> | | >___abbreviation-rest___>< | |____________________________| ___________________________________________________________________ | | | >>__arithmetic-expression__relational-operator__________________> | | >___(_____________arithmetic-expression__abbreviation-rest__)__>< | | |__NOT__| | |___________________________________________________________________| _______________________________________________________________________________________________________________ | | | >>__arithmetic-expression__(_____________relational-operator__arithmetic-expression__abbreviation-rest__)__>< | | |__NOT__| | |_______________________________________________________________________________________________________________|
|
_________________________________________________________________________________ | | | <_____________________________________________________________________ | | >>_______AND___________________________________________abbreviation-leaf__|__>< | | |__OR___| |__NOT__| |__relational-operator__| | |_________________________________________________________________________________|
|
______________________________________________________________ | | | >>_____arithmetic-expression______________________________>< | | |__(__arithmetic-expression__abbreviation-rest__)__| | |______________________________________________________________|
|
____________________________________________________________________ | | | <__________________________________ | | >>__combinable-condition_______AND_____combinable-condition__|__>< | | |__OR___| | |____________________________________________________________________|
|
______________________________________________________ | | | >>__paragraph-name________________________________>< | | |_____IN_____section-name__| | | |__OF__| | |______________________________________________________| ______________________ | | | >>__section-name__>< | |______________________|
|
__________________________________________________________________ | | | >>__qualified-data-name________________________________________> | | | <__________________ | | | |____(__subscript__)__|__| | | >_____________________________________________________________>< | | |__(__leftmost-character-position__:________________)__| | | |__length__| | |__________________________________________________________________| ___________________________________________________ | | | >>__LINAGE-COUNTER_____________________________>< | | |_____IN_____file-name__| | | |__OF__| | |___________________________________________________|
|
______________________________________________________________________________ | | | >>__data-name_____________________________________________________________>< | | | <______________________ | |_____IN_____file-name__| | | |_______IN_____data-name__|__| |__OF__| | | |__OF__| | |______________________________________________________________________________| __________________________ | | | >>__special-register__>< | |__________________________|
|
_______________________________ | | | >>__arithmetic-expression__>< | |_______________________________|
|
_______________________________ | | | >>__arithmetic-expression__>< | |_______________________________|
|
_______________________________________________________________ | | | >>__condition-name__________________________________________> | | | <______________________ | | | |_______IN_____data-name__|__| | | |__OF__| | | >__________________________________________________________>< | | |_____IN_____file-name__| | <__________________ | | | |__OF__| |____(__subscript__)__|__| | |_______________________________________________________________| ____________________________________________________________ | | | >>__condition-name______________________________________>< | | | <__________________________ | | | |_______IN_____mnemonic-name__|__| | | |__OF__| | |____________________________________________________________|
|
________________________________________________________________ | | | <____________________________________________________ | | >>_______integer_________________________________________|__>< | | |__qualified-data-name__________________________| | | | |_____+_____integer__| | | | | |__-__| | | | |__index-name___________________________________| | | |_____+_____integer__| | | |__-__| | |________________________________________________________________|
|
__________________________________________________ | | | >>__times-div_________________________________>< | | | <_____________________ | | | |_______+_____times-div__|__| | | |__-__| | |__________________________________________________|
|
__________________________________________ | | | >>__power_____________________________>< | | | <_________________ | | | |_______*_____power__|__| | | |__/__| | |__________________________________________|
|
____________________________________________________ | | | >>_________________basis________________________>< | | |_____+_____| | <____________ | | | |__-__| |____**__basis__|__| | |____________________________________________________|
|
___________________________________________ | | | >>_____identifier______________________>< | | |__literal______________________| | | |__(__arithmetic-expression__)__| | |___________________________________________|
|
__________________________________ | | | >>_____quoted-pseudo-text_____>< | | |__identifier__________| | | |__literal_____________| | | |__cobol-word__________| | |__________________________________|
|
_________________ | | | >>_____F_____>< | | |__V__| | | |__U__| | | |__S__| | |_________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
_____________________________ | | | >>__qualified-data-name__>< | |_____________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
______________________________________ | | | >>__alphabetic-user-defined-word__>< | |______________________________________|
|
___________________________ | | | >>__user-defined-word__>< | |___________________________|
|
___________________________ | | | >>__user-defined-word__>< | |___________________________|
|
___________________________ | | | >>__user-defined-word__>< | |___________________________|
|
___________________________ | | | >>__user-defined-word__>< | |___________________________|
|
___________________________ | | | >>__user-defined-word__>< | |___________________________|
|
_____________________ | | | >>__system-name__>< | |_____________________|
|
_____________________ | | | >>__system-name__>< | |_____________________|
|
_____________________ | | | >>__system-name__>< | |_____________________|
|
_____________________ | | | >>__system-name__>< | |_____________________|
|
______________________ | | | >>__program-name__>< | |______________________|
|
______________________________ | | | >>_____ZERO_______________>< | | |__ZEROS___________| | | |__ZEROES__________| | | |__SPACE___________| | | |__SPACES__________| | | |__HIGH-VALUE______| | | |__HIGH-VALUES_____| | | |__LOW-VALUE_______| | | |__LOW-VALUES______| | | |__QUOTE___________| | | |__QUOTES__________| | | |__ALL__literal____| | | |__NULL____________| | | |__NULLS___________| | |______________________________|
|
___________________________________ | | | >>_____nonnumeric______________>< | | |__numeric______________| | | |__dbcs_________________| | | |__figurative-constant__| | |___________________________________|
|
________________________________________ | | | >>_____ADDRESS__OF__data-name_______>< | | |__DEBUG-ITEM________________| | | |__LENGTH__OF__identifier____| | | |__RETURN-CODE_______________| | | |__SHIFT-OUT_________________| | | |__SHIFT-IN__________________| | | |__SORT-CONTROL______________| | | |__SORT-CORE-SIZE____________| | | |__SORT-FILE-SIZE____________| | | |__SORT-MESSAGE______________| | | |__SORT-MODE-SIZE____________| | | |__SORT-RETURN_______________| | | |__TALLY_____________________| | | |__WHEN-COMPILED_____________| | |________________________________________|
|
Copyright (c) 1999, Ralf Lämmel & Chris Verhoef.
All rights reserved.
Permission is hereby granted by Ralf Lämmel and Chris Verhoef (the "Copyright holders"), free of charge, to any person obtaining a copy of this software in source code or binary form and associated files (the "Distribution"), to deal in the Distribution without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Distribution, and to permit persons to whom the Distribution is furnished to do so, subject to the following conditions:
DISCLAIMER
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.