Combined Condition in COBOL

Combined Condition

In combined condition, two or more conditions are connected using logical AND or OR operators.

Syntax:
IF [CONDITION] AND [CONDITION]
     COBOL Statements
END-IF

Example : Program to demonstrate Combined condition

IDENTIFICATION DIVISION.
PROGRAM-ID. CC.

DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 N1 PIC 9(3) VALUE 36.
   01 N2 PIC 9(3) VALUE 45.
   01 N3 PIC 9(3) VALUE 36.

PROCEDURE DIVISION.
   A000-FIRST-PARA.
   
   IF N1 IS LESS THAN N2 AND N1=N3 THEN
      DISPLAY 'The result of both the conditions are true.'
   ELSE
      DISPLAY 'False condition'
   END-IF.
   
STOP RUN.


Output:
The result of both the conditions are true.