Reading CSV file, check no of columns in each row

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
esivaprasad
Participant
Posts: 135
Joined: Tue Dec 09, 2008 10:35 am

Reading CSV file, check no of columns in each row

Post by esivaprasad »

Hi,
My requirement is
Reading CSV file,next check the number of columns in each record in CSV file = 3 or not?

Input :
1 2 3
A b c d e 6
1 2 3 4
E T L
1 2 3

Required files as

column count in record= 3
Output :
1 2 3
E T L
1 2 3

Create error file ,column count in records <> 3 into error file

Error file as :
A b c d e 6
1 2 3 4

please help me how to design to complete this requirement task.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Read the file as a single long string and count the delimiters. The column import stage can then process the good ones, if needed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply