| Note: Built-In Function Rules Usage Options |
This Built-In Function converts a text string from one encoding to another.
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Req | String to be converted. | 1 | Unlimited | 0 | 0 |
2 | N | Req | To code page. | 1 | 5 | 0 | 0 |
3 | N | Opt | From code page. Default: code page of the current job. | 1 | 5 | 0 | 0 |
No | Type | Req/ Opt | Description | Min Len | Max Len | Min Dec | Max Dec |
|---|---|---|---|---|---|---|---|
1 | A | Req | Converted string returned. | 1 | Unlimited | 0 | 0 |
2 | A | Opt | Return code. OK = conversion completed. ER = An error occurred. | 2 | 2 | 0 |
This BIF is intended for IBM i use. The IBM i translation table for the 'from code' to the 'to code" page must exist. If the table does not exist, the returned string will be the same as for the argument string.
If this Built-In Function is executed in Visual LANSA for Windows, no conversion will be done. The returned string will be the same as the argument string.
FUNCTION OPTIONS(*DIRECT)
DEFINE FIELD(#RETCOD) TYPE(*CHAR) LENGTH(2)
DEFINE FIELD(#tocode) TYPE(*DEC) LENGTH(5) DECIMALS(0)
DEFINE FIELD(#fromcode) TYPE(*DEC) LENGTH(5) DECIMALS(0)
DEFINE FIELD(#String1) TYPE(*CHAR) LENGTH(256) INPUT_ATR(LC) DEFAULT('convert this line')
DEFINE FIELD(#string2) TYPE(*CHAR) LENGTH(256) INPUT_ATR(LC)
REQUEST FIELDS(#string1 #tocode #fromcode)
USE BUILTIN(convert_string) WITH_ARGS(#string1 #tocode #fromcode) TO_GET(#string2 #RETCOD)
DISPLAY FIELDS((#RETCOD) (#string2))