Copy character data

When you copy data, you must ensure that the buffers are an adequate size to hold the data. If the destination buffer is not large enough for the multibyte data in the source buffer, the data might be truncated during the copy.

For example, the following HCL OneDB™ ESQL/C code fragment copies the multibyte data A1A2A3B1B2B3 from buf1 to buf2:
char buf1[20], buf2[5];
...
stcopy("A1A2A3B1B2B3", buf1);
...
stcopy(buf1, buf2);

Because buf2 is not large enough to hold the multibyte string, the copy truncates the string to A1A2A3B1B2. To prevent this situation, ensure that the multibyte string fits into a buffer before the HCL OneDB ESQL/C program performs the copy.