Getting less spaces in viewing the data from seqfile

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
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Getting less spaces in viewing the data from seqfile

Post by sultan@cts »

Hi,

We are getting one space less in the middle of a string when viewing the data through seqfile, but the same data when viewd in unix is showing correct.

data is of type varchar(50)
ex:
in seqfile : "GATEWAY NEW BUSINESSxx14.9"
( spaces are shown as x)
while viewing from unix : "GATEWAY NEW BUSINESSxxx14.9

Thanks,
Sultan
Thanks
Sultan
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Re: Getting less spaces in viewing the data from seqfile

Post by ArndW »

Code: Select all

data is of type varchar(50)
ex:
in seqfile : "GATEWAY NEW BUSINESS	 14.9"
while viewing from unix : "GATEWAY NEW BUSINESS   14.9
(I used code mark so that the spaces display)

What tool are you using to "view" the data? If you read the file in DataStage and output a LEN(In.String) is the correct lenght displayed?
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Re: Getting less spaces in viewing the data from seqfile

Post by sultan@cts »

ArndW wrote:

Code: Select all

data is of type varchar(50)
ex:
in seqfile : "GATEWAY NEW BUSINESS	 14.9"
while viewing from unix : "GATEWAY NEW BUSINESS   14.9
(I used code mark so that the spaces display)

What tool are you using to "view" the data? If you read the file in DataStage and output a LEN(In.String) is the correct lenght displayed?
We are viewing the data from datastage seqfiles (View Data). Also loaded the data in to a table and found the length...it is giving one byte less
Thanks
Sultan
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Is there any filter property in the filename ?
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

Are you sure that they are spaces in the source data?
Phil Hibbs | Capgemini
Technical Consultant
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Post by sultan@cts »

PhilHibbs wrote:Are you sure that they are spaces in the source data?
yes...
Thanks
Sultan
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Post by sultan@cts »

Sainath.Srinivasan wrote:Is there any filter property in the filename ?
nope
Thanks
Sultan
HariK
Participant
Posts: 68
Joined: Thu May 17, 2007 1:50 am

Post by HariK »

can you check if there are any hidden characters in file on UNIX.

cat -v filename

also check character count on the file to see if it matches with the length you foun from DataStage
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I think that "cat -v" will show the problem, as HariK has suggested.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Is it coming from a complex flat file ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

do a hex or octal dump of the file data (use "od" or a similar tool). I am certain that one of those spaces is not like the others (the not-so-subtle reference is intended).
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Post by sultan@cts »

ArndW wrote:do a hex or octal dump of the file data (use "od" or a similar tool). I am certain that one of those spaces is not like the others (the not-so-subtle reference is intended).
We have converted these data to hex with the help of od -x, then only we posted here.

From unix its given as 3 spaces , in hex its like 202020(space =20 in hex).
From View data in Datastage its like 0920(tab=09 in hex).

Its considering the first space as tab when viwed from DS seq file.
Thanks
Sultan
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The "view data" in DataStage has always caused problems, particularly in NLS installations, because it does its own interpretation of data and can display differently. In your case, please put an output stage after your source stage that just writes this one column into a flat file, then use "od -x" to see if the spaces are actually present or if there is now a tab in the string. If the spaces remain then you have discovered a problem in "view data" but your program should be unaffected; if there is a TAB now in your string then I would look at your sequential file settings, particularly for the default values of the input columns.
sultan@cts
Participant
Posts: 31
Joined: Thu Jul 05, 2007 11:57 pm
Location: India
Contact:

Post by sultan@cts »

ArndW wrote: In your case, please put an output stage after your source stage that just writes this one column into a flat file, then use "od -x" to see if the spaces are actually present or if there is now a tab in the string. If the spaces remain then you have discovered a problem in "view data" but your program should be unaffected; if there is a TAB now in your string then I would look at your sequential file settings, particularly for the default values of the input columns.
I have loaded the one coulmn to a flat file, now also TAB is there.There are no default values assigned for this field in source stage while reading.

Actually the source file which we are using was creted from the unload script,which unloads from the db2 database table. i have tried to create this file throgh a simple datastage job and now this issue is resolved.

Thanks to all who looked into this issue.
Thanks
Sultan
Post Reply