ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Using QMHRDQM to "Read" a DataQ

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

  • Using QMHRDQM to "Read" a DataQ

    Has anyone got an example of using this with COBOL? I have some programmers asking me about using this within their COBOL programs but they aren't sure about getting it to work.

    Does it "Read" the record then put it back on the bottom of the Queue? Or, does it just "Read" the record without removing it?

    Thanks in advance!

  • #2
    Re: Using QMHRDQM to "Read" a DataQ

    It just reads the record without removing it. Check out this link.

    BTW why not use the classical QRCVDTAQ API instead ?
    Philippe

    Comment


    • #3
      Re: Using QMHRDQM to "Read" a DataQ

      That was my response ... he wants to use this. --AND-- It's COBOL!

      Comment


      • #4
        Re: Using QMHRDQM to "Read" a DataQ

        have him De-convert this http://www.code400.com/forum/showthr...hlight=QMHRDQM from an advance language to COBOL. It should still work..
        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


        • #5
          Re: Using QMHRDQM to "Read" a DataQ

          Has anyone got an example of using this with COBOL?
          Look here.
          Philippe

          Comment


          • #6
            Re: Using QMHRDQM to "Read" a DataQ

            Nice find Philippe, I do however think my post was much funnier

            I snagged the code to post here COBOL is like a Steven King Book!-- written by Werner Grzemba Sept 8th 2003.

            PHP Code:
            identification division.
                   
            program-idtestrddtaq.
                   
            environment division.
                   
            configuration section.

                   
            data division.
                   
            working-storage section.

                   
            01  recvar.
                       
            02 bytes-returned     pic s9(9binary.
                       
            02 bytes-available    pic s9(9binary.
                       
            02 number-msgs-enqu   pic s9(9binary.
                       
            02 number-msgs-avail  pic s9(9binary.
                       
            02 key-len-returned   pic s9(9binary.
                       
            02 actual-key-len     pic s9(9binary.
                       
            02 msg-len-returned   pic s9(9binary.
                       
            02 actual-msg-len     pic s9(9binary.
                       
            02 entry-len-ret      pic s9(9binary.
                       
            02 entry-len-avail    pic s9(9binary.
                       
            02 offset-first-ent   pic s9(9binary.
                       
            02 returned-lib-name  pic x(10).
                       
            02                    pic x(202).
                   
            01  len-recvar            pic s9(9binary.
                   
            01  fmt                   pic x(08value "RDQM0100".
                   
            01  dqname.
                       
            02  dqnam             pic x(10value "DTAQVSD100".
                       
            02  dqlib             pic x(10value "BVVVSP1600".
                   
            01  msgsel.
                       
            02  seltype           pic x     value "F".
                       
            02                    pic xxx.
                       
            02  msglen            pic s9(9binary value 64.
                   01  msgslen               pic s9
            (9binary.
                   
            01  msgsfmt               pic x(08value "RDQS0100".
                   
            01  errparm               pic s9(9binary value zero.
                   
            01  dtaptr                pic s9(4binary.
                   
            01  dtafld.
                       
            02  dtatod            pic x(08).
                       
            02  dtaval            pic x(64).

                   
            01  infmt                 pic x(10value "*DTS".
                   
            01  invar                 pic x(08).
                   
            01  outfmt                pic x(10value "*SYSVAL".
                   
            01  outvar.
                       
            02                    pic x.
                       
            02  xdate             pic x(06).
                       
            02  xtime             pic x(06).
                       
            02                    pic x(03).

                   
            01  dummy                 pic x.

                   
            procedure division.
                   
            main.
                       
            move length of recvar to len-recvar
                       move length of msgsel to msgslen
                       call 
            "QMHRDQM" using  recvar
                                             len
            -recvar
                                             fmt
                                             dqname
                                             msgsel
                                             msgslen
                                             msgsfmt
                                             errparm
                       end
            -call
                       
            if  number-msgs-enqu not zero
                           add 5 offset
            -first-ent giving dtaptr
                           move recvar 
            (dtaptr:72to dtafld
                           move dtatod to invar
                           perform cvt
            -tod
                           display 
            "Data enqueued on " xdate " at " xtime
                           display 
            "Data: " dtaval
                           accept dummy
                       
            else
                          
            display "No data enqueued."
                       
            end-if
                       
            goback.

                   
            cvt-tod.
                       
            call "QWCCVTDT" using infmt
                                             invar
                                             outfmt
                                             outvar
                                             errparm
                       end
            -call
            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: Using QMHRDQM to "Read" a DataQ

              Originally posted by jamief View Post
              have him De-convert this http://www.code400.com/forum/showthr...hlight=QMHRDQM from an advance language to COBOL. It should still work..
              That's funny!

              Comment

              Working...
              X