|
daparnin wrote:
Is it possible to trim leading and/or trailing blanks from strings in CLP or CLLE programs? I've got a legacy CLP program that builds string to do the selection of an open query file. It's a this or that test and I'm trying to build another string to concatenate into the middle of it with a more complex condition. I don't have a problem with the logic, just formatting the string to remove excessive blanks. Is this possible?
Dave:
Trimming leading blanks requires a little programming; however, the programming can be as simple as binding to the sscanf() API in the QC2LE binding directory and calling it with a format string of:
' %s'
Also, in a pinch, the RTVMSG command can be used with a MsgId of CPF9897 (or your own similar message description) to return the "right-trim" length of a *CHAR variable. It doesn't technically 'trim' the message-data string for you, but the MSGLEN() that is returned is the length of the significant left-most characters.
It's not necessary to actually return the MSG() parameter value. Just return the length, which might even be greater than 132. Use it to control the %SST() that you extract.
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.