Skip to Content
Custom Search

COBOL EVALUATE LITERAL

 

EVALUATE LITERAL
 
The following COBOL program depicts the use of 
EVALUATE LITERAL
 
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PGM023.
       AUTHOR. MAINFRAMEWIZARD.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 STUDENT1-MARKS   PIC 999  VALUE ZEROS.
       01 STUDENT2-MARKS   PIC 999  VALUE ZEROS.
       PROCEDURE DIVISION.
       10000-MAIN-PARA.
             MOVE 99   TO STUDENT1-MARKS.
             MOVE 100  TO STUDENT2-MARKS.
             EVALUATE 100
                 WHEN STUDENT1-MARKS
                  DISPLAY 'STUDENT1 HAS 100% MARKS'
                 WHEN STUDENT2-MARKS
                  DISPLAY 'STUDENT2 HAS 100% MARKS'
                 WHEN OTHER
                  DISPLAY 'NONE OF THEM HAS 100% MARKS'
             END-EVALUATE
             STOP RUN.
 
 
 
 
The output of the program is 
 
 
STUDENT2 HAS 100% MARKS                                                                                                  

Comments

Post new comment

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Click the +1 button  below to share it with your friends and colleagues

 

Share this if you liked it!

 

Disclaimer



Who's online

There are currently 0 users and 28 guests online.
Dr. Radut | page