Scheduling a job for the last day of the month

Log in to save

The system scheduler has a special value for this: there is no date to calculate.

ADDJOBSCDE JOB(CLOSE)                       +
           CMD(CALL PGM(PRODLIB/CLOSE))     +
           FRQ(*MONTHLY)                    +
           SCDDATE(*MONTHEND)               +
           SCDTIME(230000)                  +
           JOBQ(QBATCH)

For the last working day, keep the schedule daily and put the check in the program: "working" depends on the company calendar.

Tip

*MONTHEND handles February and thirty-day months on its own. Before it existed people wrote scripts that calculated the date, and those scripts failed on every leap year.

Warning

SCDDATE and SCDTIME use system time. If daylight saving is not handled the way you expect, a job scheduled at 23:00 can run an hour early or late twice a year: check QUTCOFFSET and QTIMZON.


Releases. SCDDATE(*MONTHEND) predates every release currently in support: if the system is on a supported release, it is there.

← Back to blog

Comments

No comments yet. Be the first to comment!

You need an account to comment. Log in · Sign up