ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Viewing STDOUT?

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

  • Viewing STDOUT?

    Not sure if this is the right location to post this in or not.

    Basically, my project is to send a roughly 1mb binary file through STDOUT as a response to a request.

    The file is being sent, and is mostly correct, but it appears to have dropped characters. It's a very small amount of characters, but more than enough (well, really even one is enough) for the file to be unusable to the requesting party.

    I need to see exactly what Apache is receiving through STDOUT, if that makes sense, because the data appears to be fine as it is being read and written via my RPG code.

    Does anyone know how to see or log what's being written to STDOUT?

  • #2
    Re: Viewing STDOUT?

    Can you show the code that is writing to the STDOUT?

    The most likely culprit is that the write interface is having to chop up the data into 32K bytes to send thru STDOUT, and it is not positioning the pointer correctly for the next 32K bytes. (In other words, every 32K bytes, it drops one byte as the pointer is not set correctly. )
    Michael Catalani
    IS Director, eCommerce & Web Development
    Acceptance Insurance Corporation
    www.AcceptanceInsurance.com
    www.ProvatoSys.com

    Comment


    • #3
      Re: Viewing STDOUT?

      Why 32k bytes? QtmhWrStout allows 65535 strings to be sent to it, and in newer versions of the OS, I understand that supposedly strings can go up to something like 16mb, or so I read.

      Comment


      • #4
        Re: Viewing STDOUT?

        Originally posted by vitaemachina View Post
        Why 32k bytes? QtmhWrStout allows 65535 strings to be sent to it, and in newer versions of the OS, I understand that supposedly strings can go up to something like 16mb, or so I read.
        Because most of the prototypes I've seen use 32767 for the buffer size. This is the reason I wanted to see the code for writing to the StdOut, to see what you were using for the buffer size. If the buffer size for QtmhWrStout is less than the binary file size, you will have to bust the binary file up into multiple segments, and my guess was the the pointer to the next segment was off by a byte.
        Michael Catalani
        IS Director, eCommerce & Web Development
        Acceptance Insurance Corporation
        www.AcceptanceInsurance.com
        www.ProvatoSys.com

        Comment


        • #5
          Re: Viewing STDOUT?

          Only a guess!
          STDOUT is a kind of physical file isn't it?
          And the maximum row size of a physical file (or SQL Table) is limited to 32,767 Byte.

          Birgitta

          Comment


          • #6
            Re: Viewing STDOUT?

            I ran some tests on V6.1, and I could use 16mb field lengths on the QtmhWrStout api. (I wouldnt recommend going anywhere near this high on the api though. )

            My current service program accepts a 1MB varying field, and feeds the QtmhWrStout api data in 32K byte increments.

            I'm going to bump the api feed, as there are plenty of times a single write exceeds 32Kb. I'm just trying to decide if I should go up to 65K or 128K, or simply make it 1MB. 1MB simply seems like overkill, as it will cause the service program to allocate a lot more memory than it would ever really utilize. And with a number of cgi programs running, this could chew up a lot of memory unnecessarily.
            Michael Catalani
            IS Director, eCommerce & Web Development
            Acceptance Insurance Corporation
            www.AcceptanceInsurance.com
            www.ProvatoSys.com

            Comment

            Working...
            X