ASCII format showing some low characters

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

DSkkk wrote:Hi Sam..
There is one possible reason for the Low values. When u put a varchar field into a Char(N) Field, then EE Stage by default appends the remaning length with Lower values.
Kiran.
Hi Kiran,

My source fields are not only VARCHAR but also integer and others and this logic will not work if it is integer.

Thanks
Sam
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What if you view the file from unix using vi <filename> or
cat -e <filename>?
Are the dots comming up?
Was your requirement to convert space into to null charcters?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

kumar_s wrote:What if you view the file from unix using vi <filename> or
cat -e <filename>?
Are the dots comming up?
Was your requirement to convert space into to null charcters?
Hi Kumar

When i am doing the cat -e <filename>, i am getting ^@ symbols.I need to convert this to space.

Thanks
Sam
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Post by seanc217 »

You can try something like this in the derivation field of a transformer. This works for me.

convert(char(0):char(1):char(2):char(3):char(4):char(5):char(6):char(7):char(8):char(9):char(10):char(11):char(12):char(13):char(14):char(15):char(16):char(17):char(18):char(19):char(20):char(21):char(22):char(23):char(24):char(25):char(26):char(27):char(28):char(29):char(30):char(31),' ',DSLink2.YOUR_FIELD_GOES_HERE)

I had the same problem so I took all the unprintable low values and converted them to spaces.

HTH
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

seanc217 wrote: I had the same problem so I took all the unprintable low values and converted them to spaces.
HTH
Hi sean

Initially i thought so but after kumar's suggestion i think the culprit is ^@ symbol.

Thanks
Sam
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Then do this

Code: Select all

convert(char(094):char(064),"",DSLink2.YOUR_FIELD_GOES_HERE) 
char(094) = ^
char(064) = @
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

on second thought ^@ is control character for NULL. Convert null to some value like space.
You know what, easiest way. Perform a sed operation on it and replace the nulls with a pipe instead of a space so that you can actually see that it did get converted.
Something like

Code: Select all


sed 's/\x00/|/g' file > newfile


OR better yet. Take your original file which has all the unprintable characters and apply this command to it

Code: Select all

sed 's/.$/ /' file > newfile
Got that from a previous post. But the sed command there just gets rid of all the non-printable characters. But the command above has been tweaked to replace the non-printable characters with a space.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

^@ is a representation of 0x00 (the ASCII NUL character). You could trim these, you could set APT_PAD_CHARACTER to space (" "), you could pre-process with sed or awk as DSGuru2B suggests.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply