! REPLCT.BAS HUFFMAN LABORATORIES 5/26/87
! Kevin Wills and Ed Huffman
! AM100L System running AMOSL 1.3B
!
! Program will examine a directory file for files having
! identical hash values. This is handy for avoiding wasteful
! replications. The directory file REPLCT.LST must be gen-
! erated using DIR with the /D/H swithces in order for this
! program to recognize the data format. The directory file,
! REPLCT.LST, is sorted by hash value into REPLCT.HSH. The
! sorted file is examined for adjacent entries having identi-
! cal hash values. All replicate files are placed back into
! REPLCT.LST for examination.
!
! Example directory specification:
! .DIR REPLCT.LST=/D/H DSK0:[],DSK2:[]
!
STRSIZ 80
START=TIME/60
OPEN #1,"REPLCT.LST",INPUT
OPEN #2,"REPLCT.HSH",OUTPUT
PRINT
PRINT "SORTING REPLCT.LST TO REPLCT.HSH"
! AMSORT.SYS Should be loaded into system or user memory
XCALL BASORT,1,2,48,3,31,0,3,35,0,3,39,0
CLOSE #1
CLOSE #2
PRINT "SORTED TO REPLCT.HSH ELAPSED TIME=";TIME/60-START;"MIN"
OPEN #1,"REPLCT.HSH",INPUT
OPEN #2,"REPLCT.LST",OUTPUT
PRINT
PRINT "CREATING REPLICATE LISTING"
REMEMBER=0
CURR$=""
LOOP: IF EOF(1)=1 THEN GOTO FIN
PREV$=CURR$
INPUT LINE #1,CURR$
MATCH=0
IF RIGHT$(CURR$,22)=RIGHT$(PREV$,22) THEN MATCH=1
IF MATCH=1 THEN PRINT #2,PREV$
IF (REMEMBER=1) AND (MATCH=0) THEN PRINT #2,PREV$
REMEMBER=MATCH
GOTO LOOP
FIN: PRINT "LISTING IN REPLCT.LST TOTAL TIME=";TIME/60-START;"MIN"