ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to get List of Spool files from OUTQ to Java

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

  • How to get List of Spool files from OUTQ to Java


    Hi everyone,

    1st i want to say thank you for viewing this thread

    I'm a beginner to AS400/JAVA development. I want to know how to get spool file list to java and how to convert it to PDF from OUTQ, Using JT400.

    Can anyone to tell me or give me sample java code ?

    Thanks in advance!

  • #2
    Re: How to get List of Spool files from OUTQ to Java

    any help please..

    Comment


    • #3
      Re: How to get List of Spool files from OUTQ to Java

      What exactly do you want to convert to a .PDF? Do you want to convert the "spool file list"? Or do you want to convert a spooled file that is found through the list?
      Tom

      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

      Comment


      • #4
        Re: How to get List of Spool files from OUTQ to Java

        IBM has plenty of examples for almost anything. You should really spend some time on IBM's information center page.

        Listing spooled files asynchronously

        Reading spooled files

        Jim

        Comment


        • #5
          Re: How to get List of Spool files from OUTQ to Java

          FWIW. I did this not to long ago in Python (Well Jython so I can use JT400)

          system should be a reference to a com.ibm.as400.access.AS400 object
          userMask is a string usually "*ALL"; optionally the user name of your choice to only get a list of spooled files created by that user
          outQMask is also a string. I had to consult the java doc on this one; it needs to look something like this:
          Code:
          /QSYS.LIB/%LIBL%.LIB/WES.OUTQ
          Replacing "WES" with the out queue of your choosing. %LIBL% indicates all libraries in the library list of the job, this can be replaced with a specific library as well.

          This method returns a list of com.ibm.as400.access.SpooledFile objects. This code is almost a 1 to 1 translation of the examples already linked too in the thread.

          PHP Code:
          def getSpooledFileList(systemuserMaskoutQMask):
              
          spooledFiles = []
              
          splfList SpooledFileList(system)
              
              
          #Set filters, all users, on all queues
              
          splfList.setUserFilter(userMask)
              
          splfList.setQueueFilter(outQMask)
              
              
          #Open list, openAsynchronously() returns immediately  
              
          splfList.openAsynchronously()
              
              
          #Wait for list to complete
              
          splfList.waitForListToComplete()
              
              
          enum splfList.getObjects()

              
          #Add spooled file object to a list
              
          while(enum.hasMoreElements()):
                  
          splf enum.nextElement()   #splf is a com.ibm.as400.access.SpooledFile object
                  
          if not(splf == None):
                      
          spooledFiles.append(splf)
              
          #Clean up after we are done with the list
              
          splfList.close()
              
              return 
          spooledFiles 

          Comment

          Working...
          X