| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |
Robelle Sponsor Message

May 2003

Get the most out of your Robelle Tools

New $Number Function in Suprtool

By Neil Armstrong

Suprtool now has the ability to accept free-form “numbers” as display data types. This means that numbers in the form:


can now be accepted and converted to any other numeric data type.

Consider the following data:

Item-number New-Price
12345 + 123.45
34563 + 27.5
21312 + 1.545

Suprtool can now read and convert the data in New-Price using the $number function. Let’s say we want New-Price to be a double integer and currently occupies eight bytes starting in position six.

Here is the task you would use to convert the New-Price free-format number into a double integer.

>in mynums
>def item-number,1,5,byte
>def new-price-ascii,6,8,display
>def new-price,1,4,double
>item new-price-ascii,dec,2
>item new-price,dec,2
>ext item-number
>ext new-price=$number(new-price-ascii)
>out somefile,link

The $number function takes the free-format number and makes it into a valid display-type number. It will determine the decimal, sign and add leading zeroes. It will round the number to the defined number of decimal places.
In the case of 1.545 number, Suprtool will round the value to be 1.55, since the given number of decimal places is two and the preceding value is five or greater. If you have a whole number such as 54, with no decimal point the value becomes 54.00.

Suprtool will reject data that has:

• More than one sign.
• More than one decimal point.
• Spaces in between numbers.
• Signs in between numbers.
• Characters that are not overpunch characters.
• Fields that when edited do not fit in the defined space for the display field.

You can control the character that defines the currency, thousand and decimal symbol for other currencies and formats using the following commands:

>set decimalsymbol “.”
>set thousandsymbol “,”
>set currencysymbol “$”

Suprtool in the above case will strip the currency and thousand symbols and use the decimal symbol to determine the number of decimal places. You can set these characters to any values you want but the defaults for each are used in the above set commands. The decimal and thousand symbols are only single characters. The currency symbol allows up to four characters.


Copyright The 3000 NewsWire. All rights reserved.