* TOTAL.CMD

STORE 0 TO MTOT
STORE 1 TO MCOUNT
STORE 0 TO MASGN
STORE 0 TO MAVG
DO WHILE MCOUNT <= 15
    IF MCOUNT < 10
        STORE "ASN0" + STR(MCOUNT,1) TO MASGN
    ELSE
        STORE "ASN"  + STR(MCOUNT,2) TO MASGN
    ENDIF
    IF &MASGN <> 999.00
        STORE (&MASGN * AVAL) + MTOT TO MTOT
        STORE AVAL + MAVG TO MAVG
    ENDIF
    STORE 1 + MCOUNT TO MCOUNT
ENDDO

STORE 1 TO MCOUNT
DO WHILE MCOUNT <= 5
    STORE "TEST0" + STR(MCOUNT,1) TO MASGN
    IF &MASGN <> 999.00
        STORE (&MASGN * TVAL) + MTOT TO MTOT
        STORE TVAL + MAVG TO MAVG
    ENDIF
    STORE 1 + MCOUNT TO MCOUNT
ENDDO

STORE 1 TO MCOUNT
DO WHILE MCOUNT <= 5
    STORE "PROJ0" + STR(MCOUNT,1) TO MASGN
    IF &MASGN <> 999.00
        STORE (&MASGN * PVAL) + MTOT TO MTOT
        STORE PVAL + MAVG TO MAVG
    ENDIF
    STORE 1 + MCOUNT TO MCOUNT
ENDDO

RETURN

   ENDIF
   IF SELECTION = 4
      USE &FILE
      DO ADDGRADE
   ENDIF
   IF SELECTION = 5
      USE &FILE INDEX &FIL