sign in
 
   
 
 
 
   
  COBOL TUTORIAL FOR BCA STUDENTS OF M G UNIVERSITY  
  UNIT 4: PROCEDURE DIVISION . . .  
   
 

CONDITION

 
   
 

A condition is an entity that at one point of time can have only one of the two values – true or false. As already pointed out, the IF verb makes use of conditions.

In COBOL a condition can be any one of the following:

 
  Relational Condition.

Sign Condition.

Class Condition.

Condition-Name Condition.

Negated Simple Condition.

Compound Condition.

 
   
 

RELATIONAL CONDITION

 
   
 
A relational condition indicates a comparison between two operands and has the form:

 
   
 

It was stated earlier that the operands can be an identifier or a literal. However, either operand can also be an arithmetic expression but must contain at least one reference to an identifier. Sometimes, operand-1 and operand-2 are respectively referred to as the subject and object of the relational condition.

 
  Comparison of Numeric Operands  
 

In the case of Numeric Operands, the comparison is algebraic and the two operands can be compared regardless of the size and USAGE of the fields.

 
  Comparison of Nonnumeric Operands  
 

In the case of Numeic Operands, characters in the corresponding positions are compared to determine the value of the relational condition. Comparison starts with the leftmost character in both the fields and proceeds in a left to right manner. If the two characters being compared are found to be unequal at any stage, the field containing the greater (according to the collating sequence of the computer (NATIVE) or that specified by the PROGRAM COLLATING SEQURNCE clause in the OBJECT-COMPUTER paragraph) characters is considered to be greater.