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 / 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 |
Why we use parameters instead of hard code in datastage.
what is the main difference between sorragate key n primary key in one word
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?
col1 123 abc 234 def jkl 768 opq 567 789 but i want two targetss target1 contains only numeric values and target2 contains only alphabet values like trg1 123 234 768 567 789 trg2 abc def jkl opq
What are routines in datastage?
in source is like seq file in date column have dd-mm-yy dddd-mmmm-yyyy mm-dd-yy yy-dd-mm yy-mm-dd i want to display only yy-dd-mm date formats only in tgt?
What is the difference between account and directory options ?
hi everbody, i have a problem in my project.. Native Error Code: -407 "Assignment of a null value to a not null column" hi everbody, i have a problem in my project.. Native Error Code: -407 "Assignment of a null value to a not null column" i have no idea, what should i do..please help :(
what is advantages of snowflake when it is used?
Define meta stage?
1)What is configuration your file structure 2)I have two databases both are Oracle while loading data from source to target the job takes 30 min but I want to load less time how?
how to export or import the jobs in .ISX file