1! KERMITFIX.BAS - VAX BASIC & ! Written by Gary Stebbins, Digital Equipment Corporation & ! Convert VMS Backup-format files to fixed 512 records and back & ! & ! restriction: & ! requires backup save_set recordsize to be a multiple of 512 & ! (some tape save_sets don't meet this requirement) & ! & ! to use: & ! o create a backup save_set of file(s) with block size a multiple& ! of 512 - for example: & ! $ BACKUP files saveset.fil/SAVE_SET/BLOCK_SIZE=2048 & ! $ R KERMITFIX & ! o answer questions - output file will be fixed 512 byte records & ! o transfer file using KERMIT - receiving VAX KERMIT should be & ! SET FILE TYPE FIXED & ! o run kermitfix again - answer questions - output file is now & ! same recordsize as original backup save_set - backup can & ! now restore the files & ! 100 on error goto 25000 Print "KERMITFIX - 19-Feb-1985" 110 input "Backup file block_size <2048>"; backsize% backsize% = 2048% if backsize% = 0% ! supply default if (backsize%/512%)*512% <> backsize% then print "Backup file block_size must be a multiple of 512" goto 110 end if 120 input "File to convert"; infile$ insize% = 512% ! assume input is Kermit-format file 130 open infile$ for input as file #1% & ,sequential fixed & ,recordtype none & ,recordsize insize% print "Converting from Kermit to Backup format" outsize% = backsize% goto 150 140 insize% = backsize% ! input is BACKUP format outsize% = 512% ! output is Kermit format open infile$ for input as file #1% & ,sequential fixed & ,recordtype none & ,recordsize insize% print "Converting from Backup to Kermit format" 150 print "Output file name <"; infile$; input ">"; outfile$ outfile$ = infile$ if outfile$ = "" ! supply default 160 open outfile$ for output as file #2% & ,sequential fixed & ,recordtype none & ,recordsize outsize% 170 if insize% <> 512% then 220 180! convert from Kermit format to Backup format field #1%, 512% as in$ ! point to input buffer 190 outcount% = 0% ! nothing yet in output buffer for c% = 0% to outsize%/512%-1% 200 get #1% field #2%, c%*512% as out$, 512% as out$! point to output buffer lset out$ = in$ ! put data into output buffer outcount% = outcount% + 512%! count characters in output buffer next c% ! until it's full put #2%, count outcount% ! write output buffer goto 190 210 if outcount% > 0% then put #2%, count outcount% goto 240 220! convert from Backup format to Kermit format field #2%, 512% as out$ ! point to output buffer 230 get #1% \ incount% = recount ! get record for c%=0% to incount%/512%-1% field #1%, c%*512% as in$, 512% as in$ ! break input buffer lset out$ = in$ ! move data to output buffer put #2% ! write to file next c% goto 230 240 close 1%,2% \ goto 32767 & 25000! error handling routines if err <> 11% then 25100 25010 if erl = 110% then resume 32767 25020 if erl = 120% then resume 32767 25030 if erl = 150% then resume 32767 25040 if erl = 200% then resume 210 25050 if erl = 230% then resume 240 25100 if err = 148% and erl = 130% then resume 140 25110 on error goto 0 32767 end