sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Trim on RPGIII

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

  • Trim on RPGIII

    Hi all,
    I can use only RPGIII and I want to do a trim. So %TRIM don't work on my system.
    How can i do that ?
    thank you

  • #2
    Re: Trim on RPGIII

    In the distant past when I wrote RPG400 I would use a DO loop searching one character at a time from the end of the string until I found the last non blank character in the string. With that result in hand I would move the string to a result string utilizing SUBST.

    Which just goes to show you how much productivity goes down when your tool set is hampered.

    Steve

    Comment


    • #3
      Re: Trim on RPGIII

      steve is correct... need to get the length of the field
      do a do loop substringing 1 char at a time!

      drop into an array find the first element that is non-blank
      reading from bottom to top!

      jamie
      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


      • #4
        Re: Trim on RPGIII

        Originally posted by IroCorp View Post
        Hi all,
        I can use only RPGIII and I want to do a trim. So %TRIM don't work on my system.
        How can i do that ?
        thank you

        Use CvtRpgSrc command, then use the %trim bif.
        Michael Catalani
        IS Director, eCommerce & Web Development
        Acceptance Insurance Corporation
        www.AcceptanceInsurance.com
        www.ProvatoSys.com

        Comment


        • #5
          Re: Trim on RPGIII

          For trailing blank characters, you can use the CHEKR op-code to find the position within the string of the last non-blank character. For leading blanks, a do loop reading each character in the string from the front is the only way I know.
          "Time passes, but sometimes it beats the <crap> out of you as it goes."

          Comment


          • #6
            Re: Trim on RPGIII

            If embedded SQL is allowed, you may also use the SQL scalar functions TRIM, RTRIM and LTRIM in RPGIII:

            PHP Code:
            C/EXEC SQL  SET :MYRES TRIM(:MYVAR)
            C/END-EXEC 
            Birgitta

            Comment


            • #7
              Re: Trim on RPGIII

              Ok thank you.
              I can use embedded SQL and it's working

              Comment


              • #8
                Re: Trim on RPGIII

                Hi All,
                I "up" this topic because this time I can't use SQL.
                Do you know how to remove blank in a string ?
                Thank You

                Comment


                • #9
                  Re: Trim on RPGIII

                  Why are you forced to use RPG III, its only been out since the ice age.
                  Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                  Comment


                  • #10
                    Re: Trim on RPGIII

                    Why are you forced to use RPG III, its only been out since the ice age.
                    It just so happens that his company/boss was formed/born at the same time
                    Your future President
                    Bryce

                    ---------------------------------------------
                    http://www.bravobryce.com

                    Comment


                    • #11
                      Re: Trim on RPGIII

                      Try the XLATE command:

                      Check here
                      -Rick

                      _____________________________

                      Need a Managed File Transfer Solution -OR- iSeries Encryption?
                      GoAnywhere and Crypto Complete by Linoma Software

                      Comment


                      • #12
                        Re: Trim on RPGIII

                        Originally posted by FaStOnE View Post
                        Try the XLATE command:

                        Check here
                        yep...the good ol' days of RPG III (i really don't miss them that much lol)
                        I'm not anti-social, I just don't like people -Tommy Holden

                        Comment


                        • #13
                          Re: Trim on RPGIII

                          OK thank you but maybe I have not explained properly my problem. Sorry

                          The real thing I want to do is to transfert a String 8 char into a string 6 char.
                          But the entry string can be " 123456 " so when I move it in the string 6 char, I might Have " 12345" or "23456 " (With MOVE or MOVEL)
                          With a trim function, If I put the result in a String 6 char, I would have no problems, I would always have the 6 digit (in any case in other languages )

                          Have you any idea how to do that ?
                          Thank you

                          Comment


                          • #14
                            Re: Trim on RPGIII

                            use SCAN, use arrays for each character, etc. there's several ways. the RPG reference manual is a good place to start...
                            I'm not anti-social, I just don't like people -Tommy Holden

                            Comment


                            • #15
                              Re: Trim on RPGIII

                              OK So no function like trim ??

                              Comment

                              sponsored links

                              Collapse

                              Working...
                              X