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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different options associated with dsjob command?

1082


How complex jobs are implemented in datstage to improve performance?

693


root tree will find which is server job and which is parallel job?

1537


A signal has a wavelength of 1 micro min in air.how far can the front of the wave travel during 1000periods?

2136


what should be ensure to run the sequence job so that if its get aborted in 10th job before 9job should get succeeded?

1043






why do u need the IOS upgradation in a FC switch

1959


How do y read Sequential file from job control?

14753


What is the difference between datastage and datastage tx?

692


What are the components of datastage?

745


What is the flow of loading data into fact & dimensional tables?

689


Can you explain players in datastage?

818


How to Remove Duplicate using SQL?

950


i have a job with 3 possibiliies finish with ststus ok abbort warning how do you handle these 3 in job sequence? explain the situation where you have appiled scd in your project? chandu

2378


Which commands are used to import and export the datastage jobs?

1088


how can we create rank using datastage?what is the meaning of rank?

8300