Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSIS string conversion 2012

Status
Not open for further replies.

activejunkie

Programmer
Jul 16, 2014
2
US
Hi,
I have a requirement where from a string we need to derive the amount and also based on the alphabet we need to make it negative or positive amount. Here is the string
'1047383658000012345678990000002014083J354310020140850000005335R0000'
In this string '0000005335R' is the amount with 2 decimals 000000533.5R
We need to decode A = 1, B= 2 till I = 9 and J = 1 with negative values till S = 9(negative)
so the final output in this string should be:
if the string is '1047383658000012345678990000002014083J354310020140850000005335A0000'
output should be 533.51
if the string is '1047383658000012345678990000002014083J354310020140850000005335S0000'
output should be -533.59

I need expert help on this asap.

Thanks.
 
looks like Mainframe cobol signed (and S - 9 looks wrong by the way as R = 9)
following link has the possible values, respective replacement number and multiplier.

Easy enough for you to pass the string through a c# convert script within your dataflow, split the string in your components and apply the logic to the right most character.
something like
nibble = right(mystr,1)
num = left(mystr,len(mystr) - 1)
sign = "+"
case
when nibble = A
then num2 = 1
...
when nibble = J
then num2 = 1
sign = "-"
...

final_num = sign + num + num2

Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top