|
This would be an issue for what I am doing.
Some of the values will be MLMD, MLDM and MLD.
So scanning for a value of MLD may give a false positive.
With the very simple example shown, the issue of a
false-positive is easily overcome by coding the selection to the actual
size; i.e. as 4-byte elements, a 3-byte value would be searched as the
blank-padded value. So if in the above example the elements are
four-characters each, then when the element 'MLD␢' ["␢" represents the
blank-pad] is desired, then actually code the scalar to locate that value
*with the blank included\mandatory*; e.g. as coded here, using the CHAR
casting scalar, to avoid any issues with visibility of a blank:
stringAsArrayOf4byteElems='MLMDMLDMMLD MORE'
; -- align under 2nd arg/* ...4...8..12..16 */
exec sql set intVariable =
locate( CHAR('MLD', 4), :stringAsArrayOf4byteElems)
; -- result: intVariable=9 /* The desired effect */
exec sql set intVariable =
locate( 'MLD' ), :stringAsArrayOf4byteElems)
; -- result: intVariable=5 /* Undesirable effect */
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.