Sequential File

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
martin
Participant
Posts: 67
Joined: Fri Jul 30, 2004 7:19 am
Location: NewJersy

Sequential File

Post by martin »

Hi Guys,

I am sourcing data from Sybase and dumping to Sequential File, But end of the data in one field is Poping-up in next Row.
Guys any solution.

7460 D05357 2 INH 20051017 20051021 20051024 WILLN MICHAEL PETERS,ERNIE WESTON CONCEPT AND FEASIBILITY HONG K 04-000
7461 D911241 10 INH 19921216 19921216 19930526 TRANSFER M. PARKER CASTLEAF PILOT
PLANT"
7462 D911251 10 INH 19920114 19920114 19930526 TRANSFER M. PARKER CASTLEAF PILOT
PLANT"
7463 D911287 10 INH 19920114 19920114 19930526 TRANSFER M. PARKER CASTLEAF PILOT PLANT


Thanks
Martin
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the quote character in the Sybase data? Change the Format tab of your Sequential File stage so that " is not the quote character - maybe set the quote character to 000 (no quotes).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

One of your Sybase columns u are pulling is a VarChar field and it has a carriage return in it. U may have to write a small basic routine to convert it.

Bindu Madhav
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

U can build a FUNCTION like this and call it in ur transformer:

Code: Select all

i=1
   Len1=Len(Arg1)+1
   loop while(i<Len1)
   str1 = Iconv(Arg1[i,1],"MY")
   if(str1 NE '0D') Then
     Arg1[i,1] = Oconv(str1,"MY")
   End Else
     Arg1[i,1] = Oconv("20","MY")
     i=i+1
     Arg1[i,1] = Oconv("20", "MY")
   End
   i=i+1
   repeat
   Ans = Arg1[code]
[/code]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why are you reinventing the wheel? And why are you trying to use C constructs unnecessarily in DataStage BASIC?

Code: Select all

Convert(Char(13), " ", InLink.TheString)
does what your routine does, but much more efficiently.

If Char(13) were the initial value of a stage variable that remained unchanged, then the even more efficient expression

Code: Select all

Convert(svChar13, " ", InLink.TheString)
could be used.

It might be necessary to specify in the Format tab of the Sequential File stage that particular columns might contain line terminators.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
martin
Participant
Posts: 67
Joined: Fri Jul 30, 2004 7:19 am
Location: NewJersy

Post by martin »

Hi Ray,

I did exactly the way you explained , but all the Carriage Return are NULL.
Any Idea.

Thanks
Martin
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

For giggles, put an OCONV(inlink.col, "MCP") derivation on your problematic column to convert all non-printable characters to a ".". That will make sure your issue is not any high-character. Does that change the problem row?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
martin
Participant
Posts: 67
Joined: Fri Jul 30, 2004 7:19 am
Location: NewJersy

Post by martin »

Hi Kcbland,

Perfect.....Its working :lol:

Thanks
Martin
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Yeah, well, you've now got a "." in your data. So your issue is high characters, maybe not necessarily a CR/LF, maybe a TAB. You're going to need to write a routine to strip all non-printables and change them to something you desire.

If you just want them removed, the CONVERT statement can serve you well. There's this post going on right now:

viewtopic.php?t=96128

that will serve you well. I posted a functions logic to pick out the high characters of your choice and replace with a "*". In your case, your replacement string should just be "" if you want the characters removed.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
martin
Participant
Posts: 67
Joined: Fri Jul 30, 2004 7:19 am
Location: NewJersy

Post by martin »

Hi Kcbland,

EREPLACE(OCONV(inlink.col, "MCP"),".",' ')

Worked in my Situation.

Thanks
Srini
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Okay, but you do realize any existing "." will also be removed?
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
martin
Participant
Posts: 67
Joined: Fri Jul 30, 2004 7:19 am
Location: NewJersy

Post by martin »

Yah...... Its Comments Field, Replacing '.' to ' ' is fine.
Post Reply