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.