|
Yes, but you could concatenate a string of special characters to the end of the
string and scan for that. By using the *TCAT concatenation operation, you
remove trailing blanks first.
The following example CL demonstrates this. I have used two tilde characters
as the scan string, but it could be anything:
PGM PARM(&STRING)
DCL VAR(&STRING) TYPE(*CHAR) LEN(80)
DCL VAR(&TEST) TYPE(*CHAR) LEN(81)
DCL VAR(&POS) TYPE(*DEC) LEN(3 0)
DCL VAR(&MSG) TYPE(*CHAR) LEN(3)
CHGVAR VAR(&TEST) VALUE(&STRING *TCAT '~~')
CALL PGM(QCLSCAN) PARM(&TEST X'081F' X'001F' '~~' +
X'002F' '0' '0' ' ' &POS)
CHGVAR VAR(&POS) VALUE(&POS - 1)
CHGVAR VAR(&MSG) VALUE(&POS)
SNDMSG MSG(&MSG) TOUSR(*REQUESTER)
ENDPGM
Note, that in the example you will have to call the program via a command or
pad out the string parameter otherwise the issue with CL parameters greater
than 32 characters arises:
CMD PROMPT('Test CL Scan')
PARM KWD(STRING) TYPE(*CHAR) LEN(80)
All the best
Jonathan
www.astradyne-uk.com
-----Original message-----
From: "Gregory A. Garner" ggarner_gds@xxxxxxxxxxxxxx
Date: Sun, 6 Mar 2005 15:06:11 +0000
To: "Midrange Systems Technical Discussion" midrange-l@xxxxxxxxxxxx
Subject: RE: Any way in the CL program to find the length of the character
datastored in a variable?
> Isn't the problem with QCLSCAN that you cannot test for a multiple word
> variable? When you see the first blank the scan stops and the result is
> invalid.
>
> -----Original Message-----
> From: midrange-l-bounces@xxxxxxxxxxxx
> [mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Vernon Hamberg
> Sent: Sunday, March 06, 2005 1:19 AM
> To: Midrange Systems Technical Discussion
> Subject: Re: Any way in the CL program to find the length of the
> character datastored in a variable?
>
>
> This is interesting - which really is the bigger hit on performance. I
> think it depends. Using %SST in a loop could very likely take more time
> than a single call to a program that uses a more efficient loop - probably
> in some way that uses pointers and doesn't need to resolve the %SST for
> each test character. I can see that a 256-character variable that has only
> the 1st 3 characters filled would take longer with %SST than with a call to
> QCLSCAN. But it probably does not matter too much, unless this is repeated
> over several hundreds of thousands of records or values, say.
>
> Still, it would be an interesting test. Maybe I'll try it when I have some
> time.
>
> Vern
>
> At 10:43 AM 3/5/2005, you wrote:
> >Here's the V5R2 link:
> >
> >http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/apis/qclsc
> a
> >n.htm
> >
> >But I would use a substring method myself - no reason to call another
> >program and take the performance hit when you can do it in a loop with
> %SST.
> >
> >
> > > Siva
> > > <matchrefree@yaho
> > > o.com> To
> > > Sent by: Midrange Systems Technical
> > > midrange-l-bounce Discussion
> > > s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>
> > > cc
> > >
> > > 03/04/2005 11:26 Subject
> > > PM RE: Any way in the CL program to
> > > find the length of the character
> > > datastored in a variable?
> > > Please respond to
> > > Midrange Systems
> > > Technical
> > > Discussion
> > > <midrange-l@midra
> > > nge.com>
> > >
> > >
> > >
> > >
> > >
> > >
> > > Thanks Doug....
> > > Is it an API?... Wats the Parm list for this... Coudnt get any in my
> > > manuals...
> > >
> > > Thanks
> > > Siva.
> > >
> > >
> > > Doug Hart <DougHart@xxxxxxxxxxxx> wrote:
> > >
> > > QCLSCAN
> > >
> > >
> > > ---
> > > Doug Hart
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: midrange-l-bounces@xxxxxxxxxxxx
> > > [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Siva
> > > Sent: Friday, March 04, 2005 11:02 PM
> > > To: MIDRANGE-L@xxxxxxxxxxxx
> > > Subject: Any way in the CL program to find the length of the character
> > > datastored in a variable?
> > >
> > >
> > > Is there any way in the CL program to find the length of the character
> data
> > > stored in a variable?
> > >
> > > I find there is no direct CL command to acheive this... may be some
> > > roundabout way there to do this... but nothing striking at this
> moment....
> > >
> > > i think of some prgm calls with the required variable as the parm and
> the
> > > receiviong prgm process the variable etc... but couldnt get any logic
> here
> > > :-)......
> > >
> > >
> > > Thanks
> > > Siva.
> >
> >--
> >This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> >To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> >To subscribe, unsubscribe, or change list options,
> >visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> >or email: MIDRANGE-L-request@xxxxxxxxxxxx
> >Before posting, please take a moment to review the archives
> >at http://archive.midrange.com/midrange-l.
>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
> --
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
>
Jonathan Mason
www.astradyne-uk.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.