convertNumberToUnsignedUnicodeNum()

This function provides EGL support for COBOL variables in unsigned format, as a complement to sysLib.convertNumberToUnicodeNum().

The sysLib.convertNumberToUnsignedUnicodeNum() system function converts the absolute value of the digits of a source numeric value into UNICODE characters without a UNICODE sign character. Leading zeros are included for the integer part, trailing zeros are included for the fractional part, and no decimal character is included.

The length of the UNICODE variable must be appropriate for the length of the numeric value. For a table that lists the necessary lengths of UNICODE variables, see Required lengths for UNICODE number conversions.

Syntax

  sysLib.convertNumberToUnsignedUnicodeNum(
    source SMALLINT | INT | BIGINT | DECIMAL | BIN | NUM in,
    target UNICODE out] )
source
Any non-floating point numeric variable.
target
A UNICODE variable.

Examples

  n1 SMALLINT = 1234;
  u1 UNICODE(4);
  // function gets validation error 
  // u1 must have length of 5
  convertNumberToUnsignedUnicodeNum(n1, u1);
  
  n2 SMALLINT = 1234;
  u2 UNICODE(5);
  // function sets u2 to "01234"
  convertNumberToUnsignedUnicodeNum(n2, u2);

  n3 INT = 123456789;
  u3 UNICODE(10);
  // function sets u3 to
  // "0123456789"
  convertNumberToUnsignedUnicodeNum(n3, u3);

  n4 BIGINT = -1234567890;
  u4 UNICODE(19);
  // function sets u4 to
  // "0000000001234567890"
  convertNumberToUnsignedUnicodeNum(n4, u4);

  n5 BIN(18, 9) = -123456.1234;
  u5 UNICODE(19);
  // function sets u5 to
  // "0000123456123400000"
  convertNumberToUnsignedUnicodeNum(n5, u5);

  n6 DECIMAL(31, 4) = 123456789012345678901234567.8901;
  u6 UNICODE(31);
  // function sets u6 to
  // "1234567890123456789012345678901"
  convertNumberToUnsignedUnicodeNum(n6, u6);

  // Next line gets validation error for COBOL
  // NUM variables are limited to length 31 for COBOL
  n7 NUM(32, 4) = 1234567890123456789012345678.9012;
  u7 UNICODE(32);
  // for Java, function sets u7 to
  // "12345678901234567890123456789012"
  convertNumberToUnsignedUnicodeNum(n7, u7);

Compatibility considerations

Table 1. Compatibility considerations
Platform Issue
JavaScript generation The function strLib.convertNumberToUnsignedUnicodeNum() is not supported.

Feedback