      $set mfoo mf(11)

      *------------------------------------------------------------
      * Bank2 uses the account classes to demonstrate use of
      * Requirements-based Vocabulary to create new verbs and
      * functions.
      *------------------------------------------------------------
      * Copyright (C) 1996-2000  Micro Focus International Ltd.
      * All Rights Reserved.
      *------------------------------------------------------------

      *------------------------------------------------------------
      * B001. The .IF files are the class interfaces which define
      * new syntax for working with the bank account classes.
      * We do not need an interface file for every class; all types
      * of account class can use the definitions in these files for
      * their methods.
      *------------------------------------------------------------

        copy "account.if".
        copy "saccount.if".

        program-id. bank2.

        object section.
        class-control.
           Account is class "account"
           SavingsAccount is class "saccount"
           HighRateAccount is class "haccount"
           CheckAccount is class "caccount"
           .
       working-storage section.

      *----The first object is for CheckAccounts;
      *    the second for SavingsAccounts;
      *    the third for HighRateAccounts.
           01  anaccount  object reference.
           01  asaccount  object reference.
           01  ahaccount  object reference.
           01  acustomer  pic x(80).
           01  anamount   pic 9(10)v99.
           01  dispamount pic 9(5).99.
       procedure division.
      *----B002. First we create a new account for Dan, with $100.
      *    We will use the term anAccount to refer to this account.
      *    The account is opened by the CREATE verb, defined for use
      *    with the account classes.

           move "Dan" to aCustomer
           move 100 to anAmount
           create a new CheckAccount for aCustomer with anAmount
                          giving back a anAccount
      *----using an invoke for the same operation
      *    invoke CheckAccount "OpenAccount" using aCustomer
      *                                       anAmount
      *                             returning anAccount

      *----B003. Now we deposit an extra $1000 in the account
           move 1000 to anamount
           deposit anamount to anaccount
      *    invoke anAccount "Deposit" using anAmount
      *----B004. CREDIT is an alternative verb with the same meaning
      *    as DEPOSIT.
           move 500 to anAmount
           credit anAccount with anAmount
      *    invoke anAccount "Deposit" using anAmount

      *----B005. Withdraw money from the account
           move 50 to anAmount
           withdraw anamount from anaccount
      *    invoke anAccount "Withdraw" using anAmount
      *----B006. Get the balance of the account.
           get the balance for anaccount giving anAmount
           perform display-balance
      *    invoke anAccount "GetBalance" returning anAmount

      *----B007. We will now create a SavingsAccount.
           move "Chris" to acustomer
           move 1000 to anamount
           create a new SavingsAccount for aCustomer
              with anAmount giving asAccount
      *    invoke SavingsAccount "openAccount using aCustomer
      *                                             anAmount
      *                                   returning asAccount
      *----B008. The BALANCE function has been defined to get the
      *    balance of the account. It is an alternative to the syntax
      *    used above (see B006).
           if Balance (asAccount) > 999
              calculate interest for asAccount
           end-if
      *----B009. Get the changed balance of the account.
           get balance for asAccount giving anAmount
           perform display-balance
           stop run.

       display-balance section.
            move anamount to dispamount
            display dispamount.
