home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbsalvag.zip / SALVAGE.BAS < prev    next >
BASIC Source File  |  1987-02-15  |  2KB  |  75 lines

  1. 100 REM:                            SALVAGE.BAS
  2. 101 REM:
  3. 102 REM: This program will build an output file from an
  4. 103 REM: input file coposed of records fo uniform length.
  5. 104 REM: The building will be done one record at a time.  A
  6. 105 REM: carriage-return/line-feed pair will be written into
  7. 106 REM: the output file at the end of each record.  After
  8. 107 REM: the last record has been written to the output file,
  9. 108 REM: an end-of-file marker (1A hex) will be written to
  10. 109 REM: the output file as the final byt.
  11. 110 REM:
  12. 111 REM:
  13. 112 REM: IN the event the input file may contain any end-
  14. 113 REM: of-file markers (1A hex), the program filter.bas
  15. 114 REM: must be run before this program is run.  The output
  16. 115 REM: file from the filter program may be used as the
  17. 116 REM: input file to this program.
  18. 120 REM:
  19. 130 REM:
  20. 140 PRINT:PRINT
  21. 150 PRINT "File Data Salvager"
  22. 160 PRINT
  23. 170 PRINT
  24. 180 PRINT "Source File: ";
  25. 190 LINE INPUT FILE1$
  26. 200 LW$=FILE1$:GOSUB 1000:FILE1$=LW$
  27. 210 PRINT
  28. 220 PRINT "Output file: ";
  29. 230 LINE INPUT FILE2$
  30. 240 LW$=FILE2$:GOSUB 1000:FILE2$=LW$
  31. 250 PRINT
  32. 260 INPUT "Enter the START byte Count: ",START
  33. 270 INPUT "Enter the END   byte Count: ",ENDD
  34. 280 INPUT "Enter the RECORD length:    ",RLEN
  35. 290 PRINT:PRINT
  36. 300 PRINT "Is this information correct (Y/N) ";
  37. 310 Q$=INPUT$(1):IF Q$="Y" OR Q$ = "y" THEN GOTO 500
  38. 320 GOTO 170
  39. 500 REM:  *** Start of data rtansfer ***
  40. 510 PRINT
  41. 520 PRINT
  42. 530 PRINT "Transferring...";
  43. 540 OPEN "I",1,FILE1$
  44. 550 OPEN "O",2,FILE2$
  45. 560 GOSUB 2000
  46. 570 FOR I = 1 TO INT(((ENDD-START)+1)/RLEN)
  47. 580 FOR J = 1 TO RLEN
  48. 590 A$=INPUT$(1,#1)
  49. 600 PRINT #2, A$;
  50. 610 NEXT J
  51. 620 PRINT #2,""
  52. 630 NEXT I
  53. 640 CLOSE #1
  54. 650 CLOSE #2
  55. 660 END
  56. 1000 REM: *** make upper case ***
  57. 1010 REM Entry -> lw$     exit -> lw$
  58. 1020 WRK$ = ""
  59. 1030 FOR X = 1 TO LEN(LW$)
  60. 1040 A=ASC(MID$(LW$,X,1))
  61. 1050 IF (A>&H60) AND (A<&H7F) THEN B=(A AND &H5F) ELSE B=A
  62. 1060 WRK$=WRK$+CHR$(B)
  63. 1070 NEXT X
  64. 1080 LW$=WRK$:RETURN
  65. 2000 REM: *** move pointer to start byte ***
  66. 2010 REM:
  67. 2020 A=INT(START/128)
  68. 2030 FOR I = 1 TO A
  69. 2040 A$=INPUT$(128,#1)
  70. 2050 NEXT I
  71. 2060 FOR I = 1 TO (START-(A*128))-1
  72. 2070 A$=INPUT$(1,#1)
  73. 2080 NEXT I
  74. 2090 RETURN
  75.