Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


My input has a unique column-id with the values 10,20,30.....how can i get first record in one o/p file,last record in another o/p file and rest of the records in 3rd o/p file?

Answers were Sorted based on User's Feedback



My input has a unique column-id with the values 10,20,30.....how can i get first record in one o/p f..

Answer / subhash

We can do in this way as well:

In the same job,
SeqFile--->Target1
SeqFile--->Target2
SeqFile--->Target3
for Target1,
add Filter condition in the SeqFile as below:
Head -1

for Target2,
add Filter condition in the SeqFile as below:
Tail -1

for Target3,
add Filter condition in the SeqFile as below:
sed '1,$ d'

Is This Answer Correct ?    8 Yes 2 No

My input has a unique column-id with the values 10,20,30.....how can i get first record in one o/p f..

Answer / kumar

As you have a single text file as Source. Use folloowing
approach to get the desired output.

Head1 Target1

Seq. File Copy Tail2 Target2

Head3 Tail Target3
Steps:
1.> Read your source file using sequential file stage.
2.> Pass the records to copy stage and take 3 output link.
3.> 1 to Head stage head1, 2nd to Head2 and 3rd to Head3.
4.> In the 1st Head Stage Head1, in the properties specify
1, it will pick up the 1st record and make that record to
target 1.

5.> Similarly, to capture last record in target2, in Tail
stage property mention 1. It will take last record and pass
it to target2.

6.> To load rest records 1st using head stage, capture top
records say, if u have 10 records in the source pick top 9
records using head stage then use tail stage followed by
head stage and mention 8, it will pick all records except
1st one. then u can load these to target3.

If u get confused ask me ....

Thanks
Kumar

Is This Answer Correct ?    8 Yes 4 No

Post New Answer

More Data Stage Interview Questions

Sequential file i have one record,i want 100 records in target?How can we do that?Pls explain me and what stages are there?What logic?

1 Answers   TCS,


What are constraints and derivations?

0 Answers  


tab1 tab2 1,a 1,d 2,b 3,c perfoms outerjoin what is the o/p? write sql query for outerjoin?

3 Answers   Infotech,


How to read multiple files using a single datastage job if files have the same metadata?

0 Answers  


Hi friends If anybody completed datastage 8.5 certification.Could please guide me what are the topics new in 8.5 certification.

2 Answers  


How to clean the datastage repository?

0 Answers  


disign the complex job in u r project?(they are aksing only complex job design and then data flow...)

0 Answers  


Hi , Today 1000 records updated, tomorrow 500 records updated how to find that?

4 Answers   Wipro,


source file having the data like aabbccc, i want target file result like a1a2b1b2c1c2c3.

2 Answers  


How u implement the slowly changing dimensions if my source table is consisting of cid,cname,add,phno,email but i need to capture the changes for first three columns how u implement?

1 Answers   IBM,


hi i am madan, in real time data stage who is the source provide? and how to recevied in developer? Pls send me answer 

1 Answers   HCL,


Why do we use exception activity in Datastage?

0 Answers  


Categories