|
Lance wrote: > Is there a way to have an interactive program submit > something to batch and then wait for the batch job > to finish before continuing? Yes, and you can do it without having the batch job take any special action such as sending messages, adding entries to a data queue, setting flags in a data area and so on. When a submitted job ends either normally or abnormally it automatically sends a completion message. By default the message goes to the queue specified in the user profile of the job submitter, but you can direct it to any message queue. Your interactive job can then sit on a message queue wait until it receives the job completion message. To simplify matters you might want to reserve a particular message queue just for this function. The following simple CL program should allow you to test the process and might serve as a basis for something a little more solid. You pass the message queue and the command to submit as parameters. When you run it from a command line make sure you give the command parameter its full length eg: call XXXX (testq 'dlyjob 10 ') pgm (&msgq &cmd) dcl &cmd *char 50 dcl &msg *char 78 dcl &msgid *char 7 dcl &msgq *char 10 sbmjob abc rqsdta(&cmd) msgq(&msgq) monmsg cpf0000 exec(do) rcvmsg MSG(&msg) sndpgmmsg &msg return enddo rcvmsg MSGQ(&msgq) WAIT(*max) MSGID(&msgid) if (&msgid *eq cpf1240) do sndpgmmsg 'Job ended abnormally' enddo else do sndpgmmsg 'Job ended normally' enddo endpgm Dave... "Achilles only had an Achilles' heel; I have a whole Achilles' body." - Woody Allen ======================================================= The opinions expressed in this communication are my own and do not necessarily reflect those of my employer.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.