I want to create a (controlling) program which submits another job and cancels the submitted job occasionally. I believe that to cancel the job successfully the controlling program has to know the submitted job's job number. Is there any way to get job number of the submitted job when the controlling program submits the job?
When the job is submitted, it will generate a message CPC1221 stating that "Job 000000/USER/JOBNAME was submitted to..." You can retrieve that message from the program message queue using a RCVMSG and strip out the job number. There are some examples in the CL users guide found at the AS/400 books library.
This was first published in April 2001