home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
log
/
hamsys
/
hamfiled.bas
< prev
next >
Wrap
BASIC Source File
|
1987-01-02
|
5KB
|
92 lines
10 'HAMFILED - Program to handle files
15 'CHANGE DATE - 1/1/87
20 J=1 :MRGQSO$=" " ' RECORD NUMBER GOING OUT/MRG AFTER NUMBER
30 ONN=-1 : OFFF = 0 :MRGSW=OFFF
40 D3F1$=" " ' TO SET LENGTH FOR LSET COMM
50 OKSW = OFFF ' INITIALIZE MERGING NUMB SWITCH
60 DEF SEG = 64 : POKE 23,64 ' Set CAPS LOCK on
70 CLS
80 CLS:LOCATE 8,1:PRINT "Which drive do you want to use for the input file?"
90 O$=INKEY$ : IF O$="" GOTO 90 ' WAIT FOR RESPONSE
100 IF O$ = "A" OR O$="B" THEN DR1$=O$+":" :GOTO 130 'DISKETTE A OR B
110 IF O$ = "C" OR O$="D" THEN DR1$=O$+":" :GOTO 130 'DRIVE C OR D
120 GOTO 80 ' NOT VALID DRIVE, RETRY
130 PRINT : PRINT "What drive do you want the output file on?"
140 O$=INKEY$ : IF O$="" GOTO 140 ' WAIT FOR RESPONSE
150 IF O$ = "A" OR O$="B" THEN DR4$=O$+":" :GOTO 180 'DISKETTE A OR B
160 IF O$ = "C" OR O$="D" THEN DR4$=O$+":" :GOTO 180 'DRIVE C OR DR B
170 GOTO 130 ' NOT VALID DRIVE, RETRY
180 OPEN DR2$+"HAMLOG.DAT" AS 1 LEN=72
190 FIELD 1,5 AS DF1$,15 AS DUM$,10 AS DF6$,42 AS REST$
200 ' *** ROUTINE TO GET HEADER RECORD AND DISPLAY WHILE USER IS READING MSG
210 OPEN DR1$+"HAMHDR.DAT" AS 3 LEN=24
220 FIELD 3,4 AS A$,4 AS B$,8 AS C$,8 AS D$ : GET 3,1 ' SET HEADER RECORD FLD
230 NUMREC=CVS(A$) ' Get number of records
240 CLOSE 3 ' MAKE FILE NUMBER AVAILABLE AS OUTPUT
250 PRINT:PRINT "Which drive do you want to use for the temporary file?"
260 O$=INKEY$ : IF O$="" GOTO 260 ' WAIT FOR RESPONSE
270 IF O$ = "A" OR O$="B" THEN DR2$=O$+":" :GOTO 300 'DISKETTE A OR B
280 IF O$ = "C" OR O$="D" THEN DR2$=O$+":" :GOTO 300 'DRIVE C OR D
290 GOTO 260 ' NOT VALID DRIVE, RETRY
300 OPEN DR2$+"HAMLOG.TMP" AS 3 LEN=72 ' OPEN TEMP OUTPUT
310 FIELD 3,5 AS D3F1$,15 AS DUM3$,10 AS D3F6$,42 AS REST3$
320 PRINT:PRINT "Do you want to merge a file (Y/N) ?"
330 O$=INKEY$ :IF O$="" GOTO 330
340 IF O$="N" OR O$="n" GOTO 480
350 PRINT:PRINT "Which drive do you want to use for the merging file?"
360 O$=INKEY$ : IF O$="" GOTO 360 ' WAIT FOR RESPONSE
370 IF O$ = "A" OR O$="B" THEN DR3$=O$+":" :GOTO 400 'DISKETTE A OR B
380 IF O$ = "C" OR O$="D" THEN DR3$=O$+":" :GOTO 400 'DRIVE C OR D
390 GOTO 360 ' NOT VALID DRIVE, RETRY
400 PRINT "WHAT QSO NUMBER SHOULD THIS BE MERGED AFTER? USE ENTER AFTER NUMBER."
410 INPUT O$: RSET MRGQSO$=O$ : MRGSW=ONN
420 OPEN DR3$+"HAMHDR.dat" AS 2 LEN=24
430 FIELD 2,4 AS A$,4 AS B$,8 AS C$,8 AS D$ : GET 3,1 ' SET HEADER RECORD FLD
440 GET 2,1:NUMMRG=CVS(A$) ' GET MRG HEADER FIELDS
450 CLOSE 2 ' CLOSE HEADER FILE
460 OPEN DR3$+"HAMLOG.DAT" AS 2 LEN=72 ' OPEN FILE MERGING IN
470 FIELD 2,5 AS D2F1$,15 AS DUM2$,10 AS D2F6$,42 AS REST2$
480 FOR K = 1 TO NUMREC ' GO THROUGH ENTIRE FILE
490 GET 1,K
500 IF DF1$=MRGQSO$ THEN OKSW = ONN ' START MERGE AFTER THIS RECORD OUT
510 IF DF6$=" " AND DELSW=ONN GOTO 610 'DROP CONTINUATION RECORDS
520 IF DF6$="**********" THEN DELSW=ONN : GOTO 560 ' DROP RECORD
530 RSET D3F1$=DF1$:LSET DUM3$=DUM$:LSET D3F6$=DF6$:LSET REST3$=REST$
540 IF D3F6$=" " THEN LSET D3F1$=" " 'NO QSO NUMBER
550 PUT 3,J :DELSW=OFFF :J=J+1 ' PUT RECORD AND TURN OFF DELETE
560 IF MRGSW = OFFF OR OKSW=OFFF GOTO 610 ' NO MERGING
570 L=L+1:IF L>NUMMRG THEN MRGSW=OFFF : GOTO 490 ' GOTTEN ALL OF THE RECORDS
580 GET 2,L
590 LSET D3F1$=D2F2$:LSET DUM3$=DUM2$:LSET D3F6$=D2F6$:LSET REST3$=REST2$
600 PUT 3,J:J=J+1:GOTO 570 ' GET ALL MERGE FILE
610 NEXT
620 PRINT "FINISHED BUILDING THE FILE. NOW I WILL COPY IT BACK"
630 CLOSE
640 IF DR4$=DR1$ THEN KILL DR1$+"HAMLOG.DAT" : KILL DR1$+"HAMHDR.DAT"
650 OPEN DR2$+"HAMLOG.TMP" AS 3 LEN=72 :' OPEN FILE TO COPY BACK
660 FIELD 3,5 AS QB$,67 AS BB$
670 OPEN DR4$+"HAMLOG.DAT" AS 1 LEN=72 ' OPEN FILE TO COPY BACK INTO
680 FIELD 1,5 AS QA$,67 AS AA$
690 GET 3,1: QSONUM=VAL(QB$) ' GET 1ST QSO IN FILE
700 LSET QA$=QB$ :LSET AA$=BB$ : PUT 1,1 ' TRANSFER 1ST RECORD
710 CC$=LEFT$(AA$,8) ' SET DATE IN HEADER RECORD
720 FOR J = 2 TO J-1 :GET 3,J
730 QSONUM=QSONUM+1 : RSET QA$=STR$(QSONUM) ' INCREMENT QSO NUMBER
740 LSET AA$=BB$ : PUT 1,J
750 NEXT
760 ' ***
770 ' * ROUTINE TO WRITE HEADER RECORD
780 ' ***
790 CLOSE 3
800 OPEN DR4$+"HAMHDR.DAT" AS 3 LEN=24
810 FIELD 3,4 AS A$,4 AS B$,8 AS C$,8 AS D$ : GET 3,1 ' SET HEADER RECORD FLD
820 LSET A$=MKS$(J-1):LSET B$=MKS$(QSONUM):LSET D$=LEFT$(AA$,8):LSET C$=CC$
830 PUT 3,1 ' WRITE HEADER
840 CLOSE
850 KILL DR2$+"HAMLOG.TMP"
860 IF O$="Y" OR O$="y" THEN KILL "B:HAMLOG.MRG" : KILL "B:HAMHDR.MRG"
870 RUN "MMENU
Y TO CONTINUE"
747 O$=INKEY$ : IF O$="" GOTO 747 ' WAIT FOR RESPONSE
750 RUN "MMENU