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 tape and sequential-disk files has the syntax shown below. WRITE            record-name      [  FROM    identifier   ] As a resu

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

SEQUENTIAL FILE CREATION AND REWRITING: We have to write a program to create a student file with just two fields: sno i.e. Student Number and same i.e. Student Name. Add a few

PERFORM WITH TIMES OPTION: The format of a PERFORM TIMES statement is as shown below: Illustration:   A)  Perform the para-2 5 times. In this situation the specifie

Example of Special-names: Consider the illustration: Let the SPECIAL-NAMES paragraph be as shown: SPECIAL-NAMES. CHANNEL 1 IS PAGE-TOP. The Channel is related with the t

READ STATEMENTS: The common format for the read statements is as shown bellow. Format 1: READ file-name RECORD [ INTO   identifier ] [  ;  AT   END     imperative-s

MULTI-DIMENSIONAL TABLES: The type of table which has been considered above is known as one-dimensional table. Whenever a table is such that each of its elements in turn is a

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

Plus Sign - edit characters for numeric data: + (Plus Sign) : A plus sign is alike to minus sign except that when the item is positive, +sign will be inserted rather th

PROGRAM FOR PERFORM - VARYING: We have to write a program to elaborate PERFORM ...VARYING Identification division. Program- id. PerfVary. Environment division. Dat