Invalid Character \0 Null

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
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Invalid Character \0 Null

Post by imfarhan »

Dear All
I'm generating the CSV file the column have got Postcode field as a last colum/field.Where the file have No Postcode or have three char of the 1st and 2nd Part of the Postcode like "GU1" 4LM it generate the NUL or escape_char i.e. \0 or NUL at the end of the row as shown below: the invalid char shown on Notpadd++ or TextPad

Code: Select all

 10,123456,19710101,,,,SMITH,,ABC,,1,,,,,,GU1 4LM[color=red]NUL[/color]
 10,123477,19800101,,,, XYZN,,LMN,,1,,,,,,E12 7DJNUL
10,123456,19710101,,,,SMITH,,ABC,,1,,,,,,GU1 4LMNUL
10,123477,19800101,,,, XYZN,,LMN,,1,,,,,,E12 7DJNUL

when I open the generated CSV file it show space or \0 or nul(col=0) character at the end of the row (Can be see on Notepad++ by switch on the CharachterMode on

How can I strip them at the end of the rows I also trying to use SED command on "AFter Job routine" like sed 's/[,\t]*$//'" but not much helpful. Appreciate you help

Is there any function I can use on Transformer?
Kind regards,
Farhan
Farhan Syed
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My guess is that your Postcode field is defined as Char data type and that the value of APT_STRING_PADCHAR in your project is 0x00 (which pads Char fields with NUL characters). Quick fix is to change APT_STRING_PADCHAR to the space character or to 0x20 (equivalent). Otherwise you can explicitly pad the Postcode field in a derivation expression.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
imfarhan
Participant
Posts: 53
Joined: Tue Jul 24, 2012 9:34 am

Post by imfarhan »

Thanks Ray ..
You have spotted the problem. I've found one the Transformer Control in the stream kept the CHAR instead of VARCHAR that's why its was showing \esacpe character \0.

When I change to VARCHAR its fixes the problem.
Many thanks for your support

Have a good weekend
F
Farhan Syed
Post Reply