IBMMainframes.com

VS COBOL II COMPRESSED GRAMMAR

 - Original Code by Ralf & Chris, Modified for Mainframe use by IBMMAINFRAMES.com

ID | IDENTIFICATION DIVISION.

PROGRAM-ID. <30-char-unreserved-alphanumeric-name> [ RECURSIVE | INITIAL [COMMON] [PROGRAM]].

[ AUTHOR. <comment entry>

DATE-WRITTEN.  <comment entry>

DATE-COMPILED.  <comment entry>

INSTALLATION.  <comment entry>

SECURITY.  <comment entry>

]

ENVIRONMENT DIVISION.

[CONFIGURATION SECTION.

[ SOURCE - COMPUTER. <computer name> ]

[ OBJECT-COMPUTER. <Computer-name>

               [PROGRAM COLLATING SEQUENCE IS <alphabet name1>] .|

| SPECIAL-NAMES.

               [DECIMAL-POINT IS COMMA]

               [CURRENCY SIGN IS <“unreserved capital alphabet character (not ABCDEGPRSVXZ)”>]

               [CLASS <user def name data name> IS <literal1> THRU <literal1>]*

               [(SYSIN/SYSOUT/SYSLST/CONSOLE IS <data name 2>)*

                   [ON STATUS IS <condition1>  OFF STATUS IS <condition2>]]*

               [ALPHABET <alphabet name1> IS NATIVE/EBCDIC/STANDARD-1/STANDARED-2

                                                                        / (one char alphabet1 THRU/ (ALSO one char alphabet2)*)* ]*       

               [SYMBOLIC CHARACTERS (<one char alphabet> IS <ord integer>)*[IN <alphabet name1>]] . | ]

[INPUT-OUTPUT SECTION.

| FILE-CONTROL.

                ((SELECT [OPTIONAL] <filename> ASSIGN TO [<label>][S-] AS- <JCL variable>)*

                [RESERVE >integer> AREAS]

                | ORGANIZATION IS [SEQUENTIAL]/RELATIVE/INDEXED |

                | ACCESS MODE IS [SEQUENTIAL]/RANDOM/DYNAMIC |

                |RELATIVE/RECORD KEY <alphanumeric data filed>|

                [ALTERNATIVE RECORD KEY < alphanumeric record field> [WITH DUPLICATES]*

                [PASSWORD IS <literal/data name>]

                [FILE STATUS IS <2 byte alphanumeric data item>, <6 byte group data item>] )*. |

[I-O-CONTROL.

                [SAME RECORD AREA FOR (<VSAM-filename>)*] . ] ]

]

[

DATA DIVISION.

[FILE SECTION.

| (FD <filename> [EXTERNAL] [GLOBAL]

                [BLOCK CONTAINS 0 RECORDS]

                | RECODING MODE F/V/S/U |

                [LINAGE IS <integer 2/dataname 2> LINES WITH FOOTING <integer3/dataname3>

                                       TOP <integer4/dataname 4> BOTTOM <integer 5/dataname5>]

                [CODE-SET IS <alphabet name1>] )* | ]

WORKING-STORAGE SECTION.

Data Description Entry

data-description-entry =level-number [(data-name|"FILLER")] data-description-entry-clauses"."

data-description-entry ="66"data-namerenames-clause"."

data-description-entry ="88"condition-namecondition-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])

 

picture-clause =("PICTURE"|"PIC")["IS"] picture-string

 

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}+]

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"|"COMP-5"|"COMP-6"| "COMPUTATIONAL" |"COMPUTATIONAL-1" |"COMPUTATIONAL-2"|"COMPUTATIONAL-3"|"COMPUTATIONAL-4"|"COMPUTATIONAL-5"|"COMPUTATIONAL-6"|"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

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}+

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-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-phraseperform-after-phrase|perform-varying-phrasestatement-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-phrasestatement-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]

compiler-directing-statement =(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-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-expressionrelational-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-expressionrelational-operator
"("["NOT"]arithmetic-expressionabbreviation-rest")"

abbreviated-combined-relation-conditions =arithmetic-expression"("["NOT"]relational-operatorarithmetic-expressionabbreviation-rest")"

abbreviation-rest ={("AND"|"OR")["NOT"][relational-operator]abbreviation-leaf}+

abbreviation-leaf =(arithmetic-expression|"("arithmetic-expressionabbreviation-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")
[END PROGRAM program-name]"."

]

Home | Mainframe Wiki | Free Downloads | Sample Programs | Mainframe Forum