home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / filedocs / simcvax.bas < prev    next >
Encoding:
BASIC Source File  |  1992-09-08  |  7.1 KB  |  257 lines

  1. !
  2. !  simcvax.bas  VAX BASIC V3.3
  3. !
  4. !  converts the index file SIMIBM.IDX into the
  5. !  easily read file SIMIBM.LST (for the entire list)
  6. !  or SIMIBM.LSTyymmdd (if the starting date is yymmdd)
  7. !  or SIMIBM.LSTsubstring (if using substring search)
  8. !
  9. !
  10. !  Gives the user the option to include in the list file only those
  11. !  files added to the index after a specified date or only those
  12. !  containing a given string.
  13. !
  14. !  Part of this program was translated from Dustin Fu's SIMCVT.FOR
  15. !  to VAX BASIC V3.3
  16. !
  17. !   New code/Updates by:
  18. !        Mark Harris
  19. !        Digital Equipment Corp
  20. !        Santa Clara, CA
  21. !        Internet:    harris_ma@wr2for.dec.com
  22. !        6/5/92        Scans better, memory for last scan date, etc
  23. !        1/10/91        Added scan options
  24. !        5/13/91        Fixed case sensitivity
  25. !        6/1/91        Valid names for output file, misc aesthetics
  26. !        7/1/91        Scan Monitor added
  27. !        12/31/91    Timestamp
  28. !
  29. !   Original updates by
  30. !                     Don Chodrow
  31. !                     Physics Department
  32. !                     James Madison University
  33. !                     Harrisonburg, VA 22807
  34. !                     BITNET:      FAC_CHOD@JMUVAX1
  35. !                     INTERNET:    dc@dirac.physics.jmu.edu
  36. !
  37. !
  38. !  This program will convert the file SIMIBM.IDX into a readable form,
  39. !  sending the output to the file SIMIBM.LST.  Because it is written in
  40. !  BASIC instead of FORTRAN, there is no need to convert quotes to
  41. !  apostrophes.
  42. !
  43. !  This program may be loaded into the VAX BASIC environment and run, or
  44. !  it may be compiled and linked to produce an .exe file:
  45. !
  46. !           $ basic simcvax
  47. !           $ link simcvax
  48. !           $ run simcvax
  49. !
  50.    searchfile$ = "SIMIBM"
  51. !
  52. !
  53. DIM #3,        TS_M%(1%),    &
  54.         TS_D%(1%),    &
  55.         TS_Y%(1%)
  56. Open "SIMCVAX.DAT" as file 3%,     &
  57.         Organization VIRTUAL FIXED,    &
  58.         Access MODIFY
  59. !
  60. If TS_M%(1)=0% Then
  61.     TS_D%(1)=1%
  62.     TS_Y%(1)=70%
  63.     TS_M%(1)=1%
  64. End If
  65. !
  66. SAVE_D%=TS_D%(1)
  67. SAVE_Y%=TS_Y%(1)
  68. SAVE_M%=TS_M%(1)
  69. !
  70. ! These above will be the last run's values...
  71. !
  72. !TS_D%(1)=VAL(LEFT(DATE$(0),2%))
  73. !TS_Y%(1)=VAL(MID(DATE$(0),8%,2%))
  74. !TS_M%(1)=(pos("JanFebMarAprMayJunJulAugSepOctNovDec",MID(DATE$(0),4%,3%),1%)+2%)/3%
  75. !Close 3%
  76. ! Now we have the SAVE_* values above as the date of LAST access...
  77. !
  78. print searchfile$+" - Public Domain and shareware listing as of ";date$(0)
  79. print
  80. !
  81. !
  82. print "Do you wish to locate a specific file or files with their FILENAME"
  83. input "or Description containing a substring <Y/N, Default:N>",yesno$
  84. yesno$ = left$(edit$(yesno$,32),1)
  85. substring$=""
  86. yesno$="N" unless yesno$="Y"
  87. !
  88. while substring$="" and yesno$="Y"
  89. input "Substring to locate ", substring$
  90. next
  91. !
  92. mask_substring$=""
  93. For I%=1% TO len(substring$)
  94. ATMP$=MID(edit$(substring$,32%),I%,1)
  95. ATMP%=ascii(ATMP$)
  96. mask_substring$=mask_substring$+ATMP$    &
  97.     IF    (ATMP%>=65% and ATMP%<=90%) or    &
  98.         (ATMP%>=48% and ATMP%<=57%)
  99. Next I%
  100. ! mask_substring$ Returned
  101. ! Valid Characters are A-Z,1-9
  102. !
  103. print "Do you want to list only those files added to the index"
  104. input "on or after a certain date <Y/N, Default:N>",yesno$
  105. yesno$ = left$(edit$(yesno$,32),1)
  106. starter$ = "0"
  107. if (yesno$ = "Y") then
  108.    yr%=0
  109.    while (yr% <70) or (yr% > 99)
  110.     print "Enter the last 2 digits of the starting year (";    &
  111.         NUM1$(Save_y%);"): ";
  112.     input yr%
  113.     yr%=save_y% if yr%=0%
  114.    next
  115.    month% = 0
  116.    while (month% < 1) or (month% > 12)
  117.     print "Enter the number of the starting month, 1 to 12 (";    &
  118.         NUM1$(Save_M%);") :";
  119.     input month%
  120.     month%=Save_m% if month%=0%
  121.    next
  122.    day% = 0
  123.    while (day% < 1) or (day% > 31) or ((month%=2) and (day%>29%))
  124.     Print "Enter the starting day, 1 to 31 (";    &
  125.         NUM1$(Save_D%);") :";
  126.     input day%
  127.     day%=Save_D% if day%=0%
  128.    next
  129.  
  130.    starter$ = str$(yr%)
  131.  
  132.    if (month% < 10) then
  133.       starter$=starter$ + "0"+str$(month%)
  134.    else
  135.       starter$ = starter$ + str$(month%)
  136.    end if
  137.  
  138.    if (day% < 10) then
  139.       starter$ = starter$ + "0" + str$(day%)
  140.    else
  141.       starter$ = starter$ + str$(day%)
  142.    end if
  143. end if
  144.  
  145. outfile$ = searchfile$+".lst"
  146. if starter$ <> "0" then
  147.    outfile$ = searchfile$+".lst" + starter$
  148. end if
  149. if substring$ <> "" then
  150.    outfile$ = searchfile$+".lst" + left(mask_substring$,8)
  151. end if
  152.  
  153. start% = val%(starter$)
  154. outfile$=edit$(outfile$,32)
  155.  
  156. open searchfile$+".IDX" for input as file #1
  157. open outfile$ for output as file #2
  158. print
  159. print "File being created: ";outfile$
  160. margin #2,80%
  161. number_of_matches%=0%
  162. number_of_records%=0%
  163. latest_entry=0
  164. Scan_tick=1000.00
  165.  
  166. print #2, ""+searchfile$+" PUBLIC DOMAIN AND SHAREWARE LISTING AS OF ";date$(0)
  167. if starter$ <> "0" then
  168.    print #2, " "
  169.    print #2, "This list contains files dated ";starter$;" or later."
  170. end if
  171. if substring$ <> "" then
  172.    print #2, " "
  173.    print #2, "This list contains files with names and/or descriptions"
  174.    print #2, "containing the substring : ";substring$
  175. end if
  176. print #2," "
  177. print #2, "NOTE: Type B is Binary; Type A is ASCII"
  178.  
  179. fs1$ = " "      ! initialize
  180. dir1$ = " "     ! initialize
  181.  
  182. qq$ = "'LLLLLLLLLLLL 'L ####### ###### "
  183. qq$ = qq$ + "'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL"
  184. !
  185. !  qq$ is the PRINT USING format string
  186. !
  187.  
  188. when error use closer  ! terminate program when end of file #1 is reached
  189.  
  190.   while 1 = 1  ! "endless" loop, terminated by end of file #1 "error"
  191.     input #1, fs2$,dir2$,filnam$,rev,lngth%,bits%,dt,descr$
  192.     Number_of_records%=Number_of_records%+1
  193.     if (Number_of_records%/Scan_tick) = INT(Number_of_records%/Scan_tick) THEN    &
  194.         PRINT Number_of_records%;"files searched. ";
  195.         IF Number_of_matches%=0% then    &
  196.             MF$="No"
  197.         ELSE
  198.             MF$=NUM1$(Number_of_matches%)
  199.         END IF
  200.         PRINT MF$;" matches found, continuing..."
  201.     END IF
  202.     latest_entry=dt if dt > latest_entry
  203.     if ((dt >= start%) and ( substring$="" )) or    &
  204.        (((start% <> 0%) and (substring$ <> "")) and    &
  205.         (dt>=start%) and     &
  206.     (pos(edit$(filnam$,32),edit$(substring$,32),1) or     &
  207.             pos(edit$(descr$,32),edit$(substring$,32),1))) or    &
  208.     ((pos(edit$(filnam$,32),edit$(substring$,32),1) or    &
  209.             pos(edit$(descr$,32),edit$(substring$,32),1)) and    &
  210.         start%=0) then
  211.       if ((fs1$ <> fs2$) or (dir1$ <> dir2$)) then
  212.           print #2," "
  213.           print #2,"Directory ";fs2$;dir2$
  214.           print #2," Filename   Type Length   Date    Description"
  215.           print #2,"=============================================="
  216.           dir1$ = dir2$
  217.           fs1$ = fs2$
  218.       end if
  219.  
  220.       if (bits% = 8) then
  221.          style$ = "B"
  222.       else
  223.          style$ = "A"
  224.       end if
  225.  
  226.       print #2 using qq$ ; filnam$,style$,lngth%,dt,descr$
  227.       number_of_matches%=number_of_matches%+1%
  228.     end if
  229.   next  ! end of "endless" loop
  230.  
  231. end when
  232.  
  233.  
  234. handler closer
  235.    if err = 11% then
  236.       close #1
  237.       close #2
  238.       !
  239.    end if
  240. end handler
  241. !
  242. ld$=num1$(latest_entry)
  243. mtmp%=val(mid(ld$,3%,2%))
  244. mtmp$=mid("JanFebMarAprMayJunJulAugSepOctNovDec",mtmp%*3%-2%,3%)
  245. dtmp$=mid(ld$,5%,2%)
  246. ytmp$=mID(ld$,1%,2%)
  247. print searchfile$;" has submissions through ";mtmp$;" ";dtmp$;", 19";ytmp$
  248. print         "Of";Number_of_records%;    &
  249.         "entries, the number of Matches found is";Number_of_matches%
  250. !
  251. TS_D%(1)=val(dtmp$)
  252. TS_Y%(1)=val(ytmp$)
  253. TS_M%(1)=mtmp%
  254. !
  255. close #3
  256. end
  257.