|
Hello Jeff,
I am being passed a parameter that is defined as 120A. I'm trying to find the length of it. using length = %LEN(%TRIM(Parm1)); However, length always get's returned as 120.
Sounds like the 32-byte problem to me. Is the parameter coming from a literal in a CL program? Or a SBMJOB? or the command line? or QCMDEXC/QCAPCMD/system? If so, you'll have problems with parameters that are more than 32 bytes long.
The result is that you're getting garbage characters (possibly unprintable ones) in your parameter string, and they're being counted as part of the length.
Read the FAQ for more info: http://faq.midrange.com/index.pl?file=70Incidentally, your code looks okay, except that I'd use %TRIMR() instead of %TRIM. It's quicker to trim from only one end of the string, and normally when a blank occurs at the left side, you want it to count.
So, use Length = %len(%trimr(parm1)) after you've fixed the 32-byte problem.
--- Scott Klement http://www.scottklement.com
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.