Link to home
Start Free TrialLog in
Avatar of InfraMen
InfraMen

asked on

How to automatically create physical file from spoolfile when there are duplicates

Hello,

I want to create a physical file from a spoolfile on a daily basis. It works fine with the command cpysplf if I enter all job information (job number/job user/job name).

But I want to automate this command and because the job number changes all the time, I need to find a way how to copy the last created spoolfile into a physical file.
I saw the possibility to use the param CRTDATE(*LAST) but this doesn't work, I still get the message from AS400 "Duplicate job names found.".

I think I have two possibilities, but don't know how to do them:
a) I modify the command CPYSPLF that it takes only the last created spoolfile
b) I create a CL script which somehow reads the jobnumber of the last created spoolfile and uses this jobnumber as a variable which will then be used in the CPYSPLF command

Thanks in advance for ideas and help.
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of InfraMen
InfraMen

ASKER

Seemed really the best and simpliest solution and it works. great!