In RDMLX, easy, just
#LEN := #STR.CurChars
But in RDML it’s not so easy and for some reason there’s not even a buit-in function to return the length of a string.
So I made this:
Define Field(#W_C256) Type(*CHAR) Length(256) Define Field(#W_C256_B) Type(*CHAR) Length(256) Define Field(#W_C1) Type(*CHAR) Length(1) Define Field(#W_D3_0) Type(*DEC) Length(3) Decimals(0) Subroutine Name(LENGTH) Parms((#W_C256 *RECEIVED) (#W_D3_0 *RETURNED)) Use Builtin(RIGHT) With_Args(#W_C256) To_Get(#W_C256_B) Substring Field(#W_C256_B 256 1) Into_Field(#W_C1) Use Builtin(REVERSE) With_Args(#W_C256) To_Get(#W_C256_B) Use Builtin(SCANSTRING) With_Args(#W_C256_B #W_C1) To_Get(#W_D3_0) Change Field(#W_D3_0) To('(256 + 1) - #W_D3_0') Endroutine
which I then include when necessary.