PARM FSET=@.@.!hpaccount, ENTRY="MaIn" setjcw insidempex=0 setvar mpexfinfoany 1 setvar _ks_mpex "main.pub.vesoft" # Author: Paul H. Christidis @ phchristidis@west.raytheon.com # Command File: KSAMRCVR # Function: # Provides the capability to recover any CM mode KSAM files that # may have been open during a system failure. # Instead of 'blindly' recovering every KSAM file in the system, # this command file first determines if the file was indeed open during # system abort. A 'file system error' of 192 is returned to a process # that tries to open a KSAM file that was open during a system failure. # This command file is designed to use staight MPE/iX commands or # to use MPEX if it exists on the system. if insidempex = 0 AND "!entry" = "MaIn" then if finfo("!_ks_mpex","exists") then run !_ks_mpex;info="xeq !hpfile '!fset','!entry'" return else xeq !hpfile '!fset','NoNmPeX' return endif endif if "!entry" <> "ReAdFiLe" then echo (PHC) KSAM file recovery script V 97.09.17 !hpdatef, !hptimef setvar _ks_open_sysfail 192 setvar _ks_frecover 0 setvar _ks_fcheck 0 setvar _ks_msgfence hpmsgfence setvar hpmsgfence 2 endif if "!entry" = "MaIn" then REPEAT setvar fserror 0 CONTINUE SETVAR _ks_FNUM VEFOPEN("!MPEXCURRENTFILE,OLD") echo File: !mpexcurrentfile Open status: !fserror IF FSERROR = _ks_open_sysfail THEN ECHO System failed leaving !MPEXCURRENTFILE open: Recovering... ECHO Recovering !MPEXCURRENTFILE... continue run ksamutil.pub.sys;input="ki !mpexcurrentfile;recover" & ;input="exit" showtime echo setvar _ks_frecover _ks_frecover + 1 elseif fserror = 0 then calc VEFCLOSE(_ks_FNUM) ENDIF setvar _ks_fcheck _ks_fcheck + 1 FORFILES !FSET(CODE='KSAM' AND LOCKWORD='' AND NOT ISKSAMXL) elseif "!entry" = "NoNmPeX" then purge xlflistx,temp > $null build xlflistx;rec=-256,,v,ascii;disc=400000;temp file xlfx=xlflistx,oldtemp listf !FSET,6;*xlfx xeq !hpfile '!fset','ReAdFiLe' <*xlfx purge xlflistx,temp > $null reset xlfx elseif "!entry" = "ReAdFiLe" then setvar _ks_eof finfo(HPSTDIN,"eof") while setvar(_ks_eof, _ks_eof-1) >= 0 do input _ks_fname setvar _ks_fname RTRIM(_ks_fname) if finfo("!_ks_fname","filetype") = "KSAM" AND & finfo("!_ks_fname","fmtfcode") <>"KSAMK" AND & finfo("!_ks_fname","lockword") = "" then setvar _ks_fcheck _ks_fcheck + 1 setvar hpfserr 0 continue input _ks_text;wait=2 < !_ks_fname echo File: !_ks_fname Open status: !hpfserr IF hpfserr = _ks_open_sysfail THEN ECHO System failed leaving !_ks_fname open: Recovering... ECHO :echo Recovering !_ks_fname... >gpstdin echo KI !_ks_fname;recover >>gpstdin echo exit >>gpstdin continue ksamutil.pub.sys < gpstdin showtime echo setvar _ks_frecover _ks_frecover + 1 endif endif endwhile return endif setvar hpmsgfence _ks_msgfence echo echo !_ks_fcheck files checked, !_ks_frecover were recovered... echo endif if BOUND(traceon) then showvar _ks_@ else deletevar _ks_@ endif