Hi,

Please tell me how to solve this scenario in datastage ?

Here we have 3 columns in a table TEST

CODE,ENTRY DATE and BATCH

The table looks like

CODE ENTRYDATE BATCH
100 100716 1
100 100716 1
100 100716 1
200 122517 2
200 122517 2
302 555555 8
302 555555 8
302 555555 8

We need to create a seqno on grouping these 3 columns.

The result should be like this.

CODE ENTRYDATE BATCH SEQNO
100 100716 1 1
100 100716 1 2
100 100716 1 3
200 122517 2 1
200 122517 2 2
302 555555 8 1
302 555555 8 2
302 555555 8 3



Hi, Please tell me how to solve this scenario in datastage ? Here we have 3 columns in a table..

Answer / raj

The only solution I can get readily is using stage variables in a transformer. In order to achieve this I need to define 3 stage variables to map them to input columns. Another 3 stage variables to store the previous value. Another 3 variables to compare the values. A total of 9 stage variables are needed.

To reduce the number of stage variables, lets us checksum stage

A checksum stage generates a unique value with the given columns as input.

We supply these three columns as input and generate unique values for each combination and then use that value for comparison in the transformer

Transformer:
Stage Variable:

Checksum -> Sv1
Sv2 -> Sv1
if Sv1=Sv2 then Sv3+1 else 1 -> Sv3

Sv3 -> SEQNO

We get the desired output

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Stage Interview Questions

if a column contains data like ram,rakesh,madhan,suraj,pradeep,bhaskar then I want to place names separated by commas in another columns how can we do?

2 Answers   IBM,


when u face critical situation in ur project, how to solve them?

1 Answers   Toyota,


i hav source like this . deptno,sal 1,2000 2,3000 3,4000 1,2300 4,5000 5,1100 i want target like this target1 1,2000 3,4000 4,5000 target2 2,3000 1,2300 5,1100 with out using transformer

2 Answers  


1)How to do error handling in datastage? 2)Did sequential stage accepts .xl files ,xml? znd how?

2 Answers   UHG,


What is difference between join, merge and lookup stage?

0 Answers  






diff between changecapture & diffrence stage which situvation we can use the diffrence stage ?

1 Answers   TCS,


A flatfile contains 200 records.I want to load first 50 records at first time running the job,second 50 records at second time running and so on,how u can develop the job?pls give the steps?pls pls

7 Answers   TCS,


Which type of joins Merge stage can support?

7 Answers   IBM,


How can we run same job in 1 day 2 times

7 Answers   IBM,


i want job aborted after some records are loaded into output by using only sequential stage and dataset

1 Answers   IBM,


How one source columns or rows to be loaded in to two different tables?

0 Answers  


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,


Categories