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
WRITE Statement:      The WRITE statement for a relative file has the format which is as shown below.          WRITE  record-name   [ FORM   identifier ]

Point Location: The position of the decimal point is the other characteristic which can be specified in the case of the numeric data items. If the position is not specified, t

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

NEGATED SIMPLE CONDITION: Any of the easy condition explained can be preceded by the logical operator NOT. The consequence of placing the operator NOT before an easy condition

The LENDER Bank offers mortgages on homes valued up to $500,000. The required down payment is calculated as follows: 4% of the first $60,000 borrowed 8% of the next $30,000 borro

ON SIZE ERROR OPTION:   If after an arithmetic expression, the result exceeds the highest value which can be accommodated in the result; this error is termed as size error. T

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.

Valid and Invalid Word - Cobol words: Valid Word             Invalid Word & Reason emp-sal                  -pay   ( it starts with a hyphen)  TOTAL MARK (blank space em

COMPUTE VERB: The COMPUTE verb is very powerful. All the evaluations performed by the other 4 verbs can also be completed easily by using the COMPUTE verb. Its normal format i

PROGRAM FOR COMPUTE VERB: We have to write an easy program to elaborate the COMPUTE verb.  Identification division. Program- id. compverb. Environment division. Da