ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Routine for parsing a varchar to print.

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

  • Routine for parsing a varchar to print.

    Has anyone got a routine in their toolbox that parses a varchar field, say 4000 chars, and splits the line up for printing in 80 char increments based on the new line character as the delimiter?

    Before I write something like this, I thought I would check first...


  • #2
    Re: Routine for parsing a varchar to print.

    Sorry I dont have a tool.

    you can just use the %scan with a starting pos and increment the starting pos at the bottom of the do loop

    something like this
    Code:
    C                   eval      str = 1                                              
    C                   eval      pos = %scan('/' : %trim(C1FLDR))                     
    C                   dow       pos > 0                                              
    C                   eval      end = str                                            
    C                   if        pos > 1                                              
    C                   eval      end = pos - 1                                        
    C                   endif                                                          
    C                   eval      IFSFolders = %trim(IFSFolders) +                     
    C                             %subst(%trim(C1FLDR) : str : end)                    
    C                   eval      str = end + 2                                        
    C                   eval      pos = %scan('/' : %trim(C1FLDR) : str)               
    C                   enddo
    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: Routine for parsing a varchar to print.

      Thanks, Jamie! Worked like a charm with a little modification. I appreciate your help on this.

      dd

      Comment


      • #4
        Re: Routine for parsing a varchar to print.

        Jamie... you're my hero!!

        Comment


        • #5
          Re: Routine for parsing a varchar to print.

          Stop ur killing me It nice to see so many different personalities showing up on the forums.
          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


          • #6
            Re: Routine for parsing a varchar to print.

            Originally posted by jamief
            It nice to see some personalities showing up on the forums.
            Ouch.
            "Time passes, but sometimes it beats the <crap> out of you as it goes."

            Comment


            • #7
              Re: Routine for parsing a varchar to print.

              I meant more personalities !!!!! removing foot from mouth
              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


              • #8
                Re: Routine for parsing a varchar to print.

                Code 400!

                Feel the love!!

                dd

                Comment

                Working...
                X