Example of compound condition, COBOL Programming

Example of compound condition:

In common, a compound condition has the form which is as shown below:

37_compound condition.png

Where condition-1 & condition-2 can be any one of the below:

  • a simple condition
  • a negated simple condition
  • the compound condition optionally enclosed in the parentheses
  • the negated compound condition where a compound condition enclosed in the parenthesesis preceded by NOT

It might be noted that no two logical operators can appear side by side except that the operators AND or OR may be instantly followed by NOT.

By using the above explained rules, fairly complicates compound conditions can be constructed. Though, in real practice, the requirement for a complicated compound condition hardly arises. For the sake of readability, it is suggested that the use of complex compound conditions must be avoided.

The illustration below is of the use of the compound condition. Let's take the sentence

 IF AGE IS LESS THAN 30 AND (HIGHLY-EDUCATED OR 

 HIGHLY-EXPERIENCED) MOVE 3 TO BONUS-CODE.

Here, HIGHLY-EDUCATED and HIGHLY-EXPERIENCED are the condition names. When either of them is true and if AGE is less than 30, 3 will be moved to the BONUS-CODE. Note the importance of parentheses. If these are omitted, the compound condition can become true if HIGHLY-EXPERIENCED is true regardless of the value of AGE and that of the condition name HIGHLY-EDUCATED.

Posted Date: 10/17/2012 1:47:14 AM | Location : United States







Related Discussions:- Example of compound condition, Assignment Help, Ask Question on Example of compound condition, Get Answer, Expert's Help, Example of compound condition Discussions

Write discussion on Example of compound condition
Your posts are moderated
Related Questions
Identification Division: The Identification Division is the first division of each and every COBOL source program. The paragraph PROGRAM-ID is necessary in most of the mac

Name the divisions in a COBOL program are given below DENTIFICATION DIVISION DATA DIVISION ENVIRONMENT DIVISION PROCEDURE DIVISION.

Structure of a COBOL Program: Every COBOL program should have the 4 divisions in the order in which they are specified below: 1. Identification division 2. Environment D

CR and DB (Credit and Debit Sign): The two characters that is CR or DB symbol may appear only at the rightmost place of the picture. They are similar to the minus sign edit ch

When using the accept verb in cobol is it possible to assign something other then "SYSIN" for a ddname?

Column and Field in COBOL program: In COBOL there are 2 types of entries termed as margin A and margin B entries. The Margin A entries start from the column 8, 9, 10 or 11 and

READ STATEMENT: The aim of this verb is to make available the next logical record from the input file. It is important to note the meaning of the "next" logical record in the

PROGRAM FOR ADD VERB: We have to write a simple program to elaborate the ADD verb. You can also use edit characters in the program. Identification division. Program- id.

CLOSE STATEMENT: When the processing of a file is completed, then the file may be closed. This is completed with the help of the CLOSE-verb. The form of the CLOSE statement is

Abbreviation: The Consecutive relational conditions in a compound condition can be abbreviated in many cases as shown: (i) When the subjects in the consecutive relational c