5000	REM	MERGE
	PRINT
	INPUT "ENTER NAME OF OLD MASTER: ";Z$
	MASTER$=Z$
	TRANSACTION$="QSOSORT.FIL"
	INPUT "ENTER NEW MASTER NAME: ";Z$
	OUT$=Z$
	FILLER$="                        "
	FLAGM=0
	FLAGT=0
 
	FILE	MASTER$
	FILE	TRANSACTION$
	FILE	OUT$
 
	PRINT CHR$(26)
	PRINT "MERGING...",
	GOSUB 5020
	GOSUB 5030
	GOTO 5040
 
5020	REM  READ MASTER
	READ #1; MCALL$,MNAME$,MQTH$,MFREQ$,\
	MDATE$,MTIME$,MCARD$
	IF MCALL$="END" THEN MCALL$="ZZZZZZ":FLAGM=1
	ML$=LEFT$(MCALL$,1)+MID$(MCALL$,3,7)+FILLER$
	IF LEFT$(ML$,1)="K" OR LEFT$(ML$,1)="N" OR LEFT$(ML$,1)="A" \
		THEN ML$="W"+MID$(ML$,2,7)+FILLER$
	M$=LEFT$(ML$,24)
	RETURN
 
5030	REM   READ TEMPORARY WORKFILE
	READ #2; TCALL$,TNAME$,TQTH$,TFREQ$,\
	TDATE$,TTIME$,TCARD$
	IF TCALL$="END" THEN TCALL$="ZZZZZZ":FLAGT=1
	TL$=LEFT$(TCALL$,1)+MID$(TCALL$,3,7)+FILLER$
	IF LEFT$(TL$,1)="K" OR LEFT$(TL$,1)="N" OR LEFT$(TL$,1)="A" \
		THEN TL$="W"+MID$(TL$,2,7)+FILLER$
	T$=LEFT$(TL$,24)
	RETURN
 
5040	REM	TEST
	IF FLAGM=1 THEN 5070
 
5045	REM	COMPARISON
	IF M$<T$ THEN 5050
	PRINT #3; TCALL$,TNAME$,TQTH$,TFREQ$,\
	TDATE$,TTIME$,TCARD$
	PRINT TCALL$,
	GOSUB 5030
	GOTO 5040
 
5070	IF FLAGT=0 THEN 5045
	PRINT#3; "END","END","END","END","END","END","END"
	CLOSE 3:CLOSE 2:CLOSE 1
	GOTO 2
 
5050	PRINT #3; MCALL$,MNAME$,MQTH$,MFREQ$,\
	MDATE$,MTIME$,MCARD$
	PRINT MCALL$,
	GOSUB 5020
	GOTO 5040
 
