      $set mfoo ooctrl(+n)
      ************************************************************************
      * Copyright (C) 1996-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.
      ************************************************************************
      * Program to create five different types of collection and
      * initialize with intrinsic values.
      ************************************************************************

       class-control.
           Array is class "array"
           CobolCompX is class "compx"
           .

       working-storage section.
      *----Data for initializing the collections
           01  loopCount               pic x(4) comp-5.
           01  element                 pic x(4) comp-x.
           01  i                       pic x(4) comp-5.

      *----Object references to hold array instances and
      *    a class template for COBOL intrinsic data.
           01  anArray                 object reference.
           01  picx4comp5              object reference.

       procedure division.
      *----A001. Create a new class representing PIC X(4) COMP-5
      *          COBOL intrinsic data.

           move 4 to i
           invoke cobolcompX "newClass" using i
                                    returning picx4comp5
      *----A002. Create an array of  10 elements for COBOL intrinsic
      *          data.
           move 10 to i
           invoke Array "ofValues" using picx4comp5 i
                               returning anArray
      *----A003. Store the integers from 10 counting down to 1
           move 10 to element
           perform varying loopCount from 1 by 1
                                     until loopCount > 10
               invoke anArray "atPut" using loopCount element
                                  returning element
           subtract 1 from element
           end-perform

      *----A004. Get the fourth element from the array and display it.
           move 4 to loopCount
           invoke anArray "at" using loopCount
                           returning element
           display element
           display " "



