Illustration of nested if statement, COBOL Programming

Assignment Help:

Illustration of nested if statement:

Consider the nested sentence which is as shown below:

1186_Illustration of nested if statement.png

The IF-ELSE pairs in this sentence can be detected by applying the rule which is stated above. We point out the IF-ELSE relations by marking each pair with similar numbers within the circle. The sentence can now be easily acknowledged as an implementation of the following flow chart.

 

511_Illustration of nested if statement1.png

It can also be seen that while the last ELSE NEXT SENTENCE phrase can be dropped, it is not possible to drop the initial ELSE NEXT SENTENCE phrase. If this initial phrase is absent, the pairing of IF's and ELSE's will be disturbed. It is left as an exercise to confirm that the BONUS-CODE will then remain unchanged if the STAFF-CODE is other than the 1.

Though the similar action will be taken when STAFF-CODE is equal to 1, it is worthwhile to examine that this is as the condition in the last IF statement can never be true.

And hence, we examine the ELSE NEXT SENTENCE phrase is useful in many cases. The phrase also increases the readability. And hence, the use of the NEXT SENTENCE either in the then or else parts of an IF statement is suggested. The only exception can be when the

ELSE NEXT SENTENCE phrase is instantly followed by the terminating period of the IF sentence. This is because in this situation the ELSE should apply to the IF of the most inclusive IF statement of the nesting. And hence, the control will be transferred to the next sentence regardless of whether or not the ELSE NEXT SENTENCE phrase is explicitly involved.


Related Discussions:- Illustration of nested if statement

Kirat da satikar, bal majduri ik kanuni apradh hai is de bavjud bache ,ghra...

bal majduri ik kanuni apradh hai is de bavjud bache ,ghra,hotla,road, kam karn lai majbur han bacheya te mapeya nu parhai val prerit karn lai ik bashan teyar kro

Rules of move verb, RULES OF MOVE VERB:  The Data movement is managed ...

RULES OF MOVE VERB:  The Data movement is managed by the rules which are as shown below: (a) The contents of the identifier - 1 or the value of the literal - 1 is moved to

Example of level numbers - cobol programming, Example of Level numbers - co...

Example of Level numbers - cobol programming: To explain the hierarchical structure introduced above, the concept of the level number is employed in COBOL. The most broad

Example of move corresponding, Example of Move corresponding: Consider...

Example of Move corresponding: Consider the DATA DIVISION entries shown below. Suppose it is needed that the data stored in the 4 fields of the PAY_REC should be

Illustration of search verb, Illustration of Search verb: To illustrat...

Illustration of Search verb: To illustrate the other use of SEARCH verb, assume we wish to search the similar tab to find the number of persons whose deposited amount is more

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

Read statement, READ STATEMENT: The aim of this verb is to make availa...

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

Size - picture clause, Size: The number of characters or digits needed...

Size: The number of characters or digits needed to store the data item in the memory in termed as the Size of the data item. All the 4 general characteristics explained can

Direct organization, Direct Organization: Besides the relative or inde...

Direct Organization: Besides the relative or indexed organization, also a direct access file can be designed to have what is termed as direct organization.  In this organizati

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