I have a source like file it have Number of records and i want to load without first and last records in target?Datastage?

Answers were Sorted based on User's Feedback



I have a source like file it have Number of records and i want to load without first and last record..

Answer / shivam

For this we can use Head and tail stages from development
and debug stages. Suppose we have 10 records,And we are
asked to pick 2nd to 9th record in the output, then go for
the following:
Sequential file--->Head stage--->Tail stage---->Data set

In the Head stage properties mention the number of records
you want to extract 9 records, this way you will get 1st to
9th records(top 9) extracted. Now, in Tail stage properties
mention number of records to extract 8, this way you get
last 8 records out of top 9 i.e 2nd to 9th. Finally as an
output you will find records 1st and 10th dropped.

Is This Answer Correct ?    7 Yes 1 No

I have a source like file it have Number of records and i want to load without first and last record..

Answer / prasad

In seq file, we have filter option (datastage)

filter= sed '1d;$d'

In Unix= sed '1d;$d' File_Name

it will remove header and footer records(quotes must and should)

Is This Answer Correct ?    3 Yes 0 No

I have a source like file it have Number of records and i want to load without first and last record..

Answer / srinu

using external filter
in this we use command sed -n '1d,
$d'(this is unix command we use we get answer)
(or)
we use command tail +2 |sed -n '$d'

Is This Answer Correct ?    6 Yes 4 No

I have a source like file it have Number of records and i want to load without first and last record..

Answer / prabhu

we use seq file
in that stage properties->options->filter in that SED'2,$!P' FILENMAE
IT ISWORKING

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More Data Stage Interview Questions

i have 3 diffrent tables. 1) US rate data 2)CANADA rate data and 3)MEXICO rate data. All 3 tables have 6 collumns each. 4 collumns are commun to all tables and 2 are diffrent. Now at target i want single table say Country rate which will have (4+2+2+2+1 flag) 11 collumns. I will add a flag collumn which will indicate country and will put nullable collumns which are not common to other. How i can implement this in datastage?

1 Answers   ABC,


Main Function of the Staging area in DWH ?

2 Answers  


5) A file contains 10 (1-10) I want trgt like Trgt 1 trgt 2 trgt 3 1 2 3 4 5 6 7 8 9 10

4 Answers  


1. How many People are part of your Team? 2. Explain how you create jobs or flow of project? 3. Join Stage vs Lookup vs Merge Stage 4. Summation scenario based question - How you find sum of salary for a specific employee (Explain stages and flow of job)? 5. Explain Remove duplicates stage ? Can you do sort in this stage? 6. SQL Questions - Joins - Types, Difference between Join and Union 7. Unix Questions - How you run the Job, How you list all jobs in project 8. Explain Environmental Variables? 9. SQL Scenario - If you have 3 Identical record in a Table, Ex: 1, Ram, Xyz; 1, Ram, Xyz; 1, Ram, Xyz; Delete only 2 of the records and keep only 1 using the Delete query. How you will you do this?

1 Answers  


What is usage analysis in datastage?

0 Answers  






This is UNIX question asked in DataStage Interview. Say I have n numbers of records in a text file. I want first 3 records in 1st file, last three records in 3rd file and remaining n-6 records in 2nd file. (Note: we don't know how many records are there in the File. I am getting one file on daily basis and I want three target files as asked above)

2 Answers   CTS,


How to display errors in datastage?

1 Answers   TCS,


How to convert RGB Value to Hexadecimal values in datastage?

0 Answers  


how do you pass parameters in a script?

1 Answers   L&T,


What is the Main difference between Lookup Failure and Lookup Not Met? Plz explain with Example.

2 Answers  


Hi All , in PX Job I have passed 4 Parameters and when i run the same job in sequence i dont want to use those parameters , is this possible if yes then how

0 Answers   TCS,


how to clear the source file? 2) diff b/t odbc & Oracle?what is node? 3) explain one complex job u face in ur project

2 Answers   Wipro,


Categories