how to remove header and trailer from records.

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

hitmanthesilentassasin
Participant
Posts: 150
Joined: Tue Mar 13, 2007 1:17 am

Post by hitmanthesilentassasin »

try this in your filter option of either sequential file or cff.

Code: Select all

 sed '1d;$d' 
or

Code: Select all

 sed '/HDR/d; /TRL/d'
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Add a constraint to your transformer output links that prevents those rows from being output... something like:

InputLinkName.FirstColName[1,3] <> "HDR" and InputLinkName.FirstColname[1,3] <> "TRL"
Last edited by asorrell on Wed Mar 10, 2010 11:09 am, edited 2 times in total.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

hitmanthesilentassasin wrote:try this in your filter option of either sequential file or cff.

Code: Select all

 sed '1d;$d' 
or

Code: Select all

 sed '/HDR/d; /TRL/d'
Hi Hitman,

Can you please help me out ,in sequential file where i can define sed '/HDR/d; /TRL/d' to remove header and trailer .Please advice :(
hitmanthesilentassasin
Participant
Posts: 150
Joined: Tue Mar 13, 2007 1:17 am

Post by hitmanthesilentassasin »

you have to define that in the filter option of the sequential file stage.
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

hitmanthesilentassasin wrote:you have to define that in the filter option of the sequential file stage.
Hi HITMAN,

actually i will have two columns first column= filen name,second column=records detail.
i have to filter header and trailer from records column.
in my records column sample data will look like given above.
please advice
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you google the UNIX "sed" command, you'll see that changing the suggest command to

Code: Select all

sed '1,2d;$d' 
should do the trick.
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

ArndW wrote:If you google the UNIX "sed" command, you'll see that changing the suggest command to

Code: Select all

sed '1,2d;$d' 
should do the trick. ...
my datastage server is in window..can i use unix command in this ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Windows DataStage servers come with the MKS Toolkit, which also includes the 'sed' command.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Define your file metadata to match your "detail" records and the others will be filtered automagically, assuming their record layout is different enough to be rejected by the stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

chulett wrote:Define your file metadata to match your "detail" records and the others will be filtered automagically, assuming their record layout is different enough to be rejected by the stage. ...
Hi chulett,

i dont have any metadata.i have records in single column.
i am using sequential file as input.which will have two column.
1 column repreasent file name
2 column represent records of particular file.
from this colmun i have to remove header and trailer. :cry:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, simple enough, then just use a contraint to filter out any records where the first three characters in your big field are "HDR" or "TRL".
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

chulett wrote:OK, simple enough, then just use a contraint to filter out any records where the first three characters in your big field are "HDR" or "TRL". ...
Hi chulett,

please advice me .
i tried with dslink.column_name[1,3] <>'HDR' AND dslink.column_name[1,3] <>'TRL'.
as constraint.but its not working
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

<bzzzztttt> Sorry Andy, thanks for playing. :P

D'oh... where the heck did Andy go? Silly Wabbit.

Define 'not working', that looks perfectly fine to me. Are you sure you are checking the right 'column name'?
Last edited by chulett on Wed Mar 10, 2010 11:10 am, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Can you tell us HOW it isn't working? What happens?
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
kaushal.kumar@igate.com
Participant
Posts: 77
Joined: Tue Apr 14, 2009 4:03 am

Post by kaushal.kumar@igate.com »

chulett wrote:<bzzzztttt> Sorry Andy, thanks for playing. :P

D'oh... where the heck did Andy go? Silly Wabbit.

Define 'not working', that looks perfectly fine to me. Are you sure you are checking the right 'column name'?
yah,problem is i have records in single column.
which contain header ,details and trailer.
Post Reply