ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Etract print data from user space

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

  • Etract print data from user space

    Hi, anybody know how to extract the print data from user space, that is created by QSPGETSP?
    Please note I only need the print data of the spool file, skipping the header information.

  • #2
    Re: Etract print data from user space

    Originally posted by kartikchowdary View Post
    Hi, anybody know how to extract the print data from user space, that is created by QSPGETSP?
    Please note I only need the print data of the spool file, skipping the header information.
    i have a command on my website that uses the spooled file APIs that may help you. it's the duplicate spooled file command and you can find it in my downloads section. http://tommyholden.com/downloads
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Etract print data from user space

      You could also check here


      It just needs a little change for v5r4m0.
      Regards

      Kit
      http://www.ecofitonline.com
      DeskfIT - ChangefIT - XrefIT
      ___________________________________
      There are only 3 kinds of people -
      Those that can count and those that can't.

      Comment


      • #4
        Re: Etract print data from user space

        Hi, I only need to retrieve the print data. I know how to duplciate a spool file, but that logic wont help me here. My purpose is to retrieve the print data from spool and to write it into a database file. I.e. I need the functionality of CPYSPLF for AFPDS spools.

        Comment


        • #5
          Re: Extract print data from user space

          catsplf

          Tips-techniques CL Techtip: read printer output with QSHELL

          Miauw !

          Comment


          • #6
            Re: Etract print data from user space

            TechTip: Read Printer Output with Qshell
            Written by MC Press Contributing Author : Paul Amsden
            Thursday, 21 October 2004

            Spool files are not for output only! Everybody knows that spool files contain output, right? Well, that's not necessarily true. SPOOL is an acronym meaning Simultaneous Peripheral Operations Online. Spooling was originally developed for card readers, card punches, and printers as a way to speed up interaction with those slow devices. So input can be spooled as well as output. But there's another sense in which spool files can serve as input. It is common for shops that use packaged software--especially those shops that do not have the software's source code--to read and process spooled output from one of the package's programs in order to produce something more to their liking.

            OS/400 programmers are familiar with CL's Copy Spool File (CPYSPLF) command, which copies spooled output to a database file. As of V5R3, Qshell includes a utility that is similar in function. Its name is catsplf, and it will be a welcome addition when my shop goes live with V5R3.

            Catsplf is similar in function to the cat utility, which reads standard input (stdin) or disk files. Catsplf reads one or more spool files from a job and writes them to standard output (stdout). You may specify the job in one of two ways. Use the j option to specify the qualified job name using the OS/400 convention of jobnumber/user/jobname. Use the p option to specify the job name by its Qshell process ID. Whichever method you use, follow the job name with the name and number of the spool file. The spool file name and alpha portions of the job name are not case-sensitive, so you may use your preference of uppercase or lowercase letters. You may not use either the special values *ONLY and *LAST that CPYSPLF supports to specify the spool file number, or the special value * to indicate the current job.

            The following examples illustrate both of these options. In both cases, the first spool file named QSYSPRT is copied to stdout.
            The following examples illustrate both of these options. In both cases, the first spool file named QSYSPRT is copied to stdout.


            catsplf -j 208922/pamsden/qzshchld qsysprt 1

            catsplf -p 854 QSYSPRT 1
            There are three other options that can be useful.

            The a option tells Qshell to read all the spool files for a job. In this case, you do not follow the job identifier with a spool file name and number. Here are two equivalent expressions that use the a option:

            catsplf -a -j 208922/PAMSDEN/QZSHCHLD

            catsplf -aj 208922/PAMSDEN/QZSHCHLD
            The e and n options number the lines as they are written to stdout. The difference between the two is that the e option ends each line with a dollar sign ($). Here are a couple of examples that use the e and n options:


            catsplf -anj 208922/PAMSDEN/QZSHCHLD

            catsplf -a -e -j 208922/PAMSDEN/QZSHCHLD
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Etract print data from user space

              Have you looked at format SPFR0300 in QSPGETSP

              John McKay
              jmckay@mckaysoftware.ie
              http://www.rpglanguage.com

              Comment


              • #8
                Re: Etract print data from user space

                AFPDS spool files can be very difficult to read/parse because they are bas on the Mixed Object Document Content Architecture structure. Here is a link giving an overview of how they are built:



                As a rule, trying to parse data from an AFPDS report within a user space could be difficult to say the least, especially if the report contains esoteric things like bar codes, etc.

                It is unlikely that the CATSPLF examples for QSHELL will work with AFPDS spooled files

                Terry

                Comment


                • #9
                  Re: Etract print data from user space

                  Originally posted by kartikchowdary
                  My purpose is to retrieve the print data from spool and to write it into a database file.
                  Do you mean store the print data into a CLOB or BLOB field in the database ?
                  Philippe

                  Comment


                  • #10
                    Re: Etract print data from user space

                    HI, I have found that "catsplf" is wont work for AFPDS spools. Actually I have tried to use API's QUSPTRUS & QUSRTVUS to retrieve the print data. But the received data contains some junk characters, along with the print data. I suppose it is in some compressed format.
                    Is there anyway that we can extract the print data content exactly?

                    Comment

                    Working...
                    X