Ten years ago I wrote a master scheduler job to automate our routine
job submissions. With minor additions it has run without evident
flaws. However, this past July month end the scheduler streamed the
month-end jobs 24 hours early. A problem that has just been brought
to my attention by our very irritated chief accountant.
I have reviewed the code and I cannot see where the problem lies.
Neither can I envisage any external cause for the 24 hour variance
from the expected behaviour. The master scheduler reported streaming
the job at the wrong time so the time values used by the process
reflect the actual system time shown by the STDLISTs.
The actual scheduling log entries in the master job control STDLIST
look like this:
. . .
!
!COMMENT
!COMMENT ### JOB submission ###
!COMMENT JOB Name: MEAC1307,JOBBER.HARTLYNE
!COMMENT Streamed at: 20130731000000300
!COMMENT Template file used: MEACTEMP.JOB.HARTLYNE
!COMMENT Template starts at: Line 21
!
#J1277
!
!COMMENT
!COMMENT ### JOB submission ###
!COMMENT JOB Name: MEND1307,JOBBER.HARTLYNE
!COMMENT Streamed at: 20130731000003100
!COMMENT Template file used: MENDTEMP.JOB.HARTLYNE
(2232/2774) Continue?
!COMMENT Template starts at: Line 21
!
#J1278
. . .
The STDLIST spool files from these jobs have these characteristics:
SPOOLID JOBNUM FILEDES PRI COPIES DEV STATE RSPFN OWNER
FORMID JOBNAME COPSRM SECTS RECS PAGES DATE
TIME
#O172804 J1278 $STDLIST 1 1 LP READY
JOBBER.HARTLYNE
MEND1307 1 112 766 ~13 07/31/13
01:12
#O172803 J1277 $STDLIST 1 1 LP READY
JOBBER.HARTLYNE
MEAC1307 1 112 763 ~13 07/31/13
01:20
We use a single thread queue for these jobs so the date and time
correspond closely enough to that reported in the STDLIST that a
problem with the system clock does not seem to be an issue. If so then
the problem lies in the actual scheduling code of the master job.
That code runs inside a while loop that never ends:
. . .
!COMMENT Initialize the Loop time marker
!SETVAR HL_LOOP 0000
!
!COMMENT Begin infinite loop for main segment of control job
!
!WHILE (BOUND(HL_LOOP)) DO
!
!COMMENT Set nominal time for this loop
!SETVAR HL_HHMM HPHOUR * 100 + HPMINUTE
!
!COMMENT Set these variables based on the current date on the
!COMMENT first pass through the loop and at midnight thereafter
!IF HL_LOOP = 0000 THEN
! SETVAR HL_WOM ((HPDATE / 7) + 1)
! SETVAR HL_WOY ((HPDOY / 7) + 1)
! SETVAR HL_YYMM STR('!HPYYYYMMDD',3,4)
!ENDIF
. . .
!COMMENT Stream the monthend jobs at 22:30 on monthend
!
!IF HPDATE > 27 &
! AND HL_HHMM = 2230 THEN
!
! IF (NOT(BOUND(HLJOB_MENDA_FLAG))) OR &
! HLJOB_MENDA_FLAG <> "!HPYYYYMMDD!HL_HHMM" THEN
!
! SETVAR HL_LAST_DOM FALSE
! XEQ *LASTDOM
! IF HL_LAST_DOM = TRUE THEN
!
! SETVAR HLJOB_MENDA_NAME "MEAC" + "!HL_YYMM"
! XEQ *JOBSTRM "![HLJOB_MENDA_USER]", &
! "![HLJOB_MENDA_NAME]", &
! "![HLJOB_MENDA_FILE]", &
! ![HLJOB_MENDA_BEGN], &
! "![HLJOB_CARD]"
!
! SETVAR HLJOB_MENDN_NAME "MEND" + "!HL_YYMM"
! XEQ *JOBSTRM "![HLJOB_MENDN_USER]", &
! "![HLJOB_MENDN_NAME]", &
! "![HLJOB_MENDN_FILE]", &
! ![HLJOB_MENDN_BEGN], &
! "![HLJOB_CARD]"
!
! SETVAR HLJOB_MENDA_FLAG "!HPYYYYMMDD!HL_HHMM"
! ENDIF
! ENDIF
!ENDIF
!
!
!COMMENT End of master controller WHILE loop. Set time of loop
!COMMENT to time of this pass
!IF HL_LOOP <> HL_HHMM THEN
!SETVAR HL_LOOP
!HL_HHMM
!ENDIF
!
!COMMENT Wait 20 seconds, 1 minute pause is too coarse a time interval
! PAUSE 20
!ENDWHILE
The last day of month calculator looks like this:
:PRINT *LASTDOM
setvar HL_LAST_DOM FALSE
# Determine if "today" is the last day of the month.
if not hpleapyear then
setvar _eom_ "31,28,31,30,31,30,31,31,30,31,30,31"
else
setvar _eom_ "31,29,31,30,31,30,31,31,30,31,30,31"
endif
if "!hpdate" = word("![_eom_]",,hpmonth) then
setvar HL_LAST_DOM TRUE
setvar HL_MONTHEND_CALL str("!HPDATETIME",1,8)
deletevar _eom_
else
if bound(HL_MONTHEND_CALL) then
deletevar HL_MONTHEND_CALL
endif
endif
The difficulty can exist in one of only two places: the LASTDOM
routine or the actual IF THEN conditional for the entire monthend job
submission routine. Does anyone see why this code would execute
before 22:30 on July 31 instead of after?
--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:[log in to unmask]
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|