Is there any easy way to directly return the length of character and type variable in RPGLE? The length I am talking about here is not the length specified in the D-spec. I am talking about the actual number of meaningful characters in a string. Let's say a character type variable is defined to be 50 characters long, and it is assigned with value 'Hello world!', then the length I want is 12, which is from 'H' to '!'. The leading and trailing blank is ignored. Is there any simple way to do this?
You can use %len(%trimr(field))
, which trims trailing spaces before checking the length.
%triml
trims leading spaces (on the left)%trimr
trims trailing spaces (on the right)%trim
trims leading and trailing spacesIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With