KKFCUT: Truncating a String

How to:

If your configuration uses a DBCS code page, you can use the KKFCUT function to truncate a string.


Top of page

x
Syntax: How to Truncate a String
KKFCUT(length, source_string, output)

where:

length

Integer

Is the length of the source string in bytes. The string can have a mixture of DBCS and SBCS characters. Therefore, the number of bytes represents the maximum number of characters possible in the source string.

source_string

Alphanumeric

Is the string that will be truncated.

output

Alphanumeric

The string will be truncated to the number of bytes in the output field.



Example: Truncating a String

In the following, KKFCUT truncates the COUNTRY field (up to 10 bytes long) to A4 format:

COUNTRY_CUT/A4 = KKFCUT(10, COUNTRY, 'A4');

The output in ASCII environments is shown in the following image:

The output in EBCDIC environments is shown in the following image:


iWay Software