       $set preprocess(htmlpp) endp
      ************************************************************************
      * Copyright (C) 1999 Micro Focus International Ltd.
      * All rights reserved.
      *  
      * This demonstration program is provided for use by users of 
      * Micro Focus products (the "Software") and may be used, 
      * modified and distributed as part of your application provided 
      * that you properly acknowledge the copyright of Micro Focus in this
      * material.
      *     
      * All conditions, warranties and undertakings, express or implied, 
      * statutory or otherwise, on the part of Micro Focus are excluded, 
      * including without limitation those of merchantability or fitness  
      * for purpose. This shall not, however, purport to exclude or 
      * restrict the liability of Micro Focus to any extent not 
      * permitted by law.
      *
      * IN NO EVENT WILL MICRO FOCUS BE LIABLE FOR ANY INDIRECT, 
      * INCIDENTAL, SPECIAL, CONSEQUENTIAL OR OTHER DAMAGES ARISING OUT 
      * OF THE USE OF THE DEMONSTRATION PROGRAM DISTRIBUTED WITH THE 
      * SOFTWARE, WHETHER OR NOT INFORMED OF THE POSSIBILITIES OF 
      * DAMAGES IN ADVANCE.  THESE LIMITATIONS APPLY TO ALL CAUSES OF 
      * ACTION, INCLUDING BREACH OF CONTRACT, BREACH OF WARRANTY, STRICT
      * LIABILITY, AND ANY ACTIONS IN TORTS.
      ************************************************************************
       identification division.
       program-id. piexec.
      *
       environment division.
       configuration section.
       object-computer. any-thing.
      *
       data division.
       working-storage section.
      *
       01  di-1.
           02 di-term          pic x(15).
           02 di-pi            pic x(15).
      *
       01  di-2.
           02 di-term2         pic x(15).
           02 di-pi2           pic x(15).
      *
       01  work-area.
           02 pi               pic s9v9(14).
           02 term             pic s9v9(14).
           02 w                pic s9v9(14).
           02 n                pic 9999.
           02 n1               pic 9999.
           02 n2               pic 9999.
           02 ed               pic -9.9(12).
      *
       procedure division.
       exec html
       <html>
       <head>
       <title>Calculation Of PI</title>
       </head>
       <body bgcolor="#ffffff">
       end-exec

       exec html
       <p><center><h1>Calculation of PI</h1></center></p>
       <hr>
       <table align="center" width="95%">
       <tr>
       <td bgcolor="#808080" align="center">Next Term</td>
       <td bgcolor="#808080" align="center">Value of PI</td>
       </tr>
       end-exec

       move 0.5 to ed
       move ed to di-term
       move 3 to ed
       move ed to di-pi

       exec html
       <tr>
       <td align="center">:di-term</td>
       <td align="center">:di-pi</td>
       </tr>
       end-exec

       move 0.5 to pi
       move 0.5 to term
       move 3 to n
       .

       loop.

       move n to n2.
       subtract 2 from n2.
       multiply n2 by n2.
       multiply n2 by term.
       move n to n1.
       subtract 1 from n1.
       multiply n by n1.
       multiply 4 by n1.
       divide n1 into term.
       if term < 0.0000000000001 then go to halt.
       add term to pi.
       move pi to w.
       multiply 6 by w.
       move w to ed.
       move ed to di-pi2.
       move term to ed.
       move ed to di-term2.

      * return table entry
       exec html
       <tr>
       <td align="center">:di-term2</td>
       <td align="center">:di-pi2</td>
       end-exec

       add 2 to n.
       if n < 100 go to loop.

       halt.
      *
      * End of html document
      *
       exec html
       </table>
       <hr>
       <p><center><h1>PI = :di-pi2</h1><center></p>
       </body>
       </html>
       end-exec
       stop run.
