Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Parse

3 views
Skip to first unread message

Hamilton, Robert L

unread,
Dec 6, 2004, 11:53:11 AM12/6/04
to
Here's a parse opportunity for some one:

<code>

/* main REXX program */

str = 'a_b-term=2004F'

parse var str 1 'term=' value

if value > '' then say value; else say 'no value';

exit 0

</code

What i need is value only if 'term=' starts in column 1; if term=
is found after col 1 then ignore it. . .

REXX returns value = 2004F; Is there a way to parse from col 1 only? I
need to ignore term= if it starts after

col1

bobh


----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

George, William , DHS-ITSD

unread,
Dec 6, 2004, 11:59:04 AM12/6/04
to
If I'm understanding your below statement correctly,

"What i need is value only if 'term=' starts in column 1; if term=
is found after col 1 then ignore it. . ."

With this as your example text string
str = 'a_b-term=2004F'

Try this;
If Left(Str,5) = 'term=' Then Parse Var Str 'term=' Value .

Doug Lee

unread,
Dec 6, 2004, 12:11:56 PM12/6/04
to
Try the following:

str = 'a_b-term=2004F'
If pos('term=',str) = '1' Then Do


parse var str 1 'term=' value
if value > '' then say value; else say 'no value';

End


"Hamilton, Robert
L"
<roberth@UTDALLAS To
.EDU> TSO-...@VM.MARIST.EDU
Sent by: TSO REXX cc
Discussion List
<TSO-...@VM.MARI Subject
ST.EDU> Parse


12/06/2004 10:52
AM


Please respond to
TSO REXX
Discussion List
<TSO-...@VM.MARI
ST.EDU>

Hamilton, Robert L

unread,
Dec 6, 2004, 12:18:39 PM12/6/04
to
William & doug; looks like either will be the way but I was hoping to
get PARSE to start in column 1, without the extra code.

Thnx

bobh

-

George, William , DHS-ITSD

unread,
Dec 6, 2004, 12:23:33 PM12/6/04
to
Try this then

Parse Var Str 1 str1 6 Value
If Str1 \= 'term=' Then <do what you do to ignore this>


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Hamilton, Robert L
Sent: Monday, December 06, 2004 9:18 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: Parse

William & doug; looks like either will be the way but I was hoping to
get PARSE to start in column 1, without the extra code.

Thnx

bobh

----------------------------------------------------------------------

Stephen E. Bacher

unread,
Dec 6, 2004, 12:48:55 PM12/6/04
to
How about:

str = 'a_b-term=2004F'
parse var str junk 'term=' value
if junk == '' and value > '' then say value; else say 'no value';

If you wish to permit leading blanks in the string preceding
the 'term=', then change the double == to a single = above.

- seb

Vitonis, Anthony J

unread,
Dec 6, 2004, 12:53:19 PM12/6/04
to
IF LEFT(str, 5) = "term=" THEN value = SUBSTR(str, 6)

-----Original Message-----
From: Hamilton, Robert L
Sent: Monday, December 06, 2004 11:53 AM
To: TSO-...@VM.MARIST.EDU
Subject: Parse

Here's a parse opportunity for some one:

<code>

/* main REXX program */

str = 'a_b-term=2004F'

parse var str 1 'term=' value

if value > '' then say value; else say 'no value';

exit 0

</code

What i need is value only if 'term=' starts in column 1; if term= is
found after col 1 then ignore it. . .

REXX returns value = 2004F; Is there a way to parse from col 1 only? I
need to ignore term= if it starts after col1

----------------------------------------------------------------------

0 new messages