These are defined in Chapter 9.3 of the Object Rexx reference. The length
positional patterns work the way many people expect + and - to work,
particularly with backward movement. Consider the following two templates.

var = "This is a test"
parse var var "is" -2 value       -- value is set to "s is a test"

parse var var "is" <2 value     -- value is set to "s ", the two characters
preceding the last match.

Many people expect -2 to work that way and are surprised to see that it
picks up the remainder of the string. If I had a nickle for every time I've
had to explain why it worked that way... Or every worse, had to deal with a
bug report from someone convinced that was actually a bug.

Rick

On Fri, Apr 27, 2018 at 4:47 AM, Leslie Turriff <jlturr...@mail.com> wrote:

>         I thought I understood Rexx parsing templates, but then I found
> this in the
> Language Reference:
>
> >   Example 9.16. Combining variables in patterns
> >    /* Using a variable as a string pattern
>   */
> >     /* The variable (delim) is set in the same template          */
> >     SAY "Enter a date (mm/dd/yy format). =====> " /* assume 11/15/98 */
> >     pull date
> >     parse var date month 3 delim +1 day +2 (delim) year
> >     /* Sets: month="11"; delim="/"; day="15"; year="98" */
> >
> > If an equal, a plus, a minus sign, > or < precedes the left parenthesis,
> the
> > value of the expression is treated as an absolute, relative positional,
> or
> > length positional pattern. The value of the expression must be a positive
> > whole number or zero.
>
> This appears to be saying
>                 =(value) is absolute positional,
>         -(value)        +(value) is relative positional, and
>         <(value)        >(value) is length positional.
>
> I've never seen "length positional" before, and I can't find reference to
> it
> in any of my other Rexx language sources.  Since there are no examples of
> its
> use in the Languagae Reference, how do <(value) and >(value) work?
>
> Leslie
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to