|
PGM PARM(&TESTSTRING)
DCL VAR(&TESTSTRING) + TYPE(*CHAR) + LEN(50) DCL VAR(&STRING) + TYPE(*CHAR) + LEN(51) DCL VAR(&TRIMCHAR) + TYPE(*CHAR) + LEN(1) + VALUE(' ') DCL VAR(&TRIMLEN) + TYPE(*INT) + LEN(4) DCL VAR(&NULL) + TYPE(*CHAR) + LEN(1) + VALUE(x'00') DCL VAR(&TRIMLENC) + TYPE(*CHAR) + LEN(10)
ENDPGM
CRTPGM PGM(YOURLIB/TESTTRIML) BNDSRVPGM(QC2UTIL1)
to create the program.
(NOTE: Use any suitable debug or activation group parameters you want.)
In my test
call vern/testtriml 'This is a string'
resulted in the message
Of course, you could always build a command around the BIFs of RPGLE. ;-)
HTH Vern
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.