      $set mfoo ooctrl(+n)
      ************************************************************************
      * Copyright (C) 1991-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.
      ************************************************************************
       class-id. HighRateAccount
                       data is protected
                       inherits from SavingsAccount with data.

        object section.
        class-control.
           highRateAccount is class "haccount"
           SavingsAccount is class "saccount"
           ExceptionManager is class "exptnmgr"
           .
       working-storage section.
           copy "accinfo.cpy".
       class-object.
       object-storage section.

      *------------------------------------------------------------
      * Method OpenAccount overides the method OpenAccount of its base
      * class Account. This is because opening the High Interest
      * Account requires a minimum deposit of $1000, which behaves
      * differently from other accounts.
      *------------------------------------------------------------

       method-id. "openAccount".
       local-storage section.
           01 lsErrorNumber               pic x(4) comp-5.

       linkage section.
           01 lsInitialValue               pic 9(10)v99.
           01 lsName pic x(10).
           01 lsAccount                    usage object reference.

       procedure division using lsName lsInitialValue
                      returning lsAccount.
      *----H010. Check that the account is being opened with enough
      *          money.
           if lsInitialValue < 1000  then
      *--------H011. Raise an exception if there are insufficient funds
      *              to open the account. If there is no exception
      *              handler in place to trap this error, the default
      *              exception handler stops the application.
      *----H002. Get error offset and raise exception.
               invoke ExceptionManager "queryMessageFile"
                                       using "bank" "account"
                                   returning lsErrorNumber
               add insufficientFundsforAccount to lsErrorNumber
               invoke self "raiseException" using lsErrorNumber
                                        returning lsAccount
           else
      *--------H012. Open the account using the inherited method.
               invoke super "openAccount" using lsName lsInitialValue
                                      returning lsAccount
           end-if
           exit method.
       end method "openAccount".

      *------------------------------------------------------------
      * Set the first account number for high rate accounts.
      *------------------------------------------------------------
       Method-id. "getFirstAccountNumber".

       linkage section.
           01 lnkNumber               pic 9(8).
           01 lsErrorOffset           pic x(4) comp-5.

       procedure division returning lnkNumber.
      *----H001. Set up account numbering for high rate accounts.
           move 40000000 to lnkNumber
           exit method.
       end method "getFirstAccountNumber".
      *------------------------------------------------------------
      * Return the interest rate of this type of account
      *------------------------------------------------------------
       Method-id. "getRate".

       linkage section.
           01 lnkRate      pic 99v99 comp.
       procedure division returning lnkRate.
           move 10 to lnkRate
           exit method.
       end method "getRate".
       end class-object.
       Object.
       object-storage section.

      *------------------------------------------------------------
      * Print a statement to the display
      *------------------------------------------------------------
       method-id. "printStatement".
       local-storage section.

           01  displayBalance       pic -(9)9.99.

       procedure division.
      *----C020. Print a statement.
           display "High Rate Account"
           invoke self "updateBalance"
           display "Name:          " aName
           move balance to displayBalance
           display "Balance:       " displayBalance
           move interest to displayBalance
           display "Interest paid: " displayBalance
           exit method.
       end method "printStatement".
      *-----------------------------------------------------------------
      * Return the type of account.
      *-----------------------------------------------------------------
       method-id. "getType".

       linkage section.
           01  lsType          pic x(accTypeLength).

       procedure division returning lsType.
      *----H030. Return the account type.
           move spaces to lsType
           move highRateType to lsType
           exit method.
       end method "getType".
       end object.
       end class HighRateAccount.
