%STR (Get or Store Null-Terminated String)
%STR(basing pointer{: max-length})(right-hand-side)
%STR(basing pointer : max-length)(left-hand-side)
%STR is used to create or use null-terminated character strings, which are very commonly used in C and C++ applications.
The first parameter must be a basing-pointer value. (Any basing pointer expression is valid, such as "%ADDR(DATA)" or "P+1".) The second parameter, if specified, must be a numeric value with zero decimal positions. If not specified, it defaults to the maximum allowed length for defining a character variable.
The first parameter must point to storage that is at least as long as the length given by the second parameter.
Note:
The length operand for %STR always refers to the number of bytes.
Error conditions:
- If the length parameter is less than 1 or greater than the maximum length allowed, an error will occur.
- If the pointer is not set, an error will occur.
- If the storage addressed by the pointer is shorter than indicated
by the length parameter, either
- An error will occur
- Data corruption will occur.
For more information, see String Operations or Built-in Functions.