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

What is the difference between hashfile and sequential file?

0 Answers  


What are data elements?

0 Answers  


Define oconv () and iconv () functions in datastage?

0 Answers  


How to Convert a string function to date function by using only sequential file stage with out using other stages ?

5 Answers   TCS,


my source seq file have col1 1 2 3 4 5 6 7 8 9 i have 4 targets t1 t2 t3 t4 1 2 3 4 5 6 7 8 9 like this how we can get?

10 Answers   Polaris,






In a table 100 records are there after 50records job is aborted how can u insert all records in target table.

1 Answers   Cap Gemini,


convert yyyy mm dd to dd mm yyyy?

4 Answers  


can we see the data in fixed width file? how can u change the datatype of fixed width files?

1 Answers   Infosys,


I have 100 records how can I load at a time from the single time

1 Answers  


WHAT ARE THE COMMON ERRORS IN DATA STAGE?

6 Answers   IBM, ME,


Define APT_CONFIG in Datastage?

0 Answers  


Hi This is Vijay, How can your remove the duplicates in sequential File?

15 Answers   HCL, Scope International,


Categories