#DESC Search for CA-JOBTRAC Event's with 'M' Dependencies and issue WTOR #SOURCE #CALLABLE /*DESCRIPTION: This IMOD will search the CA-Jobtrac checkpoint each */ /*time it is run looking for events which have 'M' dependencies. It */ /*then checks to see if the event is waiting on any other requirments */ /*(starttime, other dependencies,, etc.) If it does not find any, it */ /*will put out a WTOR to the operator if the event should be released. */ /*If the response is 'Y', the IMOD removes the 'M' dependency. */ /* */ /*DISCLAMER: This SAMPLE IMOD may require Modification to be used */ /* in your environment. */ /* */ /*INSTALL: See SAMPJCL(REXXCOPY) member to copy and compile IMOD. */ /* */ /*REQUIRED PRODUCTS/INTERFACES: CA-JOBTRAC and CA-GSS to be ACTIVE. */ /* */ /*REQUIRED DATASETS: CA-Jobtrac Checkpoint dataset must be allocated */ /* to the CA-GSS started task. */ /* */ /*STANDARD ARGUMENTS: CA-Jobtrac EXTENDED SCHEDULING GUIDE. */ /* also uses DATE#G2J IMOD, which is imbedded in this IMOD. */ /* */ /*EXECUTION REQUIREMENTS BELOW: */ /* */ /*Invoked as an IMOD Interval event from CA-JOBTRAC */ /*(See CA-JOBTRAC's SCHEDULE CREATION GUIDE) */ /* */ /*CA-JOBTRACs checkpoint must be allocated to the CA-GSS started task */ /* */ /*Command: IMOD should be invoked as a CA-JOBTRAC IMOD event */ /* Can be issued from Online, Batch, Console and or Scheduled. */ /* */ trace i time = TIME() /* First set up some variables */ time = SUBSTR(time,1,2)||SUBSTR(time,4,2) /* that we will need later */ jdate = DATE('J') /* time = Current time (HHMM) */ year = SUBSTR(jdate,1,2) /* jdate = Today Julian (YYDDD) */ /* */ /*For info on ADDRESS JOBTRAC, see the CA-JOBTRAC EXTENDED SCHEDULING GUIDE */ /*Other functions and commands are documented in IBMs REXX REFERENCE GUIDE */ /* */ DO FOREVER /* Now begin our "search loop" */ DROP jobname depends stime sdate ttime tdate /* Initialize variables used in loop */ ADDRESS JOBTRAC "GET JOB(*) DEP(M) VERS(NEXT)" /* Ask CA-Jobtrac for a 'M' dep job */ IF rc ^= "0" THEN SIGNAL ERROR /* and make sure it worked ok */ DO WHILE QUEUED() > 0 /* Search the stack for the returned data */ PULL data_type data /* Break it down */ SELECT /* */ WHEN data_type = "JOBN" THEN jobname = data /* Found the jobname */ WHEN data_type = "DEP" THEN depends = data /* Found the dependency string */ WHEN data_type = "STIM" THEN DO /* Found the start time and date */ stime = WORD(data,1) /* but we still need it */ sdate = WORD(data,2) /* in HHMM and MMDD format */ stime = SUBSTR(stime,1,2)||SUBSTR(stime,4,2) /* */ sdate = SUBSTR(sdate,1,2)||SUBSTR(sdate,4,2) /* */ END /* */ WHEN data_type = "TTIM" THEN DO /* Found the target time and date */ ttime = WORD(data,1) /* but we still need it */ tdate = WORD(data,2) /* in HHMM and MMDD format */ ttime = SUBSTR(ttime,1,2)||SUBSTR(ttime,4,2) /* */ tdate = SUBSTR(tdate,1,2)||SUBSTR(tdate,4,2) /* */ END /* RC tells us if everything worked */ WHEN data_type = "RC" THEN PARSE VAR data rc_code . . . rc_date rc_vers . OTHERWISE NOP /* */ END /* End SELECT */ END /* End DO WHILE */ rc_date = SUBSTR(rc_date,1,2)||SUBSTR(rc_date,4,2) /* Set up the date to MMDD (used later) */ rc_vers = SUBSTR(rc_vers,4,2) /* Set up the version to VV (used later) */ IF rc_code ^= 0 THEN LEAVE /* If the RC wasn't 0 then were done */ IF SYMBOL('sdate') ^='LIT' THEN DO /* Did we have a start date */ IF stime = 'ASP' THEN NOP /* If the time is ASAP then forget it */ ELSE DO sdate = sdate||year /* Convert the date to julian */ sjdate = DATE#G2J(sdate) /* and then skip this job if the */ IF sjdate > jdate THEN ITERATE /* start date is in the future */ IF sjdate = jdate & stime > time THEN ITERATE /* or if start time is later on */ END END /* */ ELSE IF SYMBOL('tdate') ^= 'LIT' THEN DO /* Otherwise, target time is start time */ IF ttime = 'ASP' THEN NOP /* If the time is ASAP then forget it */ ELSE DO tdate = tdate||year /* Convert the date to julian */ tjdate = DATE#G2J(tdate) /* and then skip this job if the */ IF tjdate > jdate THEN ITERATE /* target date is in the future */ IF tjdate = jdate & ttime > time THEN ITERATE /* or if target time is later on */ END END /* */ IF WORDS(depends) > 1 THEN DO /* Make sure no other dependencies */ IF (WORDS(depends) = 2) & WORD(depends,2) ^= "T" THEN ITERATE /* Is it a threshold time? */ END /* */ reply = WTOR("DEPP001I REPLY 'Y' TO REMOVE THE 'M' DEPENDENCY FROM JOB "jobname) IF reply = 'Y' THEN DO /* Check the reply for 'Y' and remove the */ ADDRESS JOBTRAC "POST JOB("jobname") DATE("rc_date") VERS("rc_vers") DEP(-M)" IF rc ^= 0 THEN SIGNAL ERROR /* 'M' dependency if they told us to */ END /* End IF */ END /* End DO FOREVER */ /* */ RETURN /* Normal return */ /* */ ERROR: /* Abnormal termination */ x = WTO("DEPP001E ERROR ENCOUNTERED IN DEPWTOR IMOD") /* */ RETURN 8 /* */ /* Start of DATE#G2J subroutine */ /* This routine converts dates from Gregorian format to Julian format. */ /* Input should be in MMDDYY format */ /* Output is in YYDDD */ /* */ DATE#G2J: arg gregdate mm = SUBSTR(gregdate,1,2) dd = SUBSTR(gregdate,3,2) yy = SUBSTR(gregdate,5,2) DAYCOUNT = '0 31 59 90 120 151 181 212 243 273 304 334' days = WORD(daycount,mm) + dd IF ((yy//4) = 0) & (mm > 2) THEN days = days + 1 days = RIGHT(days,'3','0') juldate = yy||days RETURN juldate