* UPDATE.CMD

set talk off
store f to done
do while .not. done
    set confirm on
    set bell off
    set colon off
    erase
    @  1, 0 say "Menu to Update " + FILE2
    @  2,10 say "Choice     Description"
    @  3, 0 say LINE
    @  4,10 say "  1]       Enter a Student "
    @  5,10 say "  2]       Delete a Student "
    @  6,10 say "  3]       Alphabetize a Class "
    @  7,10 say "  4]       Change Class Parameters"
    @  8,10 say "  5]       Adjust a Student's Grade "
    @  9,10 say "  6]       DELETE A WHOLE CLASS "
    @ 10,10 say "  7]       Recalculate all Class Grades"
    @ 11,10 SAY "  8]       Return to Main Menu "
    store " " to choice
    store t to mcorrect
    do while mcorrect
      @ 15,10 say "Make Your Choice -----> " get choice pict "#"
      read
      if val(choice) < 1 .or. val(choice) > 8
        loop
      else
        store f to mcorrect
      endif
    enddo
    if choice = "1"
        do enter
    endif
    if choice = "2"
        do remove
    endif
    if choice = "3"
        erase
        @ 12,35 say "WORKING.  DO NOT TOUCH!!!"
        sort on name to temp
        use temp
        copy to &file
        use &file
    endif
    if choice = "4"
        do param
    endif
    if choice = "5"
        do adjust
    endif
    if choice = "6"
        do kill
    endif
    if choice = "7"
      STORE " " TO MANSW
      STORE F TO MDOIT
      ERASE
      DO WHILE .NOT. MDOIT
        @ 12,0 SAY "THIS WILL TAKE 4-12 MINUTES DEPENDING ON YOUR SYSTEM."
        @ 13,0 SAY "            DO YOU WISH TO CONTINUE? <Y/N> " GET MANSW
        READ
        IF !(MANSW) = "Y"
          goto top
          erase
          do while .not. eof
             @ 12,0 say " "
             ? "UPDATING STUDENT RECORD"
             ? #
             ?? "    " + NAME
             ?? "                       "
             DO CALTOTAL
             STORE 0.00 TO MTOTAL
             STORE MTOT/MAVG TO MTOTAL
             REPLACE TOTAL WITH MTOTAL
             DO GETGRADE
             REPLACE GRADE WITH MGRADE
             SKIP
          enddo
          STORE T TO MDOIT
        ENDIF
        IF !(MANSW) = "N"
          STORE T TO MDOIT
        ELSE
          LOOP
        ENDIF
      ENDDO
    endif
    if choice = "8"
        store t to done
    endif
enddo
release all like m*
release choice
release done
set confirm off
set bell on
return

 if choice = "1"
        do enter
    endif
    if choice = "2"
        do remo