Skip to content

FN API

FN: Format Number (New)

This API call will allow the programmer to pass a numeric value in SCREEN-NUMERIC-FIELD. This field will be formatted based on type and maximum size provided, and the results will be passed back as follows:

·        SCREEN-ALPHA-FIELD will be formatted to the maximum width set in the call, rounded first to match the type, if necessary, and then re-rounded if any decimal places are removed to fit the width specified.  If the input value is too big even after removing all decimals, a value of all 9s will be returned.

·        SCREEN-NUMERIC-FIELD will contain the input value rounded, if applicable, to the internal number of decimals as specified in the input type (T, M, C or $).

If the reserved space is not enough to enter all numbers with the full decimals, then the system layer will first eliminate the “,” markers for 1000 separator, as necessary.  If that is still not enough, we will truncate  (and round) the most insignificant decimals.  The space on the screen and reports are valuable, so we don’t want to always reserve the maximum space in order to make it work in all cases.  Instead, we want to reserve a reasonable amount of space where it will display or print correctly 99.99% of the time.  In the 0.01% scenario, the insignificant decimals are rounded off so that the information presented in the limited space would not cause significant misleading.

Screen-Parameters: FN,mx,tp,B 

mx = the maximum width of the field to be returned.

t = T indicates this input field is a quantity field. The number of decimal places for the entry is determined based on the COMPANY-NO-OF-DECIMALS in the Company file. When t = T, p can have the following value:

p = “-“ means the field supports the minus sign in the last character of the maximum width to be returned.

p = “L“ means the field supports a leading minus sign instead of a trailing minus sign. This is used for CSV file support.

p = blank means no sign will be returned and the returned value will be right justified.

t = M indicates this input field is an accumulator field. The number of decimal places for the entry is determined based on the COMPANY-NO-OF-DECIMALS-ACCUM in the Company file. When t = M, p can have the following value:

p = “-“ means the field supports the minus sign in the last character of the maximum width to be returned.

p = “L“ means the field supports a leading minus sign instead of a trailing minus sign. This is used for CSV file support.

p = blank means no sign will be returned and the returned value will be right justified.

t = C indicates this input field is a cost field. The number of decimal places is determined based on the COMPANY-NO-OF-DECIMALS-COST in the Company file. When t = C, p can have the following value:

p = “-“ means the field supports the minus sign in the last character of the maximum width to be returned.

p = “L“ means the field supports a leading minus sign instead of a trailing minus sign. This is used for CSV file support.

p = blank means no sign will be returned and the returned value will be right justified.

t = $ indicates this input field is a price field. The number of decimal places is determined based on the COMPANY-NO-OF-DECIMALS-PRICE in the Company file. When t = $, p can have the following value:

p = “-“ means the field supports the minus sign in the last character of the maximum width to be returned.

p = “L“ means the field supports a leading minus sign instead of a trailing minus sign. This is used for CSV file support.

p = blank means no sign will be returned and the returned value will be right justified. 

B = Blank when zero

NOTE:  Type C for Cost: In versions 7.5 and 8.x of Elliott, there is not a value for Company-No-of-Decimals-Cost.  Therefore, we will default to 4 for the number of decimals for a Cost value.

Type $ for Price:  In versions  7.5 and 8.x of Elliott, there is not a value for Company-No-of-Decimals-Price.  Therefore we will default to 4 for the number of decimals for a Price value, unless the value of WS-NS5-UNIT-PRICE-2-DEC is “Y” – in that case we will use 2 for the number of Price decimals.

Examples: 

API Call

No. of Decimals

Passed Value

Return Value

1234567890123456

FN,12,T-

0

1000.000

      1,000

FN,12,TL

0

1000.000-

     -1,000

FN,12,T-

2

1000.000

  1,000.00

FN,13,$

5

1234567.12345

1234567.12345 (no commas)

FN,16,$

5

1234567.12345

 1,234,567.12345

FN,10,$

3

1234567.12456

1234567.12 (truncate/round decimals)

FN,10,$-

4

1234567.15234

1234567.2 (truncate/round decimals, leave room for sign)

FN,10,$-

4

1234567890.1234

999999999 (overflow)

FN,16,$

4

1234567.1234

  1,234,567.1234

FN,13,$

4

1234567.1234

1234,567.1234 (eliminate first comma)

 

Left or Right Alignment

The FN API always performs right alignment. On the other hand, the IN or DF API always performs left alignment.  

When you do printing, you need to perform right alignment.  Therefore, you will use the FN API.  

When you display a field on the screen, most of time, you want to do left alignment -- then you will use the IN or DF API.  When you need to do right alignment, then you will first use the FN API first to return the value to be displayed in SCREEN-ALPHA-FIELD, then follow by a DF call to display the SCREEN-ALPHA-FIELD.

CLS

Feedback and Knowledge Base