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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

source is .c3 files-to convert amounts in format "s9(7)v99" 1

Status
Not open for further replies.

srvu

Programmer
Apr 29, 2008
49
US
I have source as .c3 files,in that we have amounts column where data in that is in format"s9(7)v99"
and sample data is as below
Amount- 00799{00000{
hint is given as below
Values are formatted using COBOL "signed overpunch" codes
and link given is overpunch

What transformation & logic to be used to convert these into amount ??
kindly help
 
If it's as straight-forward as the link states, then you can look at the last character and change that to the proper one using a decode function. You will also need to pick up the sign from that. Note that this format has an implied decimal point before the last two digits.

Your example doesn't seem to fit the format. The leading s means there could be a sign, then there should be 7 digits before the implied decimal point and two more after. The '9' usually means a digit is required, but I could be wrong.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
format S9999999v99 signed overpunch,in my requirement it is given so
and they have given a link
to use this link & convert

What logic is to be followed to convert
here is an example data
"00000085A" so we have several different values like this
"00000799{"
so we cannot know which value is coming while we use it in transformation.
These values are given under Amount field
so,how each n every sign be converted,it will be of great help if you can provide the logic

Thanks in Advance
 
You will need a number of variables to do this.
variable name - type - expression:
last_char_v - string - substr(amount,9,1)
sign_v - integer - iif(instr('{ABCDEFGHI') > 0,last_char_v),1,-1)
last_char_converted_v - string - decode(last_char_v,'}',0,'J',1,'K',2,... (fill in the rest from the table in the link),'I',9)
new_amount_v - double - sign_v*to_float(substr(amount,1,7)) + to_float(substr(amount,8,1))*.1 + to_float(last_char_converted_v)*.01


"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Thank you so much for the logic

You have done a great help for me

 
How about showing your appreciation with a star!

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
sorry that i forgot to give star yesterday

I have given it today

once again Thanks for your help
 
:)

No problem. It was a good challenge.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Can we Implement Mapplet for this logic,i haven't used mapplet before.

So, there are many amount fields like dedamt,totamt,lifetimeamt etc for all those fields we should convert signed over punch values

Can it be implemented using mapplet or should we proceed to
with converting each fiels using above logic
 
Yes, you can use a mapplet. Or a shared transformation. Either should do the trick. Then just copy it in so you have one for every field you want to convert.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top