HP OpenVMS Systems

ask the wizard
Content starts here

Why exiting with errors in Batch?

» close window

The Question is:

 
I have a 3 node cluster, all machines running vms 5.5
I have a command file which runs on a batch queue every day
(it resubmits itself 'tomorrow' as one of the first things it does)
When complete the job is retained on the batch queue with an
error, even though if you look at the logfile produced, the command
procedure finished without any problems.
 
This is what it looks like when the command procedure is finished...
 
88  LOGACC          TIB_ADMIN            Retained on error
       %RENAME-E-OPENIN, error opening !AS as input
         Submitted 11-MAY-1998 21:06
         /LOG=PETPT1$DKA100:[THOMAS_COOK_USERS.][PORTER.LOG_ACCESSES]LOGACC.LOG;
         /PARAM=("DISK$PETPT1_CTX:[CTXPLS.VDB]PETPT1_LOG_ACCESSES.11-MAY-1998",
         "DISK$PETPT1_CTX:[CTXPLS.VDB]PETPT8_LOG_ACCESSES.11-MAY-1998")
         /PRIORITY=100
         File: _PETPT1$DKA100:[THOMAS_COOK_USERS.PORTER.LOG_ACCESSES]LOGACC.COM;
         Completed 12-MAY-1998 03:33 on queue PETPT1_SPECIFIC
 
 
The command file looks like -
 
$ !**************************************
$ !* LOG_ACC - Log Accesses Job for TCs *
$ !**************************************
$ Setup:
$  set def tc$users:[porter.log_accesses]
$ Start:
$  sort 'P1,'P2 main_file.dat
$ Main_loop:
$  if f$file_attributes("main_file.dat","EOF") .eq. 0 then goto exit
$  open/read infile main_file.dat
$  read infile rec
$  page_no = f$edit(f$extract(52,(f$length(rec)-52),rec),"TRIM")
$  close infile
$ Search1:
$  assign stat_file.tmp sys$output
$  search/noheading/stat/output=page_file.tmp main_file.dat "''page_no'"
$  deassign sys$output
$ Search2:
$  search/noheading/output=new_file.tmp/match=nor main_file.dat "''page_no'"
$ Search3:
$  Read_loop:
$   open/read infile stat_file.tmp
$   read/end_of_file=end_read_loop infile rec
$   if f$extract(8,8,rec) .eqs. "matched:"
$    then
$     accesses = f$edit(f$extract(16,17,rec),"TRIM")
$     accesses = f$extract(0,5-f$length(accesses),"00000") + accesses
$   endif
$   goto read_loop
$  End_read_loop:
$  close infile
$  log_file_name = "''page_no'_''accesses'" + f$parse("''P1'",,,"TYPE")
$  rename/log page_file.tmp 'log_file_name;
$  set prot=(s:rwed,o:rwed,g:re,w:r) 'log_file_name
$  rename/log new_file.tmp main_file.dat;
$  purge/log *.dat
$  delete/log *.tmp;*
$  goto main_loop
$ Exit:
$  delete/log *.dat;*
 
$! Purge Files more than 35 daye old
$! NB File names are in format PP_AA.DD-MMM-YY
$!	where PP_AA = page no and accesses and DD-MMM-YY = date of access
 
$! Calculate today minus 35 days (PURDATE)
$  purdate = f$cvtime("''f$time()'-35-00","absolute","date")
$! Get month and year of PURDATE
$  purmth = f$cvtime("''purdate'","absolute","month")
$  puryr  = f$cvtime("''purdate'","absolute","year")
$  purmthyr = "''purmth'-''puryr'"
$! Delete all files where date of access is in same month as PURDATE
$! but where date of access is < PURDATE
$  delete *.*'purmthyr;*/bef='purdate
 
$! Get previous month to PURDATE
$  fstofmth = "01" + f$extract(f$locate("-",purdate),9,purdate)
$  prevmth = f$cvtime("''fstofmth'-1-00","absolute","month")
$  prevyr  = f$cvtime("''fstofmth'-1-00","absolute","year")
$  prevmthyr = "''prevmth'-''prevyr'"
$! Delete all files where date of access is in previous month from PURDATE
$! but where date of access is < PURDATE
 
$  on error then continue
$  on warning then continue
$  on severe then continue
$  delete *.*'prevmthyr;*/bef='purdate
$!
$exit:
$  exit
 
 
and if you look at the logfile, it finishes like so -
 
PETPT1>search logacc.log;* "-E-","-F-","-W-"/win=30
 
******************************
 
PETPT1$DKA100:[THOMAS_COOK_USERS.PORTER.LOG_ACCESSES]LOGACC.LOG;2033
$  delete *.*APR-1998;*/bef=14-APR-1998
 
$! Get previous month to PURDATE
$  fstofmth = "01" + f$extract(f$locate("-",purdate),9,purdate)
$  prevmth = f$cvtime("01-APR-1998-1-00","absolute","month")
$  prevyr  = f$cvtime("01-APR-1998-1-00","absolute","year")
$  prevmthyr = "MAR-1998"
$! Delete all files where date of access is in previous month from PURDATE
$! but where date of access is < PURDATE
 
$  on error then continue
$  on warning then continue
$  on severe then continue
$  delete *.*MAR-1998;*/bef=14-APR-1998
%DELETE-W-SEARCHFAIL, error searching for TC$USERS:[PORTER.LOG_ACCESSES]*.*MAR-1998;*
-RMS-E-FNF, file not found
$!
$exit:
$  exit
  TIB_ADMIN    job terminated at 19-MAY-1998 14:34:29.50
  Accounting information:
  Buffered I/O count:          127803         Peak working set size:    1024
  Direct I/O count:          15200445         Peak page file size:      4224
  Page faults:                 562715         Mounted volumes:             0
  Charged CPU time:           0 03:29:56.79   Elapsed time:     0 11:04:29.49
 
 
So at the end of all that, the question is why the hell does this job get
retained on the queue with an error, when in fact it completed 101% and there
is no error ? And how can I stop it acting in this way ?
 
Many thanks
 
        Laurie Knight
 
 


The Answer is :

 
  The Wizard sees various errors listed here including "%RENAME-E-OPENIN"
  and "%DELETE-W-SEARCHFAIL".
 
  If you wish to select a successful exit to override any failures that
  might have arisen prior to the EXIT command, then use:
 
    $ EXIT 1
 

answer written or last revised on ( 8-JUL-1998 )

» close window