Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!king From: king@motcid.UUCP (Steven King) Newsgroups: comp.lang.rexx Subject: Re: Question about Parsing Message-ID: <5520@orchid3.UUCP> Date: 29 Nov 90 19:33:53 GMT References: <9304@ncar.ucar.edu> Organization: Motorola Inc. - Cellular Infrastructure Div., Arlington Heights, IL 60004 Lines: 41 In article <9304@ncar.ucar.edu> tparker@bierstadt.scd.ucar.edu (Tom Parker) writes: >In parsing, I know you can use a string pattern in a variable, by putting >it in parentheses. For example: > > slash = '/' > parse value 'dog/cat' with word1 (slash) word2 > >But I can't find how to use a NUMERIC pattern in a variable. For >example, I might want to break a string at a specific column determined >by the program. Simplistic example: > > column = 4 > parse value 'dog/cat' with word1 (column) word2 > >will use '4' as a string pattern, rather than as a number pattern. You're trying to parse everything *BEFORE* the fourth column into the variable "word1" and everything *AFTER* the fourth column into "word2". Try it this way: parse value 'dog/cat' with 1 word1 4 . 5 word2 This template tells REXX to start start parsing the first variable in column 1, the second variable (".", the dummy variable) in column 4, and the third variable in column 5. You'll end up with "word1" set to "dog" and "word2" set to "cat". The slash will be assigned to the dummy variable and discarded. By the way, to parse on a single character (or a string for that matter) you don't need to fool around with assigning it to a variable and putting it in parentheses if you don't want to. Simply, parse value 'dog/cat' with word1 "/" word2 will work just fine to assign "dog" to "word1" and "cat" to "word2". -- ---------------------------------------------------+--------------------------- Never let anyone know you're good at something | Steven King you dislike. You'll find yourself doing it | Motorola Cellular forever. | ...uunet!motcid!king