15 UNICODENUMBER PIC S9(11)V9(04) USAGE NATIONAL SIGN IS LEADING, SEPARATE.
The sysLib.convertUnicodeNumToNumber() system function converts the digits of a source variable that contains UNICODE characters that are preceded by a UNICODE sign character into a numeric variable. The source can contain leading zeros for the integer part and can include trailing zeros for the fractional part.
sysLib.convertUnicodeNumToNumber(
source UNICODE in,
target SMALLINT | INT | BIGINT | DECIMAL out] )
n SMALLINT;
u UNICODE(4) = "1234";
// function gets validation error
// u must have length of 6
convertUnicodeNumToNumber(u, n);
n BIGINT;
u UNICODE(20) = "-0000000001234567890";
// function sets n to -1234567890
convertUnicodeNumToNumber(u, n);
n DECIMAL(31,4);
u UNICODE(32) = "+1234567890123456789012345678901";
// function sets n to 123456789012345678901234567.8901
convertUnicodeNumToNumber(u, n);
// Next line gets validation error for COBOL
// NUM variables are limited to length 31 for COBOL
n NUM(32,4);
u UNICODE(33) = "+012345678901234567890123456789012";
// for Java, function sets n to
// 1234567890123456789012345678.9012
convertUnicodeNumToNumber(u, n);
n DECIMAL(8,4);
u UNICODE(10) = "0123456789";
// function throws TypeConversionException
// "0" not valid sign character
convertUnicodeNumToNumber(u, n);
| Platform | Issue |
|---|---|
| JavaScript generation | The function sysLib.convertUnicodeNumToNumber() is not supported |