Example of compound condition, COBOL Programming

Assignment Help:

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.


Related Discussions:- Example of compound condition

Identification division - cobol programming, Identification Division: ...

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

Delete statement - indexed files, DELETE STATEMENT : The file should be...

DELETE STATEMENT : The file should be opened in the I-O mode. If the access is SEQUENTIAL, the INVALID KEY phrase must be specified. Rather than, the last input-output state

Arithmetic verbs, ARITHMETIC VERBS: Most of the problems need some com...

ARITHMETIC VERBS: Most of the problems need some computations to be performed on the input or intermediate data that are numeric in nature. The Arithmetic verbs are used to pe

Structure of a cobol program, Structure of a COBOL Program: Every COBO...

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

Cobol words, COBOL Words: The COBOL word can be formed by using the ch...

COBOL Words: The COBOL word can be formed by using the characters as shown below: 0-9 A-Z (a-z) - (hyphen) The rules below should be hold in forming the COBOL words.

Multi-dimensional tables, MULTI-DIMENSIONAL TABLES: The type of table ...

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

Compound condition, COMPOUND CONDITION: The two simple conditions can ...

COMPOUND CONDITION: The two simple conditions can be connected by the logical operators AND or OR to form a compound condition (also termed as combined condition). When two co

Program to demonstrate merge verb, PROGRAM TO DEMONSTRATE MERGE VERB: ...

PROGRAM TO DEMONSTRATE MERGE VERB: The two files for which a record having 2 fields viz. Account Number and Name are already available. Now Merge these two files and create a

Add verb, ADD VERB: The ADD Verb can be used to find the sum of two or ...

ADD VERB: The ADD Verb can be used to find the sum of two or more numbers and to store the sum.  The ADD verb takes any one of the two forms as shown below:

Program for compute verb, PROGRAM FOR COMPUTE VERB: We have to write 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

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd