Previous Topic: Debug an EOJ RuleNext Topic: End-of-Memory Rules


Example: EOJ Rule

Assume that you defined an RDF table containing information on the production payroll jobs. When each batch job in the processing sequence ends, the start and stop times and the maximum condition codes must be recorded.

)EOJ PAY*
)PROC
/* Only process productions jobs a by checking EOJ event variable */
   
if eoj.jobclass = 'P' then

/* Update RDF table with the EOJ data. Call the internal CONVTIME */
/* subroutine to format the start time to HH:MM:SS. This value    */
/* is originally in hundredths of seconds since midnight.         */

 address SQL Update PAYTAB Set
  "Start_date='"eoj.startdate" ',",
  "Start_time='"Convtime(eoj.starttime)"' ,",     /* convert data */
  "End_date='"Date('B')"',",
  "End_time='"Time('N')"',",
  "Cond_code='"eoj.maxcc"'",
  "Where Jobname='"eoj.jobname" ' "

return "NORMAL"

/* Convert binary time from hundredths of seconds since midnight  */
CONVTIME:
 cvtime=Arg(1)%100
 return Right(cvtime%3600,2,'0')':'||,    /* HH: */
   Right((cvtime%60)//60,2,'0')':'||,     /* MM: */
   Right(cvtime//60,2,'0')                /* SS  */

)END