ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

MQ Data

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

  • MQ Data

    MQDATA =
    ....5...10...15...20...25...30...35...40...45...50 ...55...60
    1 ' 20071024094790020720620190 IN000000646A000000075{2004'
    61 '0426200710153XXX 2007102409479002'
    121 '2378909790 IN000000645H000000500{20040526200710163XXX '
    181 ' 20071024094890030083177390 IN'
    241 '000002859{000000126I20040630200710083XXX '

    In my MQ program, I get the entire message loaded into a variable MQDATA. I need to parsh out this data into a file that is 100 characters long. The length of MQDATA field is a variable length. How can I create a loop that will pull out this data until there is no more characters in the MQDATA string. If I don't know the length of the field?

    DAC

  • #2
    Re: MQ Data

    cant you just do length = %len(%trim(MQDATA)) to get the length

    then divide the length by 100 (checking for remainder)
    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


    • #3
      Re: MQ Data

      It seems that the %trim() function isn't necessary in the Jamie's example above since MQDATA is a variable length field.

      length = %len(MQDATA) should be sufficient, divide and remainder are ok.
      Philippe

      Comment


      • #4
        Re: MQ Data

        If I take the length and divide by 60. What is the command to half adjust it. For example if the length is 221 /60 = 3.68. I want X to equal 4.

        DAC

        Comment


        • #5
          Re: MQ Data

          In free format RPG if I want to execute my main loop lets say 10 times. Would I start the Do with DO X; where x= 10?

          DAC

          Comment


          • #6
            Re: MQ Data

            try looking at %rem

            Code:
                 d howmanyitems    s              4  0 inz(5)             
                 d howmanylabels   s              4  0                    
                                                                          
                                                                          
            12345 /free                                                   
                                                                          
                   howmanylabels = howmanyitems/4;                        
                   if %rem(howmanyitems:4) > *zeros;                      
                    howmanylabels +=1;                                    
                   endif;                                                 
                   *inlr = *on;                                           
                                                                          
                  /end-free
            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

            Working...
            X