Converting hex to char
Moderators: chulett, rschirm, roy
Converting hex to char
Hi,
Need to write to a flat file where first two characters of each record should be char version of a hexadecimal value. i.e. '4F44' is should show as 'OD' in output file.
Could you please suggest how to convert Hex value to Char
regards,
Satish
Need to write to a flat file where first two characters of each record should be char version of a hexadecimal value. i.e. '4F44' is should show as 'OD' in output file.
Could you please suggest how to convert Hex value to Char
regards,
Satish
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
One can do it in PX, but not as easily. Take a look at this thread
-
- Premium Member
- Posts: 12
- Joined: Thu Jul 30, 2009 1:33 am
- Location: Melbourne
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can see the entirety of my entry (it's short enough not to be affected by the premium size cutoff) and it IS a parallel solution.
Last edited by ray.wurlod on Thu Jul 30, 2009 8:13 pm, edited 1 time in total.
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.
-
- Premium Member
- Posts: 12
- Joined: Thu Jul 30, 2009 1:33 am
- Location: Melbourne
While my premium membership is still under review...
Found this solution in unix:
hexchar="FF"
octchar=$(echo "ibase=16;obase=8;$hexchar"|bc)
hexInChar=$(echo "\0$octchar")
Could you please suggest how to embed this code in DS job.
Via oracle char code could be found by:
select HEXTORAW(hex) as value from hextable;
Found this solution in unix:
hexchar="FF"
octchar=$(echo "ibase=16;obase=8;$hexchar"|bc)
hexInChar=$(echo "\0$octchar")
Could you please suggest how to embed this code in DS job.
Via oracle char code could be found by:
select HEXTORAW(hex) as value from hextable;
Thanks for all the suggestions.
Using server job was certainly a simple and good option; however, had issues with converting values like 8A, which are not standard ascii values. DS was generating '?' where unix was generating a wierd symbol sililar to 'g'
Workaround: running the unix script after the ds job to change hex to char codes
Using server job was certainly a simple and good option; however, had issues with converting values like 8A, which are not standard ascii values. DS was generating '?' where unix was generating a wierd symbol sililar to 'g'
Workaround: running the unix script after the ds job to change hex to char codes
Converting hex to char
hi,
i convert the hexadecimal value 0D0A to charapter with the constant X'0D0A'.
Bye
i convert the hexadecimal value 0D0A to charapter with the constant X'0D0A'.
Bye
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: