This document is to address frequently asked questions on the business function X00500C - ConvertNumericValueToWordsSingap (Convert Numeric Value To Words Singapore). It explains how Business Function X00500C is functioning and what is the expected result. It also addresses why this business function sometimes fails to convert a certain numeric value to words.
Contents of Notes:
Why X00500C is unable to convert certain value to words and how to overcome this issue?
Issue: X00500C is not able to convert the input value 1,889,999.93 but able to convert 1,889,999.94
For "Example 2", though ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND NINE HUNDRED NINETY NINE AND NINETY THREE CENTS ***** is smaller than 100 characters in size, X00500C is still not able to convert it to words.
Resolution: To overcome this issue, set value '3' for item #3. 'Literal Amount Lines' of Print Format tab for the Processing Option of R04572SG.
Below table is to show the output for two input values 1,889,999.93 and 1,889,999.94:-
In printing words for input numeric value 1,889,999.93
Item#3 PO Value Set to |
Words Output | Ln |
---|---|---|
3 | 1st Row: ONE MILLION EIGHT HUNDRED EIGHTY NIGHT THOUSAND 2nd Row: NINE HUNDRED NINETY NINE AND NINETY THREE 3rd Row: CENTS********************************************* One Line: ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND NINE HUNDRED NINETY NINE AND NINETY THREE CENTS ***** |
46 41 50 100 |
2 | 1st row: $1,889,999.93************************************* One Line: $1,889,999.93************************************* |
50 50 |
Input Numeric Value 1,889,999.94
Item#3 PO Value Set to |
Words Output | Ln |
---|---|---|
3 | 1st Row: ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND 2nd Row: NINE HUNDRED NINETY NINE AND NINETY FOUR CENTS**** 3rd Row: ************************************************** One Line: ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND NINE HUNDRED NINETY NINE AND NINETY FOUR CENTS ****** |
46 50 50 100 |
2 | 1st Row: ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND 2nd Row: NINE HUNDRED NINETY NINE AND NINETY FOUR CENTS**** One Line: ONE MILLION EIGHT HUNDRED EIGHTY NINE THOUSAND NINE HUNDRED NINETY NINE AND NINETY FOUR CENTS ****** |
46 50 100 |
Implementation: Value 1,889,999.93 is handled as below,
For each 100th position of the input value, it is handled in the following manner:
The reason X00500C handles (Example #1) "NINE HUNDRED NINETY NINE AND NINETY FOUR " but not (Example #2) "NINE HUNDRED NINETY NINE AND NINETY THREE " is that
else if(nWorkFieldLength > (MIDDLE_LINE_LENGTH - MAX_SIZEOF_SINGLE_WORD) &&
(IsStringBlank(szMiddle) != 0) )
{
jdeStripTrailingBlanks(szWorkVar);
jdeStrncpy(szMiddle, szWorkVar, MIDDLE_LINE_LENGTH);
nTooLarge = jdeStrcmp(szWorkVar, szMiddle);
memset ((void *)(szWorkVar), (int)(_J('\0')), sizeof(szWorkVar));
}
What is maximum input value allowed?
The maximum value is a Hundred Billion that is 999,999,999,999.99 with 3 lines printing
How to use Business Function X00500C?
Below are simple explanation how X00500C is working,
A. Data Structure - D0400555 Convert Numbers to Words - Singapore
Parameter | IN OUT |
DD Alias |
Others |
---|---|---|---|
mnAmountField | IN | AA | Dollar Value |
szTopLine[51] | OUT | DL010 | |
szMiddleLine[51] | OUT | DL010 | |
szBottomLine[51] | OUT | DL010 | |
szOneLineCompleteString[101] | OUT | DL011 | This value is the output of the complete string of all 3 lines of output (szTopLine[51] + szMiddleLine[51] + szBottomLine[51]) |
B. Global Variable Definition (for X00500C only)
Variable Name | Size | Detail |
---|---|---|
CONVERT_NUMBER_MAX_LENGTH_SINGAPORE | 100 | This value should match the one-line length -1 |
TOP_LINE_LENGTH | 50 | Length of top line |
MIDDLE_LINE_LENGTH | 50 | Length of middle line |
BOTTOM_LINE_LENGTH | 50 | Length of bottom line |
WORK_VARIABLE_LENGTH | 61 | Used in the internal parse functions to prevent word truncation |
MAX_SIZEOF_SINGLE_WORD | 9 | Should be set no lower than 9 e.g., THOUSAND |
In case the purpose of implementing this business function is not to print cheque but to describe dollar value in Words then make use of parameters mnAmountField (IN) and szOneLineCompleteString (OUT).
Does the Business Function X00500C handle Negative figures?
No. Since this function is to support print check/cheque routine, which does not have negative figure/amount implementation.
A possible workaround is that the calling program/report passes the absolute value of the amount to X00500C, then the word "MINUS" can be added in front of the output string
Is there possible way to print the output words in a single string for huge figure?
In case you want to have the output words in a single string, then you may make use of the business function ConvertNumericValueToWords (X00500, Numeric Value, Convert to Words).
From <Bug 10918080> : X00500 AND CHECKS OVER 1 MILLI - SAR: 8009325, it mentions that that this business function can handle a total output string length of 83 including "AND 99/100". If the string length of the amount that has been converted into words are exceeding the length of 83 characters, it will be printed as numeric values. If it is not exceeding the specific length the total amount will be converted properly into words and it will also be printed in the check.
For instance,