sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Stopping a CLROUTQ at a certain number

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

  • Stopping a CLROUTQ at a certain number

    I have a job that needs to be done weekly which is clearing an OUTQ until it stops at a certain number, usually i did it with an SBMJOB format like this :

    Code:
    SBMJOB CMD(CLROUTQ OUTQ(QGPL/QPRINTPRD)) JOB(CLR_OUTQ)
    SBMJOB CMD(CLROUTQ OUTQ(USRBASELIB/QPRINTRTGS)) JOB(CLR_RTGS)
    SBMJOB CMD(CLROUTQ OUTQ(*LIBL/PRT01)) JOB(CLR_PRT01)
    SBMJOB CMD(CLROUTQ OUTQ(QUSRSYS/QEZJOBLOG)) JOB(CLR_QEZJOB)
    SBMJOB CMD(CLROUTQ OUTQ(QUSRSYS/QEZDEBUG)) JOB(CLR_QEZDEBUG)


    And i didn't run them all together and just leave it there until there's nothing when i checked the WRKOUTQ
    I usually need to have 2 session so that i can manually refresh to see the files slowly getting cleared and the other session to stop the SBMJOB before so that the cleared outq stopped at a certain number (i usually stopped the SBMJOB when the OUTQ reached 10.000)

    Is there any way to make the SBMJOB stopped by itself once the OUTQ reached 10.000, i am aware with a CLP i can run all of this together of even interactively one by one, but i have no way of making sure that all of them will stops at acertain number(in this case 10000).

    Thank you.

  • #2
    You could use QUSLSPL to generate a list of spoolfiles in an outq, then spin through that list and delete the first 10,000 splfs or until the end of the list.

    Comment


    • #3
      Would deleting them older than x days be an option?
      If that is a possibility, for output queues QEZJOBLOG and QEZDEBUG you can have the system clear these using the CHGCLNUP options. The "Job logs and system output" parameter lets you define the number of days to keep.
      Also, if you have the TAATOOLS library on your system, it has a DLTOLDSPLF command which can be used to delete output older than x days.

      Comment


      • #4
        Originally posted by john.sev99 View Post
        Would deleting them older than x days be an option?
        If that is a possibility, for output queues QEZJOBLOG and QEZDEBUG you can have the system clear these using the CHGCLNUP options. The "Job logs and system output" parameter lets you define the number of days to keep.
        Also, if you have the TAATOOLS library on your system, it has a DLTOLDSPLF command which can be used to delete output older than x days.
        Unfortunately older than x days not an option, since this activity is always being done on sunday and i have no way of knowing whether 10000 happened before sunday or not. And this is needed to be kept (documentary) for auditing purposes so i need to have the before-after screenshot (before got cleared - after got cleared).

        And it doesn't seem that a TAATOLS library is installed in the system, i might need to ask for permission to installed it. Hence the question whether i can simplify this manual process of CLROUTQ using CLP or not.

        Thank you very much

        Comment


        • #5
          Originally posted by UserName10 View Post
          You could use QUSLSPL to generate a list of spoolfiles in an outq, then spin through that list and delete the first 10,000 splfs or until the end of the list.
          Can you elaborate on this ? I don't see this command quite often

          Thank you

          Comment


          • #6
            QUSLSPL is not a command. It is an API:
            https://www.ibm.com/support/knowledg...is/QUSLSPL.htm

            Essentially it is a procedure that you can call that will generate a list of all spool files matching a criteria. You can then code your program to loop through those results and delete them individually.

            This is one of the more complex APIs. It outputs its results to a "user space" (essentially an object of raw byte data). You need to use another API's to first create the user space for QUSLSPL to use, and then another API to loop through the populated user space. Documentation on user spaces: https://www.ibm.com/support/knowledg...apiref/usf.htm

            Comment


            • #7
              How do i know whether the system i'm working on have API installed in it or not ?

              Comment


              • #9
                This article has some example code that shows how to create a user space, call the QUSLSPL API, and then read the list it placed in the user space.

                https://www.mcpressonline.com/progra...uce-complexity

                The links Vector linked to will explain the splf selection options available with the API.

                Comment


                • #10
                  Originally posted by Lemon Grande View Post
                  Unfortunately older than x days not an option, since this activity is always being done on sunday and i have no way of knowing whether 10000 happened before sunday or not. And this is needed to be kept (documentary) for auditing purposes so i need to have the before-after screenshot (before got cleared - after got cleared).

                  And it doesn't seem that a TAATOLS library is installed in the system, i might need to ask for permission to installed it. Hence the question whether i can simplify this manual process of CLROUTQ using CLP or not.

                  Thank you very much
                  Can you elaborate on your audit requirements? What are the before/after screenshots that you need? It is extremely unusual that auditors insist on keeping a certain number of reports online, it is far more common to keep x number of days of data online.
                  I don't really understand the comment about running on Sunday, I don't know why that makes a difference to what is kept.

                  My suggestion for TAATOOL was more based on keeping reports for a certain number of days so may not be useful and it isn't a free tool set.

                  Comment


                  • #11
                    I think i have it, and i didn't stop deleting spool after 10,000. What i mean is i want to leave the spool at 10,000. So if i have a 100000 spool then i do a CLROUTQ i will then end the SBMJOB job of the CLROUTQ once i see the WRKOUTQ for the spool file is close to 10,000.

                    Comment


                    • #12
                      Originally posted by john.sev99 View Post

                      Can you elaborate on your audit requirements? What are the before/after screenshots that you need? It is extremely unusual that auditors insist on keeping a certain number of reports online, it is far more common to keep x number of days of data online.
                      I don't really understand the comment about running on Sunday, I don't know why that makes a difference to what is kept.

                      My suggestion for TAATOOL was more based on keeping reports for a certain number of days so may not be useful and it isn't a free tool set.
                      The Screenshots is like the screenshot of the OUTQ before i run the CLROUTQ and then i screenshot it again after i finished the CLROUTQ and stopping the SBMJOB for the CLROUTQ at 10000. I don't think i have the TAATOOL, but i have QUSLSPL though.

                      I'm not sure why i'm instructed to clear the outq based on numbers rather than x days.

                      Comment


                      • #13
                        So you want to leave a maximum of 10,000 splfs in the outq, is that it?

                        Comment


                        • #14
                          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;

                          Comment


                          • #15
                            Originally posted by UserName10 View Post
                            So you want to leave a maximum of 10,000 splfs in the outq, is that it?
                            Yes, to leave it with only a miximum of 10000 and not doing a CLROUTQ if its already already below 10000

                            Comment

                            Working...
                            X