PRO go_rdtap3, dummy, dev=dev, tape=tape, put_ydb=put_ydb, $ ydb=ydb, script=script, edit=edit, noexec=noexec, $ debug=debug, menu=menu ; --------------------------------------------------------------- ;+ 20-Jul-93 ;NAME: ; go_rdtap3 ;PURPOSE: ; To read a Yohkoh Archive tape, via menus and point and click. ; Note: default mode is to read the tape directory files from ; disk. The location on the disk is given by the alias or logical ; $DIR_GEN_XBD, which must be defined. ;CALLING SEQUENCE: ; go_rdtap3, [dev=dev, tape=tape] ; go_rdtap3 ;defaults to device #0 ; go_rdtap3, dev=1 ;use tape device #1 ; go_rdtap3, dev=1, /tape ;read tape directory from dev #1 ; go_rdtap3, /put_ydb ;restore weeklys to database dirs. ; ;INPUT: ; dev is the device number 0 or 1 (0 for /dev/nrmt0h...etc) ; disk switch to read tape directory files from disk. ; ;KEYWORD: ; menu if set, then wmenues are called. By default widgets ; are called. If widgets are not available menu will be set. ; ;HISTORY: ; Written Mar-92 by M.Morrison ; 15-Apr-92 (MDM) - changed calling sequence somewhat ; 24-Apr-92 (GAL) - added menu for dir and weekly files extraction ; 27-Apr-92 (gal) - Added documentation...for menus ; 14-May-92 (gal) - added more doc...re-rel 27-Apr ver that ; some how disappeared ; 20-May-92 (gal) - added safty features for those who do not have ; xbd files on $DIR_GEN_XBD ; 26-May-92 (gal) - added mount command for vms use ; 14-Jun-92 (gal) - minor menu and prompt changes, bug fix for ; data extraction. ; 17-Sep-92 (gal) - added feature to display size of extract ; files in Kbytes. ; 2-Dec-92 (MDM) - Patch to work when extracting only weekly files ; and no orbit files (bug introdcued with ; 17-Sep-92 modification - GET_AFILE_SIZE) ; 26-Apr-93 (gal) - added put_ydb switch to write weekly files to ; the database directory areas (e.g. $DIR_GEN_*). ; minor logic change for case of no prefix selected. ; 28-Apr-93 (gal) - bug fix ; 20-May-93 (MDM) - Changed call to FINDFILE to be *.* for VMS ; 19&20-Jul-93 (gal) - mods to get_afile_size call to pass the tape ; dir-file information (when reading tape dir-file ; from tape). ; 8-oct-93 (eee) - Added /MENU keyword and widget menues as the default. ; ;- ; ------------------------------------------------------------- ; Print, '>>>>>>>>>>> go_rdtap ver. 2.0, 20-July-93 <<<<<<<<<<<<<' Print, '>>>>>>>>>>> go_rdtap2 ver. 2.1, 08-Oct-93 <<<<<<<<<<<<<' if (n_elements(dummy) ne 0) then begin print, "SORRY - 'go_rdtap3' has changed. Please see document header-" print, 'Calling Sequence: go_rdtap3, [dev=dev, tape=tape]' stop end ; script=Keyword_set(script) ; if ((!version.arch eq 'alpha') and (!version.os eq 'OSF')) then script = 1 print,'script = ',script ; if (keyword_set(ydb)) then put_ydb=1 IF (keyword_set(dev) eq 0) then BEGIN dev = 0 tapdev = def_tapd(dev) ;default to device 0 ENDIF ELSE BEGIN tapdev = def_tapd(dev) ENDELSE print, 'Using Tape Device: ', tapdev ; Decide whether this will be in WMENU or WIDGET mode. if (!d.flags and 65536) eq 0 then menu = 1 ; widgets not available if n_elements(menu) eq 0 then menu = 0 else menu = keyword_set(menu) ; if (keyword_set(tape)) then begin if (script) then begin tapdir = 'tapedir' mtcmd, dev, /rewind mtcmd, dev, fsf=1 str = 'cp '+tapdev+' '+tapdir astr=str2arr(str, del=' ') print,'about to spawn out :',astr spawn,astr, /noshell print,'done spawning' endif else begin mt, tapdev, unit, /open, /mount ;add mount for vms print, 'Rewinding tape' mt, unit, /rewind print, 'Skipping forward one file to the binary directory file' mt, unit, skpf=1 tapdir = unit endelse end else begin ;ff = findfile('$DIR_GEN_XBD/xbd*') ff = file_list('$DIR_GEN_XBD', 'xbd*.*') ;MDM made * *.* 20-May-93 and removed / IF (ff(0) eq '') THEN BEGIN Print, '* No Tape Directory Files FOUND on disk!!!' ans = 'Y' & input, 'Read tape directory from tape?', ans , ans ans = STRUPCASE(ans) IF (ans eq 'Y') THEN BEGIN ;yes load from tape mess = 'Ready to read tape loaded into drive #'+strtrim(dev,2)+': ' ans = 'Y' & input, mess , ans, ans ans = STRUPCASE(ans) IF (ans eq 'Y') THEN BEGIN ;begin read of tape mt, tapdev, unit, /open, /mount ;add mount for vms print, 'Rewinding tape' mt, unit, /rewind print, 'Skipping forward one file to the binary directory file' mt, unit, skpf=1 tapdir = unit tape = 1 ;set tape flag ENDIF ELSE BEGIN ;do nothing Print, 'Exit go_rdtap3 without reading tape...' return ENDELSE ENDIF ELSE Begin Print, 'Exit go_rdtap3...' return ENDELSE ENDIF ELSE BEGIN ;read from disk direct. if (menu) then ss = wmenu_sel(ff,/one) $ else ss = yo_tape_widg(ff,/one) if ss(0) lt 0 then begin Print, 'Exit go_rdtap3...' return endif tapdir = ff(ss(0)) ENDELSE end ; rd_tapdir, tapdir, hdr, drecs ; if (keyword_set(tape)) then begin if (not script) then begin print, 'Rewinding and closing tape unit' mt, unit, /rewind mt, unit, /close, /dismount endif end ; ; Tape directory and Weekly Files MENU: ; weekly = STRING(hdr.wkprelst) weekly = str2arr(weekly, delimit=',') weeklyMenu = weekly + ' Log file' dir_week = ['Tape Dir file', weekly] dir_weekMenu = ['Tape Dir file', weeklyMenu] ; Widgets mode needs to know now, what are the types prefix = ['ADA', 'BDA', 'CBA', 'HDA', 'SFR', 'SPR', 'WDA'] if (menu) then begin Print,' ' Print,'**** Tape Directory and Weekly File Extraction ****' print,'To Extract the Tape directory or Weekly file click on selection',$ ' with mouse.' print,"To SKIP THIS MENU and/or to Continue click on 'Quit/Exit'." ss = wmenu_sel(dir_weekMenu) endif else $ ; typ_index returns which types the user selected. ss = yo_tape_widg(dir_weekMenu, types=prefix, typ_index=typ_index) if (ss(0) gt -1) then begin dir_week = dir_week(ss) ;generate true request list IF (dir_week(0) eq 'Tape Dir file') THEN BEGIN dirflag = 1 IF (N_elements(dir_week) gt 1) then BEGIN dir_week = dir_week(1:*) ENDIF ELSE BEGIN dir_week = '' ;null ENDELSE ENDIF ELSE BEGIN ;no tape directory requested dirflag = 0 ENDELSE endif else begin ;request for none of these dirflag = 0 dir_week = '' ;null endelse ; Data extraction via prefix fileids = string(drecs.fileid) fileids = fileids(1:*) ;remove the weekly file entry if (menu) then begin Print,' ' Print,'****** Data Extraction via File Types ******' Print,'Selection by point and click on File Types for Extraction.' print,"To SKIP THIS MENU and/or to Continue click on 'Quit/Exit'" ss = wmenu_sel(prefix) ; prefix assignment is made in above section endif else ss = typ_index ; typ_index assignment was made above. ; if (ss(0) ne -1) then begin prefix = prefix(ss) ;get requests endif else begin prefix = '' ;null endelse IF (prefix(0) ne '') THEN BEGIN ;check for null on 1st if (menu) then begin Print,' ' Print,'****** Data File Extraction ******' Print,'Selection by point and click on a File ID for Extraction' print,"To SKIP THIS MENU and/or to Continue click on 'Quit/Exit'" ss = wmenu_sel(fileids) endif else ss = yo_tape_widg(fileids) if (ss(0) gt -1) then begin fileids = fileids(ss) ;get requests endif else begin fileids = '' ;null -- no request endelse ENDIF ELSE fileids = '' ;no prefix ==> no fileids ; gen_fns = gen_fn(hdr, drecs, wkpre=dir_week,prefix=prefix,fileid=fileids) ss = where(gen_fns ne '') if (ss(0) eq -1) then begin print, 'GO_TOBAN: No files selected. Returning' return end else begin gen_fns = gen_fns(ss) ;drop the null file names (exists when reading ;weekly files but no orbit files) end if ( keyword_set(tape)) then begin ;tape dir-file from tape fn_sz = get_afile_size(gen_fns, wid=wid, hdr=hdr, drecs=drecs) endif else begin ;tape dir-file from disk fn_sz = get_afile_size(gen_fns, wid=wid) endelse prt_afile_size, gen_fns, fn_sz yesnox, 'Do you wish to read the tape now?', in, 'Yes' if (in eq 1) then begin print, 'Confirm that you have tape ', string(hdr.tapename) yesnox, 'Continue?', in2, 'Yes' if (in2 eq 1) then BEGIN IF dirflag THEN BEGIN IF (dir_week(0) ne '') THEN BEGIN CASE 1 OF (prefix(0) eq '') AND (fileids(0) eq ''): BEGIN rdtap3, tapdev, /dir, week=dir_week, $ put_ydb = put_ydb, $ script=script, edit= edit, $ noexec=noexec, debug=debug END (prefix(0) eq ''): BEGIN rdtap3, tapdev, /dir, week=dir_week, $ fileid=fileids, put_ydb = put_ydb, $ script=script, edit=edit, noexec=noexec, $ debug=debug END (fileids(0) eq ''): BEGIN rdtap3, tapdev, /dir, week=dir_week, $ prefix=prefix, put_ydb = put_ydb, $ script=script, edit=edit, noexec=noexec, $ debug=debug END ELSE: rdtap3, tapdev, /dir, week=dir_week, prefix=prefix, $ fileid=fileids, put_ydb = put_ydb, script=script, $ edit=edit, noexec=noexec, debug=debug ENDCASE ENDIF ELSE BEGIN CASE 1 OF (prefix(0) eq '') AND (fileids(0) eq ''): rdtap3, tapdev, /dir, $ script=script, edit=edit, $ noexec=noexec, debug=debug (prefix(0) eq ''): rdtap3, tapdev, /dir, fileid=fileids ,$ script=script, edit=edit, noexec=noexec, $ debug=debug (fileids(0) eq ''): rdtap3, tapdev, /dir, prefix=prefix, $ script=script, edit=edit, noexec=noexec, $ debug=debug ELSE: rdtap3, tapdev, /dir, prefix=prefix, fileid=fileids, $ script=script, edit=edit, noexec=noexec, $ debug=debug ENDCASE ENDELSE ENDIF ELSE BEGIN ;don't dump tape dir. IF (dir_week(0) ne '') THEN BEGIN CASE 1 OF (prefix(0) eq '') AND (fileids(0) eq ''): begin rdtap3, tapdev, week=dir_week, put_ydb = put_ydb, $ script=script, edit=edit, noexec=noexec, $ debug=debug end (prefix(0) eq ''): begin rdtap3, tapdev, week=dir_week, fileid=fileids, put_ydb = put_ydb, $ script=script, edit=edit, noexec=noexec, debug=debug end (fileids(0) eq ''): begin rdtap3, tapdev, week=dir_week, prefix=prefix, put_ydb = put_ydb, $ script=script, edit=edit, noexec=noexec, debug=debug end ELSE: begin rdtap3, tapdev, week=dir_week, prefix=prefix, fileid=fileids, $ put_ydb = put_ydb, script=script, edit=edit, $ noexec=noexec, debug=debug end ENDCASE ENDIF ELSE BEGIN CASE 1 OF (prefix(0) eq '') AND (fileids(0) eq ''): ;do nothing (prefix(0) eq ''): rdtap3, tapdev, fileid=fileids, $ script=script, edit=edit, noexec=noexec, $ debug=debug (fileids(0) eq ''): rdtap3, tapdev, prefix=prefix, $ script=script, edit=edit, noexec=noexec, $ debug=debug ELSE: rdtap3, tapdev, prefix=prefix, fileid=fileids, $ script=script, edit=edit, noexec=noexec, $ debug=debug ENDCASE ENDELSE ENDELSE endif end ; end