Never Ending Program

200 pts.
Tags:
CLP
RPG
RPGLE
I have a program which updates several A/R balance files. This program needs to run continuously every so many seconds to update our customers' balances. How can I make this program a never ending program?

Answer Wiki

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

easy solution :
1) create a data area to hold a process/don’t process flag (in case you ever need to end the program, you can be sure it ends gracefully)
2) create a CL to wrap around the program that simply loops through 1) check data area for the continue flag 2) execute the program 3) delay x seconds
3) submit the CL to batch

We have several jobs that do this, we control the process flag as 1) the program checks that the flag is ‘N’ before beginning, if the flag is ‘N’, the program sets the flag to ‘Y’, then at each loop, it checks to be sure the flag is ‘Y’ if it’s ‘N’ it drops out of the loop, and the job ends, we then have two menu options we use, the first will submit the job, the second will set the flag to ‘N’ (after the current delay, the program will exit gracefully)

The whold process is much simpler then I’m probably making it sound. good luck.

Discuss This Question: 2  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
  • JDWWms
    Having a program that wraps has the previous user suggested works pretty well but you still have an issue of what if something happens to the job and it fails. Someone would have to remember to restart it. We added one more step to the process. Have the job running in a single threaded JOBQ. The first thing th ejob does is clears the JOBQ and then submits itself. Then processing happens just like in the previous example. but this way the job is always waiting in the queue to restart. Tpo prevent it from running you would need to hold the JOBQ.
    0 pointsBadges:
    report
  • TomLiotta
    Note that submitting to a *JOBQ isn't much of a guarantee. The *JOBQ might be held. The job might be held on the queue. The job might be deleted from the queue. Numerous other jobs might be given higher priorities so that the queued job simply never gets run. Instead, have the first step of your program be to send a scope message scoped to *JOB. Have the scope message call your program again. As one of the last things your program does before a normal end, have it receive/remove the swcope message. The program would loop, performing it's work each time through. At the top of the loop, have it check a data queue for an entry. The wait time on the data queue would be however long to wanted it to wait between cycles. All neat and self contained. The data queue entry might simply be '*ENDJOB'. At some future date, you might choose to send any number of different commands to have the program perform different tasks. Tom
    125,585 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