The Delay Job (DLYJOB) command works well when I want a job to run overnight while I'm not in the office, but presents a problem when I want to submit jobs on Friday to run on Saturday or Sunday. DLYJOB will handle this if I specify an interval to wait instead of a time to resume, but who wants to figure out how many seconds until 3 o'clock, Sunday morning? For this reason, I developed the DLYDATTIM command and program (Figures 8 and 9, on page 72) which, like DLYJOB, accept a resume time parameter, but unlike DLYJOB also accept a resume date parameter. Now we can submit all weekend overnight processing on Friday afternoon, and everything executes when it should.
TechTalk: Improving on DLYJOB
Figure 8 Command DLYDATTIM
DLYDATTIM: CMD PROMPT('Delay Until Date/Time') PARM KWD(DATE) TYPE(*DATE) MIN(1) PROMPT('Date') PARM KWD(TIME) TYPE(*TIME) MIN(1) PROMPT('Time')
TechTalk: Improving on DLYJOB
Figure 9 CL program DAT002CL
DAT002CL: + PGM PARM(&DATEIN &TIME) DCL VAR(&DATE) TYPE(*CHAR) LEN(6) DCL VAR(&DATEIN) TYPE(*CHAR) LEN(7) DCL VAR(&QDATE) TYPE(*CHAR) LEN(6) DCL VAR(&QDATEIN) TYPE(*CHAR) LEN(6) DCL VAR(&QTIME) TYPE(*CHAR) LEN(6) DCL VAR(&TIME) TYPE(*CHAR) LEN(6) CHGVAR VAR(&DATE) VALUE(%SST(&DATEIN 2 6)) RETRY: + RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATEIN) CVTDAT DATE(&QDATEIN) TOVAR(&QDATE) TOFMT(*YMD) TOSEP(*NONE) /* If requested date has already passed, quit */ IF COND(&QDATE *GT &DATE) THEN(RETURN) /* If requested date is same as system date. If not yet + requested time, wait */ IF COND(&QDATE *EQ &DATE) THEN(DO) RTVSYSVAL SYSVAL(QTIME) RTNVAR(&QTIME) IF COND(&QTIME *LT &TIME) THEN(DLYJOB RSMTIME(&TIME)) RETURN ENDDO /* If requested date has not yet arrived, wait until next day */ IF COND(&QDATE *LT &DATE) THEN(DLYJOB RSMTIME(000000)) GOTO CMDLBL(RETRY) ENDPGM
LATEST COMMENTS
MC Press Online