Submitting AS/400 job on hourly basis

635 pts.
Tags:
AS/400 jobs
Work with Job Schedule Entries
WRKJOBSCDE
Hi, i want to add a job that will run a particular command on houly basis. I would prefer WRKJOBSCDE ( i know) but here schedule time parameter has no "for more values". Can any one tell me what shall i do to add a job to run in hourly basis. Thanks, Siddharth

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

Submit following CL program :-

PGM

LOOP:

/* insert start of your job here */

DLYJOB DLY(3600)
GOTO LOOP

ENDPGM

Regards,

Martin Gilbert.

Discuss This Question: 10  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BigKat
    I would just copy the job schedule entry 23 times and change the times.
    8,200 pointsBadges:
    report
  • WoodEngineer
    We use the technique recommended by Martin GIlbert - works great. If you need the job to run at a specific time, such as 15 minutes after the hour, use this format: DLYJOB RSMTIME('HHMMSS') to tell your program exactly when to re-start. You will have to add a little code to your program to reconstruct the HHMMSS value before issuing DLYJOB. The system automatically knows the correct date by inspecting the time. If resume time is less than current time, the job resumes at that time on the following day.
    6,680 pointsBadges:
    report
  • Junky
    Seems like you could write a cl program that would do your hourly function and then, based on the time, add a one time job schedule entry (addjobscde) for the next hour to run the cl again. Seems to work from this little test that I put together: PGM DCL Var(&HR) Type(*DEC) Len(2 0) /**Numeric Hour**/ DCL Var(&HRA) Type(*CHAR) Len(2) /**Alpha Hour**/ DCL Var(&NEWTIME) Type(*CHAR) Len(8) /**New submit time **/ RTVSYSVAL SYSVAL(QHOUR) RTNVAR(&HRA) CALL HOURJOB CHGVAR VAR(&HR) VALUE(&HRA) CHGVAR VAR(&HR) VALUE(&HR + 1) CHGVAR VAR(&HRA) VALUE(&HR) CHGVAR VAR(&NEWTIME) VALUE(&HRA || '0000') ADDJOBSCDE JOB(TEST) CMD(CALL PGM(libray/thisprogram)) + FRQ(*ONCE) SCDTIME(&NEWTIME) ENDPGM Of course, you will need to add logic for when you get into a new day, etc.
    95 pointsBadges:
    report
  • Sangay
    Hi I have done the coding part, but not so sure about the job scheduling entries. Code is like this: PGM LOOP: DSPSYSSTS OUTPUT(*PRINT) /* DISPLAYING SYSTEM STATUS */ DLYJOB DLY(3600) /* DELAYING JOB */ GOTO CMDLBL(LOOP) ENDPGM But after adding this program in ADDJOBSCDE the next submission date appears to be the next day, i am not getting this thing. Any one can shed some light?? Thanks in advance
    635 pointsBadges:
    report
  • graybeard52
    Sangay, This doesn't reschedule the job. What it does is keep the first job running. It does the DSPSYSSTS then waits one hour, then runs DSPSYSSTS again. No job schedule entries are required. Normally these jobs run in batch without a display. I prefer this: PGM LOOP: SBMJOB (your hourly job specs) DLYJOB DLY(3600) /* DELAYING JOB */ GOTO CMDLBL(LOOP) ENDPGM That way the hourly job runs on its own job, and this avoids file locking issues, etc (of course, this depends on what the job does).
    3,115 pointsBadges:
    report
  • WoodEngineer
    If you always want the job running, you can add an autostart entry to a batch subsystem. That way, every time your system IPLs the job will automatically start and keep running every hour. This technique does not require a job schedule entry. We have a group of jobs that function exactly like this. We cloned the QBATCH subsystem as "AUTOSTART" and added our autostart entries there. This keeps QBATCH clean for your users.
    6,680 pointsBadges:
    report
  • Junky
    If using the QDELAY approach, you need to run it in a job que that allows multiple jobs to run at a time since this job will always be active and will never release it's spot in the subsystem. (Unless this is the only job that is going to run in this que.) If the job que has maximum active set to 1 and you submit other jobs to it after starting this one, they will not run. They will be stuck in the que until this job is ended. We set up a subsystem called QDELAY with a job que with the same name that we use for these delay jobs so that they don't interfere with other jobs on the system. We set the maximum active for the job que to 8 since we currently only have 7 delay jobs active. As WoodEngineer stated, you will need to set this up as an autostart job on the subsystem or add a submit for it in QSTRUP.
    95 pointsBadges:
    report
  • BigKat
    I still prefer using multiple job schedule entries. Keeping the job in delay means it is still holding all of its resource overhead. This can be a lot of needless storage depending on the job.
    8,200 pointsBadges:
    report
  • Gilly400
    Hi BigKat, If you're going to use multiple schedule entries, I'd suggest putting the ADDJOBSCDE commands in a CL source file, with RMVJOBSCDE commands, so you can easily maintain the jobs later. Just an idea. Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • Stargirl
    Junky has the right idea, but create the entry only once (ADDJOBSCDE) so it is permanent,  making sure the Frequency and Schedule days are as required.  In your program replace the ADDJOBSCDE TO...  CHGJOBSCDE JOB(jobname) SCDTIME(&NEWTIME).  Add code to reset the time if it is past '240000'.  Works GREAT!
    75 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following