Illustration of if- else statement, COBOL Programming

Illustration of if- else statement:

IF OK-BALANCE NEXT SENTENCE ELSE MOVE 2 BALANCE-CODE

In this illustration, the OK-BALANCE is a condition name. No action is specific if this condition is true. And when the condition is false, BALANCE-CODE must be set to 2. The sentence is equal to the following flow chart.

 

757_Illustration of if- else statement.png

It may be noted that any If sentence can be alternatively written by just negating the condition. In order to maintain the meaning of the unique sentence, the then and else parts are to be interchanged. Therefore the following sentence has similar meaning as the one illustrated above.

IF NOT OK-BALANCE MOVE 2 TO BALANCE-CODE ELSE NEXT-SENTENCE

If preferred, the ELSE NEXT SENTENCE phrase may be dropped to get the equivalent form as shown.

 IF NOT OK-BALANCE MOVE -2 TO BALANCE-CODE.

Posted Date: 10/17/2012 1:56:36 AM | Location : United States







Related Discussions:- Illustration of if- else statement, Assignment Help, Ask Question on Illustration of if- else statement, Get Answer, Expert's Help, Illustration of if- else statement Discussions

Write discussion on Illustration of if- else statement
Your posts are moderated
Related Questions
Example of compound condition: In common, a compound condition has the form which is as shown below: Where condition-1 & condition-2 can be any one of the below:

can we move spaces to numeric field

Comparison of the Numeric Operand with Nonnumeric Operand: The numeric operand can be compared to the nonnumeric operand subject to the restrictions which are as follows.

Example of read statement: Illustration: READ OLD-MASTER AT END MOVE ZERO TO END-OF-RECORDS. As a result of this statement, generally the next record from the OLD-MAST


PERFORM WITH VARYING OPTION: The format is as shown below:

Example of Sign condition: The illustration below describes the use of the sign condition. Illustration:     77  BALANCE  PIC  S9 (6) V99.       .       .     I

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

PROGRAMS FOR REDEFINES CLAUSE: We have to write a simple program to explain the REDEFINES clause at 01 level. identification division. program- id. Redef. environment

RULES FOR SEARCH VERB: The rules apply for the SEARCH verb is as shown below: (1) The SEARCH verb can be applied only to a table that has the OCCURS clause and INDEXED phra