Reading input data from Sequential file

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
mydsworld
Participant
Posts: 321
Joined: Thu Sep 07, 2006 3:55 am

Reading input data from Sequential file

Post by mydsworld »

I need to read an input sequential file(.csv) after first 5 records.How do I skip those first 5 rows while reading the file.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have to read them, that's the nature of sequential media. You can skip them in the job using a constraint along the lines of:

Code: Select all

@INROWNUM > 5
-craig

"You can never have too many knives" -- Logan Nine Fingers
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

... or you can skip them in Unix using the 'tail' command as a filter on your sequential file stage:

Code: Select all

 tail +6
HTH,
J.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Make sure you run in sequential mode for craigs solution. If thats not what you want then provide the following filter command to restrict the first 5 rows at the sequential file stage itself.

Code: Select all

sed '1,5d'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the first five rows don't match the metadata of the remaining rows, you can get away with doing nothing, just allow the import to fail for these rows (though it will log a warning message). You can capture these import failures via a Reject link on the Sequential File stage, thus allowing your to reconcile the row counts.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply