home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / watup.zip / FILES.PRG next >
Text File  |  1985-06-11  |  1KB  |  32 lines

  1. PROCEDURE watup
  2. PARAMETERS action,wano,nof,namf
  3. ****************************************************************************
  4. * This procedure, 'Work Area Table UPdate' keeps track of open files       *
  5. * and work area's in use - it allows files to be opened and closed by      *
  6. * name without the calling command file having to keep track of work area  *
  7. * numbers. Written by John Dobson, Unique Systems, PO Box 19730,           *
  8. * Christchurch, New Zealand and released into the Public Domain for        *
  9. * distribution via RBBS systems.                                           *
  10. ****************************************************************************
  11. DO CASE
  12.   CASE action = 1
  13.     temp = AT('0',watnum)
  14.     watnum = SUBSTR(watnum,1,temp-1) + STR(nof,1) + SUBSTR(watnum,temp+1)
  15.     watnam = SUBSTR(watnam,1,((temp-1)*8)) + namf + SUBSTR(watnam,(temp*8)+1)
  16.     wano = STR(temp)
  17.     files = files + nof 
  18.   CASE action = 2
  19.     temp = (AT(namf,watnam) + 7) / 8
  20.     watnam = SUBSTR(watnam,1,((temp-1)*8)) + SPACE(8) ;
  21.       + SUBSTR(watnam,(temp*8)+1)
  22.     watnum = SUBSTR(watnum,1,temp-1) + '0' + SUBSTR(watnum,temp+1)
  23.     wano = STR(temp)
  24.     files = files - nof
  25.   CASE action = 3
  26.     CLOSE DATABASES
  27.     watnum = '0000000000'
  28.     watnam = SPACE(80)
  29.     files = 2
  30. ENDCASE
  31. RETURN
  32.