home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / dbaseii / tdas.ark / STUDENT4.PRG < prev    next >
Text File  |  1986-08-24  |  3KB  |  148 lines

  1. *******************************************************************************
  2. * This program deletes a student from the "active" file, but for nostalgia,   *
  3. * insurance and possible re-use at some later date, places that student       *
  4. * in the ex-student file.                                                     *
  5. *******************************************************************************
  6. SET Talk OFF
  7. STORE T TO delerec
  8. STORE T TO repeat
  9. STORE F TO drec,query2
  10. STORE "               " to Mname
  11.  
  12. ERASE
  13.  
  14. DO WHILE delerec
  15. DO WHILE repeat
  16. USE Student
  17. @ 3,30 SAY "YOUR COMPANY'S NAME"
  18. @ 5,9 SAY "-=>This program will delete a student from the active file<=-"
  19. @ 13,1 SAY "Enter the student's last name OR the acct. number";
  20.   GET Mname
  21. READ NOUPDATE
  22.  IF Mname = "               "
  23.  STORE F TO delerec
  24.  STORE F TO repeat
  25.  STORE F to finish
  26.  LOOP
  27.  ENDIF
  28.  
  29. IF VAL(Mname)>500
  30.   SET Index TO Id,Lname
  31.   STORE $(Mname,1,4) to Findstud
  32. ELSE
  33.   SET Index TO Lname,Id
  34.   STORE TRIM(Mname) to Findstud
  35. ENDIF
  36.  
  37. FIND &Findstud
  38.  
  39. IF #=0
  40.   @ 22,0 SAY Findstud+" is not in the student file"
  41.   LOOP
  42. ENDIF
  43. @ 22,0
  44.  
  45. IF #>0
  46.   STORE # to Placemark
  47.  
  48. IF .NOT. Acct:num=Findstud .OR. .NOT.Lname=Findstud
  49.   SKIP
  50.     IF Lname=Findstud .AND..NOT.EOF
  51.       ERASE
  52.       @ 1,1 SAY "Ahem!  It would appear we have more than one "+Findstud
  53.       SKIP -1
  54.       ?
  55.       DISPLAY Fname,Lname WHILE Lname=Findstud
  56.       ?
  57.       INPUT "Enter the number from the left column, or enter 0 to abort";
  58.         to Placemark
  59.     ENDIF
  60. ENDIF
  61.  
  62.   IF Placemark >0
  63.     GO Placemark
  64.     SET FORMAT TO Student4
  65.     READ NOUPDATE
  66.  
  67.     SET Format TO Screen
  68.     INPUT "Delete this record (Y/N)?" to Query
  69.  
  70.     IF Query
  71.       COPY NEXT 1 to Tfile
  72.       DELETE
  73.       ERASE
  74.     ENDIF
  75.   ENDIF
  76. *
  77. USE XStudent
  78. SET Index TO Xlname,Xid
  79. Append from Tfile
  80. STORE "               " to Mname
  81. ERASE
  82. *
  83. INPUT "Are there more students to delete from the active file (Y/N)?";
  84. TO repeat
  85.   IF repeat
  86.    ERASE
  87.    LOOP
  88.    USE STUDENT
  89.    SET INDEX to Lname,ID
  90.    STORE " " to Placemark
  91.    STORE "               " to Findstud
  92.   ELSE
  93.    STORE T TO finish
  94.   ENDIF
  95. ENDDO
  96. *
  97. IF finish
  98.   ERASE
  99.   USE Student INDEX Lname,ID
  100.   DISPLAY OFF TRIM(Fname),Lname for *
  101.   ?
  102. INPUT "Last Shot:  Should I complete deleting the above students (Y/N)?";
  103. TO Query2
  104. *
  105.   IF Query2
  106.       ERASE
  107.       @ 1,0
  108.       @ 2,0
  109.       @ 3,0
  110.       @ 4,0
  111.       @ 5,0
  112.       @ 6,0
  113.       @ 10,5 SAY "Relax, chum. This will take about 30-45 seconds"
  114.       @ 12,8 SAY "...Then you'll be flipped back to the main menu."
  115.       PACK
  116.       REINDEX
  117.     ELSE
  118.       RECALL ALL
  119.     ENDIF
  120.  ERASE
  121. ENDIF
  122. STORE F to Delerec
  123. RELEASE Editrec,Mname,Placemark,Query,Query2,repeat,finish
  124. DELETE FILE Tfile
  125. SET Talk ON
  126. ENDDO
  127. USE
  128. RETURN
  129. * EOF
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  INDEX to Lname,ID
  137.    STORE " " to Placemark
  138.    STORE "               " to Findstud
  139.   ELSE
  140.    STORE T TO finish
  141.   ENDIF
  142. ENDDO
  143. *
  144. IF finish
  145.   ERASE
  146.   USE Student INDEX Lname,ID
  147.   DISPLAY OFF TRIM(Fname),Lname for *
  148.