home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
dbsalvag.zip
/
SALVAGE.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-02-15
|
2KB
|
75 lines
100 REM: SALVAGE.BAS
101 REM:
102 REM: This program will build an output file from an
103 REM: input file coposed of records fo uniform length.
104 REM: The building will be done one record at a time. A
105 REM: carriage-return/line-feed pair will be written into
106 REM: the output file at the end of each record. After
107 REM: the last record has been written to the output file,
108 REM: an end-of-file marker (1A hex) will be written to
109 REM: the output file as the final byt.
110 REM:
111 REM:
112 REM: IN the event the input file may contain any end-
113 REM: of-file markers (1A hex), the program filter.bas
114 REM: must be run before this program is run. The output
115 REM: file from the filter program may be used as the
116 REM: input file to this program.
120 REM:
130 REM:
140 PRINT:PRINT
150 PRINT "File Data Salvager"
160 PRINT
170 PRINT
180 PRINT "Source File: ";
190 LINE INPUT FILE1$
200 LW$=FILE1$:GOSUB 1000:FILE1$=LW$
210 PRINT
220 PRINT "Output file: ";
230 LINE INPUT FILE2$
240 LW$=FILE2$:GOSUB 1000:FILE2$=LW$
250 PRINT
260 INPUT "Enter the START byte Count: ",START
270 INPUT "Enter the END byte Count: ",ENDD
280 INPUT "Enter the RECORD length: ",RLEN
290 PRINT:PRINT
300 PRINT "Is this information correct (Y/N) ";
310 Q$=INPUT$(1):IF Q$="Y" OR Q$ = "y" THEN GOTO 500
320 GOTO 170
500 REM: *** Start of data rtansfer ***
510 PRINT
520 PRINT
530 PRINT "Transferring...";
540 OPEN "I",1,FILE1$
550 OPEN "O",2,FILE2$
560 GOSUB 2000
570 FOR I = 1 TO INT(((ENDD-START)+1)/RLEN)
580 FOR J = 1 TO RLEN
590 A$=INPUT$(1,#1)
600 PRINT #2, A$;
610 NEXT J
620 PRINT #2,""
630 NEXT I
640 CLOSE #1
650 CLOSE #2
660 END
1000 REM: *** make upper case ***
1010 REM Entry -> lw$ exit -> lw$
1020 WRK$ = ""
1030 FOR X = 1 TO LEN(LW$)
1040 A=ASC(MID$(LW$,X,1))
1050 IF (A>&H60) AND (A<&H7F) THEN B=(A AND &H5F) ELSE B=A
1060 WRK$=WRK$+CHR$(B)
1070 NEXT X
1080 LW$=WRK$:RETURN
2000 REM: *** move pointer to start byte ***
2010 REM:
2020 A=INT(START/128)
2030 FOR I = 1 TO A
2040 A$=INPUT$(128,#1)
2050 NEXT I
2060 FOR I = 1 TO (START-(A*128))-1
2070 A$=INPUT$(1,#1)
2080 NEXT I
2090 RETURN