Page 1 of 1

Removing Last row from Input File

Posted: Tue Sep 04, 2007 2:59 am
by ketanshah123
Hi
If I want to remove the last row from my input file then how can I implement in DS server job?
I want to remove row at runtime.

Posted: Tue Sep 04, 2007 4:19 am
by JoshGeorge
If you have MKS Toolkit or similar installed you can try the below said.

To remove just the last line from your file 'at runtime' use this command in your filter option of sequential file satge:

Code: Select all

 sed -e '$d' 

Posted: Tue Sep 04, 2007 8:18 am
by kcbland
To have your job know the last row it needs to know how many rows are in the input file. Using a "wc -l" command (checkout CYG/Win or MKS Toolkit) you can pass the row count in and then use a simple constraint check.

Otherise, you'll have to be creative and use a SEQ-->AGG-->HASHed file portion of job design to read the sequential file, count() using the aggregator the number of rows and then write to a hashed file. Then a simple reference to the hashed file (pre-load to memory) and use of constraint in a transformer stage comparing the the @INROWNUM value to the referenced value and output when not the same will do the trick.