Page 1 of 1

How do i get fisrt and last rows in windows environment

Posted: Wed Mar 22, 2006 6:26 pm
by reddy
Hi Guys,

Good evening.
I need to get first and last record from input file having millions of rows.
In unix i know the command Head but here i am using Windows O/S.
Can you please give me suggestions.

Thanks in advance.
Reddy

Posted: Wed Mar 22, 2006 7:38 pm
by ray.wurlod
There isn't one. Write your own, or get a "UNIX on Windows" (such as MKS Toolkit or CygWin) and use the UNIX commands.

Posted: Wed Mar 22, 2006 10:36 pm
by rasi
Reddy

As Ray said "Write your Own" its easy.

Create a job in datastage itself to read a sequential file and in constraint have @INROWNUM =1 to one link. This will create the first record in the output file. Have another link directed to Aggregator and use the LAST option to write the last record to the next link. This will produce the last record.

The only draw back it is sequential and has to scan the entire file.

Thanks

Posted: Thu Mar 23, 2006 9:38 am
by shepli
:) If you use Aggregator, you can use both the FIRST and the LAST options.