Purging a file and restart the Job

365 pts.
AS/400 administration
Display Job Log
Hi, I have to purge a file for older records. Before starting the purge activity, I need to check what are the jobs locked the file and need to END the jobs then purge activity will be started. After compilation of Purge Job, we need to restart the batch jobs which is ended by us in the previous steps. I want to know that the command which is executed in batch jobs and its parameters. From these details, I can restart the Job. I tried with DSPJOBLOG to get the command which is executed but in some cases (eg, huge Job log is there) not able to find the command details in the joblog. I am expecting your input on this. If we have any other efficient way other than this, please let me know.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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:


You can make you wait time longer if you like. Call your program to purge older records then deallocate your file.



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.


Discuss This Question:  

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: