How to delete specific spool files

5 pts.
Tags:
AS/400
CL Program
Spool files
I am not that familiar with command line code as access has been restricted and converted to screen options so forgive me. The task is every month I need to delete specific spool files > 9 months old with specific form type. Originally my thoughts were to:
  1. Create formatted file to copy the five spool files into
  2. Use query function to select the files that meet the date and form criteria for deletion.
  3. Code the CL to perform delete function.
  4. In a test environment with command line access I first tried WRKOUTQ OUTQ(LIBRARY_NAME/OUTPUT_QUEUE_NAME) OUTPUT(*PRINT) b. CPYSPLF FILE(QPRTSPLQ) TOFILE(LIBRARY_NAME/file previously created) SPLNBR(*LAST)
  5. All went well until I need to copy the second spool file using (a) then append to (b), it just wasn’t working.
So my question would be: If I have a list of spool files such as: ST31255 FR12365 DS22323 Etc. How can I copy all of the spool files and then copy them into the file I created and formatted (Library/SpoolDele)? I appreciate any help and apologize for be such a novice, but I am just trying to make make workload a little easier.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 4  Replies

 
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.
  • danieljones
    2,840 pointsBadges:
    report
  • ToddN2000
    When copying the spool file are you doing an *ADD or *REPLACE?
    134,970 pointsBadges:
    report
  • CharlieBrowne

    You can also look into putting and expire date or days on your printer files, Then you can run the command DLTEXPSPLF to delete spool files that you have set to expire regardless of what output queue they are in.

    HELP SYSTEMS also has a command "AGEOUTQ". I do not know if you can get it as a standalone or if it is part of ROBOT. With this you can basically set different retention periods for different outqs

    62,385 pointsBadges:
    report
  • pdraebel
    On the CPYSPLF there is a parameter that allows adding files to the result file. The default is *REPLACE, so you have to specify *ADD. In case you need to handle a lot of spoolfiles take a closer look at API's to list the spoolfiles. In our shop we kept spoolfiles on output queues for a maximum of 8 days. With the API use handling over 300000 spoolfiles takes under 10 minutes. Useing CL commands this time would be 10-fold.
    7,545 pointsBadges:
    report

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.

Following

Share this item with your network: