	REM------FILE CMPRBIB.BAS

	REM COMPRESS BIBLIOGRAPHY FILE BY REMOVING MARKED ARTICLES

	COMMON KEYWD$(1),LIBNAME$,RLEN%,TRUE%,AUTH.LEN%,TITL.LEN%
	COMMON MAXBIB%,MAXDESC%,MAXDEF%,MAXKEYS%,MAXCON%,CONCEPT$(1)
	COMMON ISS.LEN%,CLEAR$,ERR%,JOUR.LEN%,KWD.LEN%,CMD$(1)
	COMMON LFT%(1),RGHT%(1),CON.KEY%(2),CON.RATE(2),QUERY$,L%

	PRINT CLEAR$
	PRINT TAB(12);"------COMPRESS BIBLIOGRAPHY------":PRINT

	REM IF NO BIBLIO FILE THEN GO BACK TO MENU
	IF END #2 THEN 5.9E1
	OPEN LIBNAME$+".BIB" RECL RLEN% AS 2
	IF SIZE(LIBNAME$+".BIB")=0 THEN DELETE 2 : GOTO 5.9E1

	REM OTHERWISE SCAN AND DELETE
	R.REC%=1 : DEL%=0
	IF END #2 THEN 5.8E1
	READ #2,1; LINE BUFF$
	WHILE TRUE%
  	READ #2,R.REC%;LINE BUFF$
  	IF LEFT$(BUFF$,5)="ZZZZ" THEN 5.2E1
    	IF R.REC%<>W.REC% THEN PRINT USING "&"; #2,W.REC%; BUFF$
    	R.REC%=R.REC%+1 : W.REC%=W.REC%+1:GOTO 5.3E1

5.2E1   R.REC%=R.REC%+1 : DEL%=DEL%+1

5.3E1   WEND

5.8E1   PRINT USING "&"; #2,W.REC%; CHR$(26)
	PRINT USING "######"; #2,1; W.REC%-2
	CLOSE 2
	PRINT W.REC%-2; " ARTICLES ON FILE"
	PRINT DEL%; " ARTICLES WERE REMOVED"

5.5E1   INPUT "PRESS RETURN TO GO BACK TO MENU";LINE ANS$
	CHAIN "BIBLIO"

5.9E1   PRINT "NO BIBLIO FILE NAMED ";LIBNAME$
	GOTO 5.5E1
  
