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

Strip leading and trailing spaces in CLIST

267 views
Skip to first unread message

Mike Jarrett

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Hi all,
Can someone answer a CLIST question for me please?
I want a neat way to strip leading and trailing spaces from a text string.
(I find myself forced to write a CLIST instead of a Rexx, because it is to
run under the control of the Serena Software 'Startool' product, which has
an internal interpreter for CLIST, but doesn't support Rexx.)
t.i.a.
Mike


______________________________________________________________________
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of
the information, or copying of this message is prohibited. If you are not
the addressee, please notify the sender immediately by return e-mail and
delete this message. Although this e-mail and any attachments are believed
to be free of any virus, or other defect which might affect any computer or
system into which they are received and opened, it is the responsibility of
the recipient to ensure that they are virus free and no responsibility is
accepted by M&G for any loss or damage from receipt or use thereof.

Hawley Scott

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
If your var is named MYVAR for example try
SET MYVAR = &MYVAR
That should do it...

Dave Salt

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
Use a combination of SYSINDEX and SUBSTR within a DO loop to examine each
byte, determine if it's a space, and if so, remove it.

Dave Salt

>From: Mike Jarrett <Mike_J...@MANDG.CO.UK>
>Reply-To: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
>To: TSO-...@VM.MARIST.EDU
>Subject: Strip leading and trailing spaces in CLIST
>Date: Wed, 8 Dec 1999 11:39:28 +0000
>
>Hi all,
>Can someone answer a CLIST question for me please?
>I want a neat way to strip leading and trailing spaces from a text string.
>(I find myself forced to write a CLIST instead of a Rexx, because it is to
>run under the control of the Serena Software 'Startool' product, which has
>an internal interpreter for CLIST, but doesn't support Rexx.)
>t.i.a.
>Mike
>
>
>
>
>
>
>______________________________________________________________________
>The information contained in this message may be CONFIDENTIAL and is
>intended for the addressee only. Any unauthorised use, dissemination of
>the information, or copying of this message is prohibited. If you are not
>the addressee, please notify the sender immediately by return e-mail and
>delete this message. Although this e-mail and any attachments are believed
>to be free of any virus, or other defect which might affect any computer or
>system into which they are received and opened, it is the responsibility of
>the recipient to ensure that they are virus free and no responsibility is
>accepted by M&G for any loss or damage from receipt or use thereof.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Stephen E. Bacher

unread,
Dec 8, 1999, 3:00:00 AM12/8/99
to
>If your var is named MYVAR for example try
> SET MYVAR = &MYVAR
>That should do it...

Unless &MYVAR contains arithmetic expression characters,
or even the string "EQ". In that case you'll get a
CLIST evaluation error. Same thing if the string has
ampersands in it.

You can't solve the problem by putting &STR or &NRSTR
around it, because that will suppress the stripping
of spaces that you wanted in the first place.

A loop using DO WHILE and &SUBSTR is your only sure bet.

- seb

Mike Jarrett

unread,
Dec 9, 1999, 3:00:00 AM12/9/99
to
Hello again everyone,
Many thanks for the suggestions.

f.y.i, SET MYVAR = &MYVAR doesn't work in this particular case, because
unfortunately my text string _can_ include asterisk, slash, percent and
ampersand characters (it's a a Serena-style dataset search mask).

So, it looks like I might me reduced to the sledgehammer method, looping
thorugh the characters one by one.
The RTRIM, LTRIM and TRIM procs are a neat coding of this method.

However,...
Last night, I found something in the manual which might be 'abusable' to do
what I want:
SET SYSDVAL = &STR(&MYVAR)
READDVAL MYVAR DUMMY
This seems to break MYVAR into separate strings, using spaces as
delimiters.
It doesn't seem to care about special characters in the string.
(I know that my string won't contain any internal spaces)
Can anyone think of any problem with this?

Michael Simpson

unread,
Dec 9, 1999, 3:00:00 AM12/9/99
to
Apologies in advance

Sorry about this, but as a first time user, I'm trying to test how to
append/reply
to any threads and don't know how else to do it.

0 new messages