Example of if- else statement, COBOL Programming

Assignment Help:

Example of If- else statement

Illustration:

  IF   QUANTITY IS NUMERIC AND QUANTITY IS POSITIVE 

        MOVE ZERO TO ERROR-CODE. COMPUTE SALES VALUE=QUANTITY*RATE                     

  ELSE MOVE 1 TO ERROR -CODE 

        MOVE ZERO TO SALES-VALUE  

The particular condition tests whether or not the present value of the data name QUANTITY is numeric as well as positive. If the condition is true then ERROR-CODE is set to zero and SALES-VALUE is computed by multiplying the QUANTITY by RATE. On the other hand, when the condition is FALSE, then ERROR CODE is set to 1 and SALES-VALUE is set to zero. In either situation the control goes implicitly to the next statement after this IF sentence. The above sentence is equal to the following flowchart.

971_Example of If- else statement.png


Related Discussions:- Example of if- else statement

Rules for occurs clause, RULES FOR OCCURS CLAUSE: The rules apply for ...

RULES FOR OCCURS CLAUSE: The rules apply for the OCCURS clause and the subscripts are as shown below. (1) The integer in the OCCURS clause should be a positive integer.

Illustration of perform statement, Illustration of perform statement: ...

Illustration of perform statement: PERFORM    CALCUALTE-TAX. In this illustration, the CALCULATE-TAX is either a section name or paragraph name. Assume that it is a section

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

Format for cobol programs, Format for COBOL Programs: The COBOL is a h...

Format for COBOL Programs: The COBOL is a high-level language. Therefore, a COBOL program can be executed on a computer for which a COBOL compiler exists. The compiler transla

Start statement - indexed files, START STATEMENT: The START statement ...

START STATEMENT: The START statement places the files to the initial logical record whose record key satisfies the condition specified by the KEY phrase. The access mode shoul

Program, calculate simple interest

calculate simple interest

File volatility and file interrogation, File volatility: File volatili...

File volatility: File volatility associates to the number of times the updating of records are needed during some time period. File interrogation: Some files hold re

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

Example of nested if statement, Example of Nested if statement: Illus...

Example of Nested if statement: Illustration: Consider the following sentence The nested IF sentence holds two IFs and one ELSE. The IF-ELSE couple has been marke

Program for renames clause, PROGRAM FOR RENAMES CLAUSE: identification...

PROGRAM FOR RENAMES CLAUSE: identification division. program- id. environment division. data division. working-storage section. 01 emp.      02 empdet.

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