How to handle þ character in a field in a sequential file

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

Post Reply
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

First of all you need to find out if it is an ASCII character or not. If you cannot find it, try hexadecimal value or octal value of the character. If you find one of them use a tr function in the source stage and replace this character with something else. And in the transformer stage use this as the delimiter. I am assuming it is a sequential file stage.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Think Field function in PX takes only ASCII characters as delimiters. Did you find the hex or octal value for this character. Never got a chance to work on sever jobs :( . So don't know what @FM does. Anyways i had a similar problem. This is the link to the post. I tried converting the character in transformer, but never worked. Finally settled for tr command in unix.

viewtopic.php?t=113640
Ronetlds
Participant
Posts: 28
Joined: Thu Mar 30, 2006 12:48 pm

Post by Ronetlds »

Decimal 254
Hex FE
Octal 376
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

How you parse the field depends upon what you wish to do with the sub-values. Do you want to 'raise' them to separate fields? In that case, an external command such as UNIX tr might be easiest.
But if there are variable numbers of value in this sub-field then that method isn't optimal. You can get the number of values using FIELD(In.Field3,CHAR(254)) or the single distinct values using FIELD(In.Field3,CHAR(254),{subfield number}) in both server and PX/EE jobs.
dohertys
Participant
Posts: 39
Joined: Thu Oct 11, 2007 3:26 am
Location: Sheffield

Post by dohertys »

Thanks all,

so ...I've put a filter of 'tr '\376' '|' onto my sequential file stage

and then used the 'Field' function with a delimiter of '|' to split the field up in a transformer stage.

This should be ok in server and px.
Post Reply