Page 1 of 1

Getting less spaces in viewing the data from seqfile

Posted: Fri Aug 06, 2010 6:48 am
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

Re: Getting less spaces in viewing the data from seqfile

Posted: Fri Aug 06, 2010 6:50 am
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?

Re: Getting less spaces in viewing the data from seqfile

Posted: Fri Aug 06, 2010 7:01 am
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

Posted: Fri Aug 06, 2010 7:10 am
by Sainath.Srinivasan
Is there any filter property in the filename ?

Posted: Fri Aug 06, 2010 7:12 am
by PhilHibbs
Are you sure that they are spaces in the source data?

Posted: Fri Aug 06, 2010 7:15 am
by sultan@cts
PhilHibbs wrote:Are you sure that they are spaces in the source data?
yes...

Posted: Fri Aug 06, 2010 7:15 am
by sultan@cts
Sainath.Srinivasan wrote:Is there any filter property in the filename ?
nope

Posted: Fri Aug 06, 2010 7:30 am
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

Posted: Fri Aug 06, 2010 7:34 am
by ArndW
I think that "cat -v" will show the problem, as HariK has suggested.

Posted: Mon Aug 09, 2010 5:05 am
by Sainath.Srinivasan
Is it coming from a complex flat file ?

Posted: Mon Aug 09, 2010 5:13 am
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).

Posted: Tue Aug 10, 2010 1:43 am
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.

Posted: Tue Aug 10, 2010 2:26 am
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.

Posted: Wed Aug 11, 2010 10:39 pm
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.