Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

The gmADS manual is available as PDF here.

Example of a Trivial gmADS Program

Code Block
OPEN SEGMENT    "DEMO.XEQ"      STATUS=NEW
  DEFINE PROGRAM "A Demo Program"

  DEFINE SET
    month(12)       "Months of the Year"
    acnt(3)         "Profit and Loss Ledger Accounts"
  END SET

  DEFINE VARIABLE
    mp(month,acnt) "Monthly Profit and Loss Figures ($)" TYPE=REAL(10,0)
    amp            "Average Monthly Profit ($)"          TYPE=REAL(10,2)
    mn(month)      "Month Names"                         TYPE=STRING(12)
    acn(acnt)      "Profit and Loss Account Names"       TYPE=STRING(12)
  END VARIABLE

  DEFINE RELATION
    ROW(month,mn)
    COLUMN(acnt,acn)
    KEY(acnt,acn)
  END RELATION

  READ mn
  January
  February
  March 
  April
  May
  June 
  July
  August
  September
  October
  November
  December

  READ acn:6
  Sales Costs Profit

  DEFINE PROCEDURE profits
    SELECT acnt(Sales)
      WRITE"Please enter the monthly sales figures."
      READ mp(acnt,month)
    SELECT acnt(Costs)
      WRITE"Please enter the monthly cost figures."
      READ mp(acnt,month)
    SELECT acnt*
      mp(m,3) = mp(m,1) - mp(m,2)
      amp = SUM(m)(mp(m,3)/12)
      WRITE mp
      WRITE amp
  END PROCEDURE profits

END PROGRAM, DO profits


Running the Trivial Sample

Code Block
Please enter the monthly sales figures.
    ? 13200 12100 14800 16200 15200 17200 18060 18960 19900 20900
    ? 21950 23050
  Please enter the monthly cost figures.
    ? 9200 8600 10400 11300 10700 12100 12700 13350 14000 14700
    ? 15440 16210

                  Monthly Profit and Loss Figures ($)
                                        
                              Sales       Costs      Profit
                                        
            January           13,200       9,200       4,000
            February          12,100       8,600       3,500
            March             14,800      10,400       4,400
            April             16,200      11,300       4,900
            May               15,200      10,700       4,500
            June              17,200      12,100       5,100
            July              18,060      12,700       5,360
            August            18,960      13,350       5,610
            September         19,900      14,000       5,900
            October           20,900      14,700       6,200
            November          21,950      15,440       6,510
            December          23,050      16,210       6,840

  Average monthly Profit ($) 5,235.00