Hi All
I had a Doubt in this, Kindly give me some thought process to resolve this
I had a flat file where it is having 1 column i had to load the data into target table/file , the validation that i had to check is that i had to compare the immdiate previous record against the current Value. What are the possible ways i can achive with in datastage Environment.
Ex :
Column 1
-----------
1
2
3
4
4
5
6
6
7
---------
for the first record i had to load it as it is to target , from second record on wards i had to check it against previous record, if it matches i had to reject the record.
Like 1, 2=1,3=2,4=3,4=4 i had to reject it
Expecting an valid support from the Group
Thanks in Advance
RK
Holding Previous Record Value
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 107
- Joined: Wed Sep 29, 2004 10:15 am
This is easily done by storing the value in a transform stage variable and then using that saved value for comparing the next record.
These two stage variables show how such a comparison could easily be done in a transform stage.
Code: Select all
ComparisonStageVar = In.CurrentRowColumnA > PreviousValue
PreviousValue = In.CurrentRowColumnA
-
- Participant
- Posts: 107
- Joined: Wed Sep 29, 2004 10:15 am
-
- Participant
- Posts: 107
- Joined: Wed Sep 29, 2004 10:15 am
Hi Andrew
Thanks for your prompt response
i had tested it and it is working fine
Added to this one more query
suppose if i want to populate my reject table , which ever the records had equal
like
Column1
-----------
1
2
3
4
4
5
6
6
7
-----------
In earlier case it is loading the data into target as below
Column1
----------
1
2
3
4
5
6
7
---------------
In Reject table it is loading as below
Column1
----------
4
6
----------
My Query is i doesn't want to populate the values 4,6 into the target table
my reject table will have to have these values
Column1
-----------
4
4
6
6
---------------
How Can i Proceed
Thanks alot and thanking you in advance
RK
Thanks for your prompt response
i had tested it and it is working fine
Added to this one more query
suppose if i want to populate my reject table , which ever the records had equal
like
Column1
-----------
1
2
3
4
4
5
6
6
7
-----------
In earlier case it is loading the data into target as below
Column1
----------
1
2
3
4
5
6
7
---------------
In Reject table it is loading as below
Column1
----------
4
6
----------
My Query is i doesn't want to populate the values 4,6 into the target table
my reject table will have to have these values
Column1
-----------
4
4
6
6
---------------
How Can i Proceed
Thanks alot and thanking you in advance
RK
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Not "Andrew", but "Arnd". Arnd W.
Your easiest solution is to insert all keys (Column 1 values) into an intermediate table (use a UV stage, re-creating the table). Then take two output links from this stage.
The one to the target has
The one to the rejects table has
Your easiest solution is to insert all keys (Column 1 values) into an intermediate table (use a UV stage, re-creating the table). Then take two output links from this stage.
The one to the target has
Code: Select all
SELECT Column1 FROM table GROUP BY Column1 HAVING Count(Column1) = 1;
Code: Select all
SELECT Column1 FROM table GROUP BY Column1 HAVING Count(Column1) > 1;
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.