ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Limitation of %Subst

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

  • Limitation of %Subst

    I came across a scenario where the %Subst threw the following error

    "Length or start position is out of range for the string operation"

    But this error came up only when the start & end position of the %Subst went past a particular value. Is this a limitation of %Subst?

    Eval Wrk_Var = %Subst(Data@p:Wrk_StrPos:Wrk_EndPos)

    The values in this statement are given below (when it crashed)
    Wrk_StrPos = 16431
    Wrk_EndPos = 16530

    Could anyone help ?

  • #2
    Re: Limitation of %Subst

    Hi,

    the second parameter within the built-in-function %Subst is not the end position, but the length of the string to be returned.

    Birgitta

    Comment


    • #3
      Re: Limitation of %Subst

      And if the start position plus the number of bytes to return is greater than the field length (or less than 1), then you would get an error returned.
      Michael Catalani
      IS Director, eCommerce & Web Development
      Acceptance Insurance Corporation
      www.AcceptanceInsurance.com
      www.ProvatoSys.com

      Comment


      • #4
        Re: Limitation of %Subst

        Thanks a lot for the info.... I made the mistake of assuming that the second parameter is the length of the string that you are going to retrieve ...... I didnt cross check that

        Comment

        Working...
        X