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).