Convert from EBcDIC format to Decimal
I need convert values from EBCDIC format to SSIS. For example if i have values like
00007626{
00005043{
I need to convert this into currency format in SSIS. I m using script component in SSIS.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Add your code here
'
With Row
.ConvertedCharges = Ebcdic.ToDecimal(.Charges, 2)
End With
End Sub
End Class
I get the error saying " Name EBCDIC" is not defined. Can some one tell me how to resolve this issue.
May 26th, 2012 10:06am
Where did you get that code? I can't find EBCDIC anywhere in the .net framework. If you got it from a developer at your company then you probabally have a custom assembly that you need to get and then add to the references of your script
task and the Imports of your script.
If you have no custom assembly then you may need to follow the directions here to deal with your data:
http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/f6333f25-f913-4dcb-be36-a94e1d1433cf/
Chuck
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 10:13am
Couple other options here for writing functions to convert the BCD into int
http://stackoverflow.com/questions/2858202/how-to-convert-from-ebcdic-to-ascii-in-c-netChuck
May 26th, 2012 10:18am
I have used User defined function to convert from EBCDIC to Decimal. Thanks all.
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 10:41am
I got this code from one of my developer in previous company. Can you tell me how to have a custom assembly and how to add this to the references.
May 26th, 2012 10:43am
Not sure what you are asking. Did the developer give you the code for the Ebcdic object? Chuck Pedretti | Magenic North Region | magenic.com
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 10:47am
NO he didn't
May 26th, 2012 10:48am
NO he didn't
Then you are out of luck. There does not appear to be an ebcdic object in the .net framework anywhere so it must be a custom assembly. You need that custom assembly to use the code you posted in your first post.Chuck Pedretti | Magenic North Region | magenic.com
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 10:52am
I was able to get this using user defined function in sql. but i would like to know how would we create custom assembly for this object.
May 26th, 2012 11:01am
I was able to get this using user defined function in sql. but i would like to know how would we create custom assembly for this object.
If you have it as a udf in sql then why would you want a custom assembly? Since your source is not SQL, what I would do is take what the udf is doing and convert it to the equivilent c# code and use that directly in the script task. You don't want
to be making a DB call for each record to use the udf.
Chuck Pedretti | Magenic North Region | magenic.com
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 11:04am
Will have to do that. Thanks all for the suggestions.
May 26th, 2012 11:07am
You could also look at this component:
http://aminosoftware.com/lysine/ - although from my experience it doesn't handle some files well & is expensive and not terribly well supported, so try before you buy.
In my project we ended up preprocessing the file using a small hand coded app that converted to a more consumable text format, then importing the processed file into SSIS. Was less messy than burying the code in SSIS itself and made debugging easier.
Cheers, James
James Beresford @ www.bimonkey.com & @BI_Monkey
SSIS / MSBI Consultant in Sydney, Australia
SSIS ETL Execution Control and Management Framework @
SSIS ETL Framework on Codeplex
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2012 12:58am


