ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Message Key from Spool File in MSGW Status

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

  • Message Key from Spool File in MSGW Status

    I am using the QUSLSPL api to generate a list of spool files. I need to get the message associated with a spool file that is in a MSGW status. Anyone know of a way to determine the message key of a spooled file in MSGW status?

    Thanks!!!

  • #2
    Re: Message Key from Spool File in MSGW Status

    Since MSGW for a spooled file Status is generally associated with a writer job, you'll probably need to determine what writer has the message. I suppose you'll need to extract the *OUTQ from the spooled file attributes and use that with the Retrieve Output Queue Information (QSPROUTQ) API to determine the writer job. (Most likely, there will only be a single writer job for a given *OUTQ.)

    Once you know the writer job name, you should be able to retrieve any message it's waiting on.
    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


    • #3
      Re: Message Key from Spool File in MSGW Status

      Thanks Tom! I have now gotten to the point that I can retrieve the inquiry messages using your suggestions above but I need to get only the inquiry messages that have no reply. Would I need to read the whole queue only picking out the unanswered messages? What is a suggestion on how to grab just the unanswered messages using QMHRCVM? I know that type 05 is an inquiry message and that types 21-26(?) are reply messages. Will I have to do this?:

      1. Determine if this is an inquiry message. Hold the message key.
      2. Get the next message. If it is a reply message then clear the previous message key.
      3. If the next message is NOT a reply message then the previous message WAS an unanswered inquiry message, and I will need to hold it.

      Any suggestions will be welcome!!!!

      Thanks!

      Comment


      • #4
        Re: Message Key from Spool File in MSGW Status

        Review the Message Types and Message Keys sub-topic for the Receive Nonprogram Message (QMHRCVM) API. In particular, look at how receiving the *COPY message type relates to both *INQ and *RPY message types. The descriptions of those should give direction on how you might do it. I haven't tried what you seem to want to do, so it might need experimenting.

        It's not completely clear what business problem you're trying to solve. If you described the problem, perhaps a better solution is possible.
        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


        • #5
          Re: Message Key from Spool File in MSGW Status

          Tom,

          Revisiting this after a while....

          What I have is a GUI interface that is kind of mimicking the WRKSPLF/WRKOUTQ commands. I've given the user the ability to display (via PDF or .txt), move, hold, save, release, and delete spool files from the GUI grid. I am using APIs to display the subfile/grid of the spool files.

          The next thing I wanted to tackle was allowing the user to reply to a MSGW status spool file. I can get what message queue the MSGW is in, but I need to be able to show the message and let the user reply to it. What I need is to somehow determine which message to display from the writer's message queue that needs a reply.

          1. Determine the message key of the inquiry message the spool file is waiting on
          2. After determining the error message key then determine if a reply has already been sent
          3. If a reply has not been sent then display the message to the user in my GUI interface and let them reply to the message

          I tried reading through the entire message queue and picking out just the inquiry messages (type 05). I then looked at the next message to see if it is a type 21, 22, 23, 24, 25, or 26 which are all reply type messages. If the next message was a reply type then that message has been answered. But sometimes the next message would be replied to but it would skip the reply and display the next proper message. I would have the message queue displayed on another screen and then follow (via debug) each message it read from that message queue. Sometimes it would receive additional messages after the inquiry type that were not showing in the message queue.

          Surely there has to be a way to do this like using the "7" option on the WRKSPLF and WRKOUTQ commands or the F6 from the WRKWTR command. Those screens must know the message key because it will take you directly to the error message.

          I have attached a screen shot of my GUI interface of my spool files. None of them are in MSGW but it might give you a better understanding of where I am coming from.

          Thanks!!!!
          Attached Files

          Comment


          • #6
            Re: Message Key from Spool File in MSGW Status

            I think I found the solution. I need to check the writer status API (QSPRWTRI). That has the message status and message key. Don't know why I didn't think of it before since I am using it in my current application. Just never noticed the message key return field.

            Comment


            • #7
              Re: Message Key from Spool File in MSGW Status

              My fault... way back at the beginning, I should have expanded on what to do with the writer information once you had the writer name for the *OUTQ. Looking back, I can't understand why I skipped that extra detail. Are you getting to the expected message?
              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


              • #8
                Re: Message Key from Spool File in MSGW Status

                Everything is working wonderfully! I can't believe I missed it either since I was using that API already to determine whether a writer was a remote writer or not. Bottom line is it is doing exactly what I need.

                Thanks for your help!!!

                Comment

                Working...
                X