I would wait for those batch jobs to finish, cause you can’t restart them where they left off. Maybe it might be a good idea to run your purge job off hours when there won’t be as many batch jobs running and it will be easier to allocate your files.
First alocate the object but the command ALCOBJ, for example:
ALCOBJ OBJ((OBJNAME *FILE *SHRUPD)) wait(5)
You can make you wait time longer if you like. Call your program to purge older records then deallocate your file.
DLCOBJ OBJ((OBJNAME *FILE *SHRUPD))
Thanks for your reply Ron!
But my requirement is somewhat crazy, we need to end the job if any and rerun it from the begining.
Eventhough it is not a good practice,,, we have to do in that way.
For this purpose, I need to get the submit job attributes as well as the command which is executed in SBMJOB.
I have the Job Number, Job name and user Details. is there anyway to find out the JOBQ in which this job was sumitted?
I’m in the Ron camp – this could be a disaster.
Consider that records can be removed from a file while it’s locked for update using RPG or SQL.
RTVJOBA can get most attributes of a job
DSPJOBD *OUTFILE can get the rest — the spoolfile needs to be copied to a flat file and then read to find the desired attributes.