ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Export QEZJOBLOG Spool Files ?

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

  • Export QEZJOBLOG Spool Files ?

    Is there a way to dump all the spooled files in QEZJOBLOG to a file, so I can do a string search ?

  • #2
    Why to copy if you can read it directly?
    The OUTPUT_QUEUE_ENTRIES Service in QSYS2 returns all entries in Jobqueues.
    With the SPOOLED_FILE_DATA Service in SYSTOOLS you can read the content of a spoolfile.
    If you put both together, you can directly search through the spool file data:


    Code:
    Select a.Job_Name, Spooled_File_Name, File_Number, Spooled_Data
         from OutPut_Queue_Entries a Cross Join
               Lateral(Select *
                         From Table(SysTools.Spooled_File_Data(
                                       Job_Name => a.Job_Name,
                                       Spooled_File_Name => a.Spooled_File_Name,
                                       Spooled_File_Number => File_Number))) b
        Where     Output_Queue_Name = 'QEZJOBLOG'
              and Spooled_Data like '%WhateverYouWant%';
    Birgitta

    Comment


    • #3
      Great Solution. Thanks !!

      Comment


      • #4
        I am puzzled why I get 0 results from "PURCHASING" which has 37 files , when I want 'P%' OUTQs

        Code:
         Work with All Output Queues
        
        Type options, press Enter.
        2=Change 3=Hold 4=Delete 5=Work with 6=Release 8=Description
        9=Work with Writers 14=Clear
        
        Queue      Library Files Writer Status
        [COLOR=#e74c3c]PURCHASING[/COLOR] QUSRSYS 37 RLS
        [COLOR=#c0392b]P1[/COLOR]         QUSRSYS 169 HLD
        But when I run this, I only get results for P1 OUTQ

        Code:
        SELECT *
        from QSYS2.OutPut_Queue_Entries a Cross Join
        Lateral(Select *
        From Table(SysTools.Spooled_File_Data(
        Job_Name => a.Job_Name,
        Spooled_File_Name => a.Spooled_File_Name,
        Spooled_File_Number => File_Number))) b
        Where [COLOR=#e74c3c]Output_Queue_Name like 'P%'[/COLOR]
        and OUTPUT_QUEUE_LIBRARY_NAME = 'QUSRSYS'
        order by Output_Queue_Name
        Last edited by MFisher; April 28, 2022, 10:00 AM.

        Comment


        • MFisher
          MFisher commented
          Editing a comment
          I should see all the files in PURCHASING, since I am not filtering on content.

          I DO get expected results from this:

          SELECT * from QSYS2.OutPut_Queue_Entries
          where OUTPUT_QUEUE_NAME = 'PURCHASING'
          order by user_data
          Last edited by MFisher; April 28, 2022, 10:31 AM.
      Working...
      X