Control characters(Junk chars) in flat files from SQL server

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
sethuraman
Participant
Posts: 8
Joined: Tue Jan 12, 2010 10:34 pm
Location: Chennai

Control characters(Junk chars) in flat files from SQL server

Post by sethuraman »

Hi,

I just extract data from a SQL server table (MS SQL) and write it in a flat file.

My job design is

ODBC Conn ---> CPY ---> SeqFile


I have 50 columns in it. after successful run, I get some control characters in the file like ^C or ^R. Be it Fixed width or Delimited, the file is not getting created with given no. of columns or in given length. No clue what could be the issue.

Please help it out.

Regards,
Sethuraman.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Check whetehr the control charcater is already there in database itself,
How you are viewing sequential file>? inside datastage or unix?
pandeeswaran
sethuraman
Participant
Posts: 8
Joined: Tue Jan 12, 2010 10:34 pm
Location: Chennai

Post by sethuraman »

Hi, I have checked in the DB, no control characters found over there. i am viewing the file in Unix, VI editor mode.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

What you are getting if you use

Code: Select all

cat filename
The control chars are at the end of the line or some where else?
How you have configured the Sequential file stage?
Whats the delimter you have specified?
pandeeswaran
sethuraman
Participant
Posts: 8
Joined: Tue Jan 12, 2010 10:34 pm
Location: Chennai

Post by sethuraman »

if i use cat <file name> then i find no control characters. but if i open it in vi <file name> mode then it appears in front of few fields. I create file in Fixedwith mode. also i have tried creating comma seperated delimited file. nothing returns the exact output.
Thanks & Regards,
Sethuraman Rajendran,
SE - ISDC,
Renault-Nissan Technology and Business Centre India Private Limited,
Chennai – 603002,
Sethuraman.Rajendran@rntbci.com,
+91-9994304880 | + 91-44-67482128.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

It will be great if you post sample data what you are getting while using vi
pandeeswaran
sethuraman
Participant
Posts: 8
Joined: Tue Jan 12, 2010 10:34 pm
Location: Chennai

Post by sethuraman »

pandeesh wrote:What you are getting if you use

Code: Select all

cat filename
The control chars are at the end of the line or some where else?
How you have configured the Sequential file stage?
Whats the delimter you have specified?


if i use cat <file name> then i find no control characters. but if i open it in vi <file name> mode then it appears in front of few fields. I create file in Fixedwith mode. also i have tried creating comma seperated delimited file. nothing returns the exact output.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

what is the value of APT_STRING_PADCHAR environment variable and what is the data type of the field where you see the junk characters?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
sethuraman
Participant
Posts: 8
Joined: Tue Jan 12, 2010 10:34 pm
Location: Chennai

Post by sethuraman »

priyadarshikunal wrote:what is the value of APT_STRING_PADCHAR environment variable and what is the data type of the field where you see the junk characters?


Value for the param APT_STRING_PADCHAR = 0x20.

I get the junk characters for all kind of datatypes like varchar, char, smallint.
Thanks & Regards,
Sethuraman Rajendran,
SE - ISDC,
Renault-Nissan Technology and Business Centre India Private Limited,
Chennai – 603002,
Sethuraman.Rajendran@rntbci.com,
+91-9994304880 | + 91-44-67482128.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

In anycase the smallint field should not have control characters, check the format options in seq file stage and check your extraction query as well if any kind of concatanation or padding is used.

BTW, which SQL Server version we are talking about here?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply