CL Command Reference - ADDJOBSCDE

CL Command List > ADDJOBSCDE Reference

Description:

The Add Job Schedule Entry (ADDJOBSCDE) command allows you to schedule batch jobs by adding an entry to the job schedule. You can use this command to schedule a batch job to be submitted once, or to schedule a batch job to be submitted at regular intervals.

The job schedule entry contains all of the information needed to submit the job, including the command the job runs, the job description and user profile under which the job is run, the job queue to which the job is submitted, and the message queue to which messages are sent.

At the date and time you specify on this command, the job is submitted to the specified job queue. This command does not guarantee that the job will begin running at the scheduled time, however. The job will not begin running if the job queue is held or not attached to an active subsystem, or if the maximum number of active jobs allowed to run in the subsystem or on the system at one time has been reached.

Each job schedule entry is identified by the job name specified for the JOB parameter of this command and an entry number assigned by the system when the entry is added. The message replacement text sent when an entry is added contains the entry number. If there is more than one entry with the same job name, you may need to specify the number when changing the entry using the Change Job Schedule Entry (CHGJOBSCDE) command, removing the entry using the Remove Job Schedule Entry (RMVJOBSCDE) command, or when holding or releasing the entry using the Hold Job Schedule Entry (HLDJOBSCDE) or Release Job Schedule Entry (RLSJOBSCDE) command. You can use the Work with Job Schedule Entries (WRKJOBSCDE) command to show or print entries.

Restrictions:

1. To use this command, you must have:
. use (*USE) authority to the command specified by the Command to run (CMD) parameter and execute (*EXECUTE) authority to the library containing that command.
. use (*USE) authority to the job description (JOBD) and execute (*EXECUTE) authority to the library containing that job description.
. use (*USE) authority to the job queue (JOBQ) and execute (*EXECUTE) authority to the library containing that job queue.
. use (*USE) authority to the user profile (USER) that the job is to run under.
. use (*USE) and add (*ADD) authority to the message queue (MSGQ), and execute (*EXECUTE) authority to the library containing that message queue.
. change (*CHANGE) authority to object QDFTJOBSCD, type *JOBSCD, in library QUSRSYS and execute (*EXECUTE) authority to library QUSRSYS.



Examples:

Example 1: Scheduling a Weekly Job

ADDJOBSCDE JOB(CLEANUP) SCDDATE(*NONE)
CMD(CALL PGM(CLNUPLIB/CLNUPPGM))
SCDDAY(*FRI) SCDTIME(กฏ23:00:00กฏ)
FRQ(*WEEKLY) RCYACN(*NOSBM)
JOBD(CLNUPLIB/CLNUPJOBD)

This command submits a job named CLEANUP every Friday at 11 p.m. The job uses job description CLNUPJOBD in library CLNUPLIB. If the system is powered down or is in the restricted state at 11 p.m. on Friday, the job is not submitted at IPL or when the system comes out of restricted state.


Example 2: Scheduling a Monthly Job

ADDJOBSCDE JOB(PAYROLLJOB) CMD(CALL PAYROLL)
SCDDATE(*NONE) SCDDAY(*MON)
SCDTIME(กฏ09:00:00กฏ) FRQ(*MONTHLY)
RELDAYMON(1)

This command submits a job to run program PAYROLL at 9 a.m. on the first Monday of every month.


Example 3: Omitting Dates

ADDJOBSCDE JOB(MONTHEND) CMD(CALL INVENTORY)
SCDDATE(*MONTHEND) SCDTIME(กฏ23:30:00กฏ)
FRQ(*MONTHLY) OMITDATE(กฏ12/31/2003กฏ)

This command submits a job to run program INVENTORY at 11:30 p.m. on the last day of every month except December 31, 2003.


Example 4: Scheduling a Daily Job

ADDJOBSCDE JOB(*JOBD) CMD(CALL DAILYCLEAN)
SCDDATE(*NONE) SCDDAY(*ALL) SCDTIME(กฏ18:00:00กฏ)
FRQ(*WEEKLY) RCYACN(*NOSBM) USER(SOMEPGMER)

This command submits a job to run program DAILYCLEAN every day at 6 p.m. The job runs under user profile SOMEPGMER. If the system is powered down or is in the restricted state at 6 p.m., the job is not submitted at IPL or when the system comes out of restricted state.


Example 5: Scheduling a Weekly Job

ADDJOBSCDE JOB(*JOBD) CMD(CALL PGM1) SCDDATE(กฏ06/01/2003กฏ)
FRQ(*WEEKLY) USER(PGMR1)

This command submits a job to run program PGM1 every week starting on June 1, 2003 at the current time. Because June 1 is a Saturday, the job is submitted every Saturday.


Example 6: Scheduling a Job to Run Twice a Month

ADDJOBSCDE JOB(*JOBD) CMD(CALL PGM2)
SCDDATE(*NONE) SCDDAY(*MON *WED)
FRQ(*MONTHLY) RELDAYMON(3)
SCDTIME(กฏ23:30:00กฏ)

This command submits a job to run program PGM2 every third Monday and every third Wednesday at 11:30 p.m. The job is submitted this month if the third Monday and Wednesday have not passed when this entry is added. If, for example, yesterday was the third Monday, today is the third Tuesday, and tomorrow is the third Wednesday, the job is submitted tomorrow, and then not again until next month.


Example 7: Scheduling a Job to Run Twice a Month

ADDJOBSCDE JOB(*JOBD) CMD(CALL PGM3)
SCDDATE(*NONE) SCDDAY(*MON)
FRQ(*MONTHLY) RELDAYMON(1 3)
SCDTIME(กฏ09:00:00กฏ)
USER(PGMR3)

This command submits a job to run program PGM3 on the 1st and 3rd Monday of every month at 9:00 a.m. The job runs under user profile PGMR3.


Example 8: Scheduling a Job to Run Every Weekday

ADDJOBSCDE JOB(*JOBD) CMD(CALL PGM4)
SCDDATE(*NONE) SCDDAY(*MON *TUE *WED *THU *FRI)
SCDTIME(กฏ19:00:00กฏ) FRQ(*WEEKLY)

This command submits a job to run program PGM4 every weekday at 7 p.m.