Issues Loading csv file into a Oracle Database

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
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Issues Loading csv file into a Oracle Database

Post by sashah »

I have a datastage job that loads a csv file into an Oracle Database. The csv file has some disclosure text at the bottom which prevents the file from being loaded. Is there a way I can filter out this unwanted text while loading the data.

Thank you
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Define unwanted data? What is the error message that you are getting?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

The error message is required column is missing. The reason I am getting this is because I have mapped the sequential file columns with the columns in the oracle table.

In the CSV file I have **DISCLOSURE** text in one of the columns at the end of file and nothing in the other columns. I want to filter these rows.

Thank you
DSguru2B wrote:Define unwanted data? What is the error message that you are getting?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

In the sequential file stage, activate filter command and put the following in the filter command box

Code: Select all

sed '$d'
This will delete the last line before the stage even starts reading it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

Thank you. Another question I have is how would I delete all the lines below the Disclosure text.
DSguru2B wrote:In the sequential file stage, activate filter command and put the following in the filter command box

Code: Select all

sed '$d'
This will delete the last line before the stage even starts reading it.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

With a more appropriate sed or awk script, of course. Might be time to invest some effort in learning these tools.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I believe the following should work. Test it out before you stick to it.

Code: Select all

sed '/**DISCLOSURE**/;/^*$/d'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sashah
Participant
Posts: 37
Joined: Thu May 10, 2007 3:02 pm

Post by sashah »

Thank you. I will try it.
DSguru2B wrote:I believe the following should work. Test it out before you stick to it.

Code: Select all

sed '/**DISCLOSURE**/;/^*$/d'
Post Reply