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

Example of condition names, Example of condition names: The illustrati...

Example of condition names: The illustration below is of the use of the condition names  77  MARITAL-STATUS     PIC    9   88  SINGLE    VALUE    IS     ZERO   88  MA

Write statement, WRITE STATEMENT: The WRITE Statement verb releases a r...

WRITE STATEMENT: The WRITE Statement verb releases a record in an output file. The syntax for the WRITE statement can be unlike depending on the output device and the medium us

Transaction file - file updation, Transaction file : A transaction file...

Transaction file : A transaction file is a file which contains new records those changes to old records which are used to update the master file. The problem of file updatio

Level numbers - cobol programming, LEVEL NUMBERS: The COBOL makes use ...

LEVEL NUMBERS: The COBOL makes use of the level number concept to explain the hierarchical data structure. A level number is a 2 digit number. The permitted level numbers a

Sequential files, SEQUENTIAL FILES:   The purpose of the proposed sec...

SEQUENTIAL FILES:   The purpose of the proposed section is to introduce the concepts such as File characteristics, File Description for Fixed-Length Records, File-Control

Relative files, RELATIVE FILES: The Files that are stored on a direct ...

RELATIVE FILES: The Files that are stored on a direct access storage medium like magnetic disk are frequently known as direct access files. The COBOL supports three different

Example of on size error option, ON SIZE ERROR OPTION: Whenever a size...

ON SIZE ERROR OPTION: Whenever a size error occurs, the contents of the result field after the operation is unpredictable.  Though, the processing is not-terminated and the co

Data names and identifiers - cobol program, Data Names and Identifiers:   ...

Data Names and Identifiers:   The Data name provides reference to the storage space in the memory where the real value is stored. This value takes part in the operation whene

Occurs clause, Occurs Clause: Let us establish tables with the help of...

Occurs Clause: Let us establish tables with the help of an illustration. Assume that there are ten different types of income-tax rates that are read from some input medium and

Program for master file maintenance , PROGRAM FOR MASTER FILE MAINTENANCE: ...

PROGRAM FOR MASTER FILE MAINTENANCE: We have to write a program to keep the stu-file for which a record has just 2 fields,viz., rno(Roll Number) and name(Student Name). Give t

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