ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Stopping a CLROUTQ at a certain number

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by john.sev99 View Post
    If it were me, I'd be asking what the intent is of keeping 10000 spooled files. It seems very arbitrary. It is more common to keep x days so you at least know if a report is going to be on the system or not. I am still unclear as to what information is required from the screenshot. Is it just the number of reports in the output queue before and after the delete or do you take hundreds of screenshots of each report in there? I ask as it is likely this information is obtainable in an automated way.

    The QUSLSPL option is one way of doing what you want but I suspect coding an API may be a bit daunting. It occurred to me that you could probably use SQL to do this which may be easier. The following SQL will list all reports in QEZJOBLOG. You could modify this to create a file instead of showing it on screen. From the file, you can then find out how many records are in the file, subtract 10000 and loop around that many times and use the DLTSPLF command to delete the reports.

    Code:
    SELECT *
    FROM QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC
    WHERE output_queue_name = 'QEZJOBLOG'
    ORDER BY create_timestamp;
    The purpose of the screenshot is purely to see the before and after of the output queue number.
    So if i use this SQL code i can delete a record and leave it at a maximum of 10000 ?

    Comment


    • #17
      No, you can't use SQL to delete the spooled files. The table mentioned is just a view of the the output queues. As I said in my post, you will need to use SQL to create a table (file) in e.g. QTEMP then read that to do the clear. You can use the RTVMBRD command to find the number of records in the file, subtract 10000 then loop around that many times deleting the files.

      Comment


      • #18
        Originally posted by Lemon Grande View Post

        Yes, to leave it with only a miximum of 10000 and not doing a CLROUTQ if its already already below 10000
        If there are 10,100 splfs what determines which 100 are deleted?

        Comment


        • #19
          Originally posted by john.sev99 View Post
          No, you can't use SQL to delete the spooled files. The table mentioned is just a view of the the output queues. As I said in my post, you will need to use SQL to create a table (file) in e.g. QTEMP then read that to do the clear. You can use the RTVMBRD command to find the number of records in the file, subtract 10000 then loop around that many times deleting the files.
          Will try it later, thank you for the inputs

          Comment


          • #20
            Originally posted by UserName10 View Post

            If there are 10,100 splfs what determines which 100 are deleted?
            Nothing, i manually run the SBMJOB CLROUTQ and manually checked the WRKOUTQ of the submitted job to see the numbers going down from being cleared, if i see the number is getting close to 10000 then i end the SBMJOB. It doesn't need to be exactly 10000 just close to 10000 is enough i too don't know the reason why (the customer said to do just that).

            Comment

            Working...
            X