10
20 INPUT"Input file 1: "in1$:in1%=OPENIN(in1$):IFin1%=0:PRINTin1$;" not found":END
30 INPUT"Input file 2: "in2$:in2%=OPENIN(in2$):IFin2%=0:PRINTin2$;" not found":END
40 INPUT"Output file: "out$:out%=OPENOUT(out$):IFout%=0:PRINT"Can't open "out$":CLOSE#in2%:CLOSE#in1%:END
50 ON ERROR IF FNerr:END
60 REPEAT
70 z%=66:REPEAT
80 IFNOTEOF#in1%:t1$=FNline(in1%) ELSE t1$=""
90 IFNOTEOF#in2%:t2$=FNline(in2%) ELSE t2$=""
100 PROCout(t1$+STRING$((40-LENt1$)AND(LENt1$<40)," ")+t2$)
110 UNTIL EOF#in1% AND EOF#in2%
120 CLOSE#out%:out%=0:CLOSE#in2%:in2%=0:CLOSE#in1%:in1%=0
130 PRINT
140 END
150 :
160 DEFFNerr:REPORT
170 IFin2%:A%=in2%:in2%=0:CLOSE#A%
180 IFin1%:A%=in1%:in1%=0:CLOSE#A%
190 IFout%:A%=out%:out%=0:CLOSE#A%
200 PRINT" at line ";ERL:=TRUE
210 :
220 DEFFNline(in%):LOCAL a$
230 REPEAT:A%=BGET#in%:IFA%>31:a$=a$+CHR$A%
240 UNTILA%=13:=a$
250 :
260 DEFPROCout(a$):IFout%=0:PRINTa$:ENDPROC
270 IFa$<>"":REPEATBPUT#out%,ASCa$:a$=MID$(a$,2):UNTILa$=""
280 BPUT#out%,13:PRINTCHR$13;100*PTR#in1% DIV EXT#in1%;"%";:ENDPROC