String Width - Worth Checking? Functions Available?

Searched before posting, but can’t find anything on checking string width before operations. I am trying to improve my error handling capabilities and have been running into “string width too short” type errors from time to time. Granted, this is usually caused by me not allocating enough width in the variable, and there’s not much to do at run time, but I figured no harm in asking

GetStringLength is a command in PAC Control. Is that what you are asking about?

But that only returns the current size of the string, not it’s maximum possible number of characters, correct?

If you want to check the capacity of a string variable, I don’t think there is any function for that.

A subroutine can be made to test for it by appending a large string (1024 chars) to the variable and then checking the length, but that will create truncation messages in the event log. You could also use the pack functions in a loop to test for the length of a string, but that could have performance implications.

Thanks Phillip yes, that is what I thought the situation was, just wanted some independent party such as yourself to confirm I’m not missing anything obvious :slight_smile: I’m content to just be more stringent when coding!