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
DIVIDE VERB: The aim of the DIVIDE verb is to divide one number by the other and to store the result.  There are few forms of this verb. One of its forms is as shown below:

Point Location: The position of the decimal point is the other characteristic which can be specified in the case of the numeric data items. If the position is not specified, t

RENAMES CLAUSE: At times re-grouping of an elementary data items in a record may be essential so that they can belong to the original as well as to the latest group. This is o

PROGRAM FOR ADD VERB: We have to write a simple program to elaborate the ADD verb. You can also use edit characters in the program. Identification division. Program- id.

NONSTANDARD CLAUSES: The various clauses explained above are as per the ANSI standard. Also, most compilers provide for additional nonstandard clauses to meet the specific nec

Data types available in COBOL are given below Alpha-numeric (X), numeric (9), alphabetic (A)

REWRITE STATEMENT: As in the situation of a relative file, the REWRITE statement needs that the file should be opened in the I-O mode, and if the SEQENTIAL access mode is spec

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

Example of Accept statement: For illustration, ACCEPT FLAG-A can be specified to read the value of the FLAG_A from the console. It may be keep in mind that no file definition

CLOSE statement: The simplified syntax of the CLOSE statement is as shown below:   CLOSE          file-name-1   [WITH   LOCK   ]                         [  , file-