In my project we are using flat files to interface with external systems.
In the interface layout specification, there are certain columns with an implied decimal&sign which need to be mapped to a decimal(10,2) field in DB2 using an ODBC stage.
I am not sure how to handle implied decimal fields so I was thinking of just dividing by 100 and then pasing the result but then I tried using the 'DataTypePic9V99' transform and it worked.
But now I need to do the reverse i.e. possibly export some fields which are of type DECIMAL(10,2) to a sequential file in an implied decimal format and am unsure how to do it and of what length it can potentially be (10 or 12) including the sign and implies decimal.
thanks in advance,
paul
Env: DS 7 on AIX
source: flat files, SQL Server, DB2
target: flat files, DB2
implied decimals
Moderators: chulett, rschirm, roy
Hi,
Decimal(10,2) means 8 digits number and 2 digits after the decimal point so if you do a * 100 you get decimal(10,0) at most.
In any case you can use the decimal(12,2) if needed to comply with both situations.
IHTH,
Decimal(10,2) means 8 digits number and 2 digits after the decimal point so if you do a * 100 you get decimal(10,0) at most.
In any case you can use the decimal(12,2) if needed to comply with both situations.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
![Image](http://www.worldcommunitygrid.org/images/logo.gif)
Why dont you just multiply by 100 and write out to a CHAR field I assume what you want to do is
Look at the FMT function
Code: Select all
Input = 12345.67 Output = 1234567
Code: Select all
Fmt (string, format)
Thank you for all your replies.
One more question is how does the sign come into play here? Will I need an extra character?
I am tempted to just re-define the layout for the flat file to day that the field a_amount is of type char(12) with one extra char for the sign and one for the decimal point but that will be a waste if it is not needed.
One more question is how does the sign come into play here? Will I need an extra character?
I am tempted to just re-define the layout for the flat file to day that the field a_amount is of type char(12) with one extra char for the sign and one for the decimal point but that will be a waste if it is not needed.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Iconv(string, "MD2") will generate the "implied decimal place" you require.
Read about MD conversions in on-line help or in the BASIC manual.
Remember, also, that there is only one data type in a text file: text. So you can use substringing and other techniques where appropriate.
Read about MD conversions in on-line help or in the BASIC manual.
Remember, also, that there is only one data type in a text file: text. So you can use substringing and other techniques where appropriate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.