Filtering top and bottom records from 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
atulghate
Participant
Posts: 10
Joined: Sat Jul 09, 2005 8:28 am

Filtering top and bottom records from sequential file.

Post by atulghate »

I have a file with below construct..

set schema abc
select field1, field2 from table xyz;
field1 field2
------ ------
100 abcd
101 abcd
111 mnop

3 record(s) selected

<EOF>


I have managed to use this file with removing first 3 and few bottom rows and just putting data in file manually.
Is there a way by which i can handle this in datastage itself.

Any help, suggestion would be much appreciated.

Thanks
Atul
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Why would you want to do it in DataStage? A UNIX script would be more appropriate (and can be executed from DS if need be)
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
You could also use the filter command to be a sequential file's input and use a head and tail combination to do the same.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
kerensho
Participant
Posts: 13
Joined: Mon Jul 11, 2005 5:36 am

Post by kerensho »

Hello atulghate,

you can use the before job subroutine as Roy said.
if you do not want to use Unix commands at all thoug, you can read the file as a 1 column file (a large varchar) and then by transformer and constraints to filer out only the rows you want.

yours,
Keren
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can use DS to extract the rows from the dbms rather than landing in a seq file.
atulghate
Participant
Posts: 10
Joined: Sat Jul 09, 2005 8:28 am

Post by atulghate »

Thanks for all responces, scripting in before helped.
Post Reply