MRP Regeneration

SharonMK

Member
We want to schedule P3482 (Regen MRP) to run continously during the day. The only way I can think of is through the IBM job scheduler, but once it runs, you need to run the change job scheduler to re-submit P3482 again. Any suggestions?
Thanks in advance!
 
Sharon, it sounds like this would be an easy solution: create a CLP that calls the program, then does a DLYJOB for a certain period of time, and a GOTO back to the call to the program again. And you can also retrieve the system time, and decide to end this NEP (never-ending program) at an appropriate time of day, if applicable. If P3482 normally runs from J3482 with the typical PSPID and PSVERS DreamWriter parms, I would recommend this CLP have the 2 parms passed to it so you don't have to hard-code those in the code, and then this job could be the one submitted in the IBM job scheduler or JDE's SLEEPER, if you use that utility.
 
Assuming the attachment comes across OK, here's a quick and dirty ILE RPG program that would serve as a wrapper to run almost any DWV repeatedly. It's not quite commercial quality but could certainly serve as the basis for a more robust version.

You can give it any name you like, and compile it with CRTBNDRPG. Submit it initially, possibly from the IBM job scheduler, with a command like the following, where p56nnnn is the name you've given the program, vnnnnn is the version of P3482 you want to run, and 600 is the number of seconds you want between runs.

sbmjob j3482 cmd(call p56nnnn (j3482 p3482 vnnnnn '600'))

The program will run under the job name J3482 calling P3482 in line. On return from P3482 it will calculate the starting date and time for the next job, then submit another copy of itself scheduled to start at the calculated values. This cycle will repeat indefinitely.

It should be able to form a basis for what you want to do but may need some enhancements. For example, you might want the jobs to use a specific job queue, job description and initial library list. You might also want to consider whether you want to incorporate a mechanism to stop it automatically rather than having to hold or cancel it from the job queue. You might want additionally to consider error handling.

The approach Sally outlined using an endless loop in a CL program with DLYJOB would also work, and is a bit simpler. If you use that approach there are also some things to consider. In this case it would always run as a single job so you wouldn't want to submit it to your reqular job queue if that queue is single threaded or limited in the number of concurrent jobs or it would block other jobs. It might also develop a very large job log unless it were submitted with a zero message logging level. Huge job logs can sometimes make long running programs difficult to cancel. You could get round these problems too by having the CL submit another copy of itself after the DLYJOB rather than looping.
 

Attachments

  • 96865-runrepeat.txt
    4.1 KB · Views: 147
The attachment doesn't seem to have made it onto the forum. If anyone wants a copy of the RPG IV source please e-mail me directly at [email protected] but first remove TheSpamTrap from that address.
 
Back
Top