*****************************************
      * Program name: compute.cbl
      * This program provides examples of 
      * basic COMPUTE and DISPLAY usage.
      *
      * Copyright 2000 Deskware, Inc.
      *****************************************

       1 counter   PIC -------.99 value 0.
       1 num_val   PIC -------V99 value 0.
 
       compute counter = 5+4.
       display `5  +  4 = `&counter.

       compute counter = 5-4.
       display `5  -  4 = `&counter.

       compute counter = 5*4.
       display `5  *  4 = ` & counter.

       compute counter = 5/4.
       display `5  /  4 = ` & counter.

       compute counter = 5%4.
       display `5 mod 4 = ` & counter.

       compute counter = 1 and 0.
       display `1 and 0 = ` & counter.

       compute counter = 1 and 1.
       display `1 and 1 = ` & counter.

       compute counter = 0 or 0.
       display `0  or 0 = ` & counter.

       compute counter = 1 or 0.
       display `1  or 0 = ` & counter.

       compute counter = 1 or 1.
       display `1  or 1 = ` & counter.

       compute counter = 1 xor 0.
       display `1 xor 0 = ` & counter.

       compute counter = 1 xor 1.
       display `1 xor 1 = ` & counter.

       compute counter = 5^4.
       display `5 to the power of 4           =` & counter.

       compute counter = 1\4.
       display `1 *(10 to the power of 4)     =` & counter.

       compute counter = 5\2^2.
       display `(5 *(10 to the power of 2))` & linefeed &
               ` to the power of 2            =` & counter.

       compute counter = (2 * (5-2))^2.
       display `(2 *(5-2)) to the power of 2) =` & counter.

       compute counter = 13.
       display linefeed & `Direct assignment of 13 to counter` &
               ` gives it a value of` & counter.

       display linefeed &
               `Given counter =`& counter &`,`& 
               ` and num_val = `& num_val & `,`.  
       compute  counter=-num_val-counter-13-num_val.
       display ` computing the expression 'counter=-num_val-counter-13-num_val'`& linefeed&
               ` causes counter to evaluate to  ` & counter.