Automating Query every 10 minutes
0 pts.
0
Q:
Automating Query every 10 minutes
Hope everyone is doing well,

I'll start off by saying I'm new to this forum and rather wet behind the ears when it comes to AS/400.

I've been using the AS/400 system in general for several years however since about a month ago I have been put in charge of programming a web interface to help streamline the company.

This program requires that I keep a MySQL database up-to-date every 10 minutes. I have so far managed to automate the process of ftping the "finished" query off of the as/400 and onto the mysql server and imported into MySQL.

The part I'm getting stuck at is automating the query itself using wrkjobscde, that function although great only does daily jobs not one for every 10 minutes.

Right off the bat I've decided not to create 48 different schedules to accomplish this update over an eight hour period. Which brought me to the conclusion of looking up how to create loop program.... Well that's about the point that I get lost.

Any help of creating a program to loop a query every 10 minutes would be fantastic, or if there is some other way to accomplish this task please fill me in :)

if you need any additional information please feel free to PM me.

Thank you !

- Jason
ASKED: Sep 26 2005  10:27 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
1940 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Write a CL program to run the query. Use the DLYJOB command to wait for 10 minutes (600 seconds) after the query has run, then loop round (goto) to run the query again.

Submit the job from its own job queue, otherwise you may have problems with other jobs on the queue not being able to run until this one is fininshed (single-threading job queue), or else run it from a job queue which is allowed to run multiple jobs concurrently.

How do you end this job? Well, you could use brute force - when the subsystem is shut down, or if the operator actively ends the job. But you can do it from a menu option. Create a data area with the same name as the program. Create a CL to set the data area (say, to "STOP"). In the batch CL program, before the DLYJOB, test the data area. If it is "STOP", set it to blank and end the program. If it is not "STOP", perform the DLYJOB and loop.

So one menu option can run the program that sets the data area, and another menu option can submit the query job to the queue (the menu option can also check to see if there is already a job with that name active).
Last Answered: Sep 27 2005  4:32 AM GMT by Sloopy   1940 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Ddune3566   0 pts.  |   Sep 27 2005  7:44AM GMT

Create a new jobq. (newjobq)
submit a CL Program Example (Mytran)

Mytran:
Loop: chgvar count = count + 1
dlyjob 10 minutes
Run sql data gathering and queries
FTP data
if count

 
0