$! $! Command procedure to invoke EDR reblocking routine $! $ set on $ on control_y then goto END $ on warning then goto ERRMSG $ on error then goto ERRMSG $! $ wo :== write sys$output $ ask :== inquire $ clr :== @sys$system:clear.com $ set512 :== $VOYAGER:[VOYAGER.DATA.EDR]SET512.EXE $! $ START: $ clr $ wo " VOYAGER EDR REBLOCKING PROGRAM DRIVER" $ wo "" $ wo "Reblocks all EDRs of user designated directory and file extension " $ wo "(.EDR, .JPL, etc.) to new files of variable length records with " $ wo "extension name .DAT." $ wo "" $ wo "Routine will accept input files of either STREAM-LF or FIXED 512 byte " $ wo "record format." $ wo "" $ wo "Expected input format:" $ wo "" $ wo "1. Full directory path " $ wo "" $ wo " DEVICE:[DIRECTORY PATH]" $ wo "" $ wo " ex. 1) DKA400:[VOYAGER.V2.EDR.Y89]" $ wo " ex. 2) VOYAGER:[VOYAGER.DATA.EDR]" $ wo "" $ wo "2. Input file extension" $ wo "" $ wo " ex. EDR, JPL" $ wo "" $ ask path "Input EDR path" $ name_position = f$locate(":", path) $ if name_position .eq. f$length(path) $ then $ write sys$output "Device name missing from path, ex., DKA400:" $ exit $ endif $! Get device name $ dev = f$extract(0,'name_position'+1,path) $! write sys$output "Device = ",dev $ name_position2 = f$locate("]", path) $ if name_position2 .eq. f$length(path) $ then $ write sys$output "Directory missing from path, ex., [VOYAGER.DATA.EDR]" $ exit $ endif $ ask outpath "Output EDR path ''path'" $ if outpath .eqs. "" then outpath = path $! write sys$output "outpath = ", outpath $ length= name_position2 - name_position + 1 $! Get directory name $ filepath = f$extract('name_position'+1,'length',path) $! write sys$output "Directory = ", filepath $ if dev .eqs. "DKA400:" .or dev .eqs. "CDROM:" $ then $! $ CDMOUNT: $ wo "" $ wo "CDROM mount required." $ ask ans "Is CDROM media in drive (y/n)?" $ if ans .eqs. "n" .or. ans .eqs. "N" $ then $ wo "" $ ask ans "Continue (y/n)?" $ if ans .eqs. "n" .or. ans .eqs. "N" then goto END $ clr $ goto CDMOUNT $ endif $ wo "Mounting CDROM..." $ wo "" $ mount/over=id/media=cdrom/undef=(fixed:none:512) 'dev' $ wo "" $ endif $! END CDMOUNT $ ask ext "Enter EDR file extension name [EDR]" $ if ext .eqs. "" then ext = "EDR" $ set verify $ directory/col=1/ver=1/notrail/nohead/out=edrlist.dat 'path'*.'ext' $ set noverify $ open infile edrlist.dat $ cnt = 0 $ loop: $ read/end=end_loop infile rec $ cnt = cnt + 1 $! write sys$output "rec = ", rec $ dir_position1 = f$locate("]",rec) $ dir_position2 = f$locate(";",rec) $! write sys$output "dir_position1 = ", dir_position1 $! write sys$output "dir_position2 = ", dir_position2 $ length = dir_position2 - dir_position1 - 5 $! Get EDR name w/o extension $ filename = f$extract('dir_position1'+1,'length',rec)' $ write sys$output "Reblocking EDR ", filename $! $ REBLOCK: $ open/write for005 for005.dat $ edrin = rec $ edrout = outpath + filename + ".DAT" $! write sys$output "edrin = ", edrin $! write sys$output "edrout = ", edrout $ file_fmt = F$FILE_ATTRIBUTES(edrin, "RFM") $ write sys$output "Input file has record format ",file_fmt $! Expect either Stream-LF (STMLF) or fixed length (FIX) record format $ if file_fmt .eqs. "STMLF" then set512 'edrin' $ write for005 edrin $ write for005 edrout $ close for005 $ open/read for005 for005.dat $ run voyager:[voyager.executable]EDR_REBLOCK_SORT.EXE $ close for005 $ delete/noconfirm for005.dat;* $! repeat for next EDR $ goto loop $ end_loop: $ close infile $ delete/noconfrim edrlist.dat;* $! Dismount CDROM $ if dev .eqs. "DKA400:" then dismount DKA400: $ if dev .eqs. "CDROM:" then dismount CDROM: $! $ END: $ wo "" $ exit $! $ ERRMSG: $ wo "" $ wo "RUNTIME ERROR ENCOUNTERED. PROCEDURE TERMINATED." $ wo "" $ set noon $ close for005 $ delete/noconfirm for005.dat;* $ close infile $ delete/noconfrim edrlist.dat;* $! Dismount CDROM $ if dev .eqs. "DKA400:" then dismount DKA400: $ if dev .eqs. "CDROM:" then dismount CDROM: $ exit