0 pts.
 WRKJOBSCDE every *other* week
Does anyone know how to use the IBM scheduler to submit something every *other* week or every third week, etc? Thanks, Kevin

Software/Hardware used:
ASKED: August 3, 2006  1:19 PM
UPDATED: December 14, 2009  5:06 AM

Answer Wiki:
Use RELDAYMON - help text: The job is submitted on the specified day of the week the first time it occurs in the month. For example, if you specify SCDDAY(*TUE), FRQ(*MONTHLY) and RELDAYMON(1), the job is submitted on the first Tuesday of every month. ================================================== The basic job scheduler object doesn't directly support 'every other' or 'every 3rd' week or similar intervals. Basic schedules work around daily, weekly and monthly intervals. A simple wrapper program as noted in discussion can be used to adjust to non-standard schedules. For a non-programmed solution, the Advanced Job Scheduler product can be installed and licensed. An 'every other week' schedule could be set up as an 'every 14 days' scheduled job. Tom
Last Wiki Answer Submitted:  December 14, 2009  5:06 am  by  Abigail   645 pts.
All Answer Wiki Contributors:  Abigail   645 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

In the past when I’ve had to do similar, I’ve scheduled the job to run weekly and then used a data area to keep track of which week of the run cycle I’m in.

The following code snippet should give you an idea of how you would have a job check itself for running every three weeks, i.e. weeks 1, 4, 7, 10, etc…

PGM

DCL VAR(&WEEKNO) TYPE(*DEC) LEN(1 0)
DCL VAR(&DTAARA) TYPE(*CHAR) LEN(10) VALUE(‘MYWEEKNO’)
DCL VAR(&DTAARALIB) TYPE(*CHAR) LEN(10) VALUE(‘QGPL’)
DCL VAR(&NOWEEKS) TYPE(*DEC) LEN(1 0) VALUE(3)

/* Retrieve the current “week number” from the data area. If the */
/* data area doesn’t exist then create it… */

RTVDTAARA DTAARA(&DTAARALIB/&DTAARA) RTNVAR(&WEEKNO)
MONMSG CPF1015 EXEC(DO)
CRTDTAARA DTAARA(&DTAARALIB/&DTAARA) TYPE(*DEC) LEN(1 +
0) VALUE(0)
CHGVAR VAR(&WEEKNO) VALUE(0)
ENDDO

/* Increase the “week number” by 1 and then compare it to the run */
/* frequency. If the Week Number is greater than the frequency then */
/* reset it to “1″ and update the data area… */

CHGVAR VAR(&WEEKNO) VALUE(&WEEKNO + 1)
IF COND(&WEEKNO *GT &NOWEEKS) THEN(CHGVAR +
VAR(&WEEKNO) VALUE(1))

CHGDTAARA DTAARA(&DTAARALIB/&DTAARA) VALUE(&WEEKNO)

/* If this is not the 1st week of the run cycle then exit the CL… */

IF COND(&WEEKNO *NE 1) THEN(RETURN)

/* …otherwise continue with the job… */

ENDPGM

The data area name and library and the run frequency are coded in variables to allow for easier maintenance and portability. With a little modification the program can be adapted to accept these variables as parameters and return a flag identifying whether the calling CL should continue or not.

All the best

Jonathan

 370 pts.

 

Another possibilty is to write a program which will resubmit the job each time it runs. The advantage to this is that you can submit the job to whatever time interval you want

 20 pts.