Hi!
How can I synchronize two or more RPGLE/CL programs that are executed via SBMJOB command, in order to avoid conflicts in using files and dataareas? If you could send me an example, it'll be greatly appreciated. Thanx in advance,
Meli :)
Software/Hardware used:
ASKED:
February 7, 2006 6:02 PM
UPDATED:
November 27, 2009 4:14 PM
Not sure exactly what you want to synchronize but to avoid object locks, including DTAARAs and files, the best approach is streaming the jobs into a single-job JOBQ, which is done in the SBMJOB command. After some analysis, the jobs can be arranged sequentially in logical order before being submitted.
This way, a job will finish using objects that may be affected by the next on the queue but there will never be a conflict.
The other way is calling the jobs in the desired order within a CL.
Hope this helps.
Good luck!
If you create a jobq that only allows one job to run at a time, then submit your jobs to that queue. The system will run the jobs in the sequence submitted, but only one at a time.
To break your job into 4 pieces and then submit them individualy, is self defeating………now you have all the additional overhead of the job process x 4. One job will process faster than 4, unless of course you have a multi-processor box.
Last time I needed to do something similar, I used a combination of the single-threaded job queue method and the data area control flag method. This allowed me to make sure the prior job had completed normally before the next job could run (I had a section at the top of the CL to re-submit the job fifteen minutes later if the data area showed the prior job hadn’t completed).