comma delimeted files

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
kkreddy
Participant
Posts: 28
Joined: Tue May 10, 2005 6:00 am

comma delimeted files

Post by kkreddy »

hi guru's
i have a senerio where in the ", " delimeted seq file ,inside the column contains "," like
001,ravi,kumar,98
002,ramkumar,34

could u please let me know is there any whay to solve this
Thanks in advance

KKReddy
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Re: comma delimeted files

Post by loveojha2 »

Read a whole line as a single column, you can achieve this with having 000 as the quote character and 010 as the delimiter. Now process this single column according to the requirement.
kkreddy wrote:hi guru's
i have a senerio where in the ", " delimeted seq file ,inside the column contains "," like
001,ravi,kumar,98
002,ramkumar,34

could u please let me know is there any whay to solve this
Thanks in advance

KKReddy
Success consists of getting up just one more time than you fall.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Its not easy even with a single column, since you are not sure of the field boundaries.
Success consists of getting up just one more time than you fall.
kcshankar
Charter Member
Charter Member
Posts: 91
Joined: Mon Jan 10, 2005 2:06 am

Post by kcshankar »

Hi,

Is your source file have similar pattern,ie delimiter variation is only in the second/string field.

Code: Select all

001,ravi,kumar,98 
002,ramkumar,34 
Assuming u want output to be like this below,
001,ravikumar,98
002,ramkumar,34

Define ur source file with 000 delimiter -single Column.

Declare StageVariable to hold the count of ","
DCount (string, delimiter)


For 1st record
Use Field ("Source"string, ",", 1)

For Last Record
Use Field ("Source"string, ",", (StageVariable))


For 2nd record
Trim((Iconv("Source", "MC/N")),",""A")


Regards
kcs
Post Reply