The COBOL Compiler allows an optional word ARE in Relational Operators in Conditional Expressions

Technote (troubleshooting)


Problem(Abstract)

The IBM COBOL compiler has an undocumented extension that IS and ARE are treated as synonyms.

Symptom

Syntax such as the following, although illegal according to the Language Reference Manual, is not diagnosed as a syntax error:

IF operand-1 ARE NOT GREATER THAN operand-2...


Cause

Using IBM Enterprise COBOL for z/OS, the compiler fails to flag the word ARE as an optional keyword in a Relation Condition if it used instead of IS.

For example:

IF DATA-CODES ARE EQUAL TO VALID-CODE1.....

The documented syntax would allow

IF DATA-CODES IS EQUAL TO VALID-CODE1.....
or
IF DATA-CODES EQUAL TO VALID-CODE1.....


The Enterprise COBOL Language Reference Manual shows a syntax diagram similar to the following:

6.1.6.5 General relation conditions

 __ Format 1: general relation__________________    
 |>>_operand-1________________GREATER_______ _ __>    
 |           |_IS_| | |_NOT_| |         |_THAN_|  
 |                  |  |_ > ______________|      
 |                  |  |_LESS__ _____ ____|          
 |                  |  |       |_THAN_|   |          
 |                  |  |_ < ______________|          
 |                  |  |_EQUAL______ _____|          
 |                  |  |        |_TO_|    |          
 |                  |  |_ = ______________|          
 |                  |_GREATER_ ______ _OR EQUAL__ ____ _    
 |                  |         |_THAN_|           |_TO_|    
 |                  |_ >= ______________________________  
 |                  |_LESS__ _____ __OR EQUAL__ ____ ___  
 |                  |       |_THAN_|           |_TO_|      
 |                  |_ <= ______________________________
 |>_operand-2_______________________________________><|    


Resolving the problem

Allowing ARE in place of IS in this and other situations is a current behavior of the IBM COBOL compilers.


Although it is a current behavior, it cannot be counted on in the long term. IBM may correct this in the future so it is recommended that you not take advantage of this behavior and use documented syntax formats only.


Cross reference information
Segment Product Component Platform Version Edition
Software Development COBOL for VSE/ESA Compile VSE/ESA 1.1
Software Development COBOL for OS/390 & VM VM/ESA 2.1.2, 2.1.1

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Enterprise COBOL for z/OS
Compile

Software version:

3.4, 4.1, 4.2

Operating system(s):

z/OS

Reference #:

1247876

Modified date:

2014-05-02

Translate my page

Machine Translation

Content navigation