DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
duh_sk8erboi
Participant



Joined: 03 Dec 2005
Posts: 4

Points: 48

Post Posted: Tue Feb 28, 2006 7:38 pm Reply with quote    Back to top    

DataStage® Release: 7x
Job Type: Server
OS: Windows
Additional info: Generating a surrogate key for a key column:
Hello to all DS gurus

I'm new to DS & ETL development, but i'm quickly catching up & learning so many wonderful things about DS. I have come across a new challange, surrogate key assignment. how can one generate a new surrogate key for a column which is the key column in a transformer, which i used to extract data from a complex flat file & attempting to load to a oracle table.

Thanks in Advance

_________________
Adrianna D
rafidwh
Participant



Joined: 10 Oct 2005
Posts: 178

Points: 1474

Post Posted: Tue Feb 28, 2006 7:46 pm Reply with quote    Back to top    

HI,

Use the DS transform function "KeyMgtGetNextValue" in the surrogate key column in the transformer.

Saik
Rate this response:  
Not yet rated
duh_sk8erboi
Participant



Joined: 03 Dec 2005
Posts: 4

Points: 48

Post Posted: Tue Feb 28, 2006 7:54 pm Reply with quote    Back to top    

wow... so fast!! thanks saik. ok, so i use that DS function, but how i make it generate a number? do i have to write additional code for this function to make it generate the sgt key?? please advice

Thanks in Advance

_________________
Adrianna D
Rate this response:  
Not yet rated
rafidwh
Participant



Joined: 10 Oct 2005
Posts: 178

Points: 1474

Post Posted: Tue Feb 28, 2006 8:24 pm Reply with quote    Back to top    

Use the function in the surrogate key column in the derivation column

No need to write any code

Good luck Smile
Rate this response:  
Not yet rated
rasi
Participant

Group memberships:
Australia Usergroup

Joined: 25 Oct 2002
Posts: 464
Location: Australia, Sydney
Points: 2346

Post Posted: Tue Feb 28, 2006 8:31 pm Reply with quote    Back to top    

You need to pass in the unique name for which it gets the next surrogate key. The value is stored in hash file and you can always reset the value by updating the hash file

_________________
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Rate this response:  
Not yet rated
ram.m
Participant

Group memberships:
Server to Parallel Transition Group

Joined: 21 Feb 2006
Posts: 4
Location: Bangalore
Points: 15

Post Posted: Tue Feb 28, 2006 10:59 pm Reply with quote    Back to top    

duh_sk8erboi wrote:
Hello to all DS gurus

I'm new to DS & ETL development, but i'm quickly catching up & learning so many wonderful things about DS. I have come across a new challange, surrogate key assignment. how can one generate a new surrogate key for a column which is the key column in a transformer, which i used to extract data from a complex flat file & attempting to load to a oracle table.

Thanks in Advance


Hi,

by using KeyMgtGetNextval u can generate the sequence number in the transformer stage.

Thanks,
Ram

_________________
ram
Rate this response:  
duh_sk8erboi
Participant



Joined: 03 Dec 2005
Posts: 4

Points: 48

Post Posted: Wed Mar 01, 2006 8:01 pm Reply with quote    Back to top    

Alrite !!! Very Happy thanks guys. I was able to generate surrogate key values using the DS transform function 'KeyMgtNextValue'. for the unique sequence name, after a little experimenting, i was able to use a column name that was the key column and also use a '0' and a '1' in place of the '%sequencename%' and got the same result of generated surrogate key values from 1 to atleast 300+ values. can anyone explain as to why the result was the same when i used different sequence names??? Another concern i face is to generate a hierarchy level ID with respect to the level of detail in the grain for a dimension. how is this possible in DS while mapping columns in a transformer? please advice

Thanks in Advance

_________________
Adrianna D
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 28418
Location: Denver, CO
Points: 146801

Post Posted: Wed Mar 01, 2006 9:01 pm Reply with quote    Back to top    

People didn't give you much guidance in it's use, pretty much just said to use it - hence part of the confusion. I'm curious if you checked it out in the Manager - it lives under the Routines/sdk/KeyM ...

_________________
-craig

Sarchasm: The gulf between the author of sarcastic wit and the person who just doesn't get it.
Rate this response:  
Not yet rated
duh_sk8erboi
Participant



Joined: 03 Dec 2005
Posts: 4

Points: 48

Post Posted: Wed Mar 01, 2006 10:10 pm Reply with quote    Back to top    

Thanks a ton craig Very Happy i did go through at the routine from DS manager, but never bothered to know the differance between the next value and concurrent. Now i do and would go through the steps you suggested, including reading up on the previous posts. My next issue was trying to generate another value, but in this case a ID number that would correspond to the hierarchy level (detailed to the last grain of data) of the dimension table that i'm trying to populate with my job design, where i'm extracting data from a mainframe file, by referencing a copybook (cobol FD metadata). I'm trying to map the dimension table's columns to some of the columns from the mainframe file. The first one was the surrogate key assignment and the second the Hierarchy level ID, which is based on another column from the file. I would appreciate if you could shed some light on this

_________________
Adrianna D
Rate this response:  
Not yet rated
sylvan_rydes
Participant



Joined: 12 Apr 2006
Posts: 47

Points: 349

Post Posted: Wed Dec 06, 2006 3:28 pm Reply with quote    Back to top    

Hi All,

I've been reading this post and I have one question. There is a file in common storage and the path is as below-

Common /Sequences/ Initialized, NextVal, SeqFile

I just need to know that if I need to clear SeqFile. How can I do that. Thanks in advance.

Sylvan Rydes

_________________
sylvan rydes
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 28418
Location: Denver, CO
Points: 146801

Post Posted: Wed Dec 06, 2006 3:56 pm Reply with quote    Back to top    

Clear Seqfile? Not sure what you are asking. All you need to do to use these routines is understand how they work and then just... use them. SeqFile is not 'a file in common storage' per se, but the name of the 'Sequence File' in use - i.e. the SDKSequences hashed file - from what I recall.

_________________
-craig

Sarchasm: The gulf between the author of sarcastic wit and the person who just doesn't get it.
Rate this response:  
Not yet rated
sylvan_rydes
Participant



Joined: 12 Apr 2006
Posts: 47

Points: 349

Post Posted: Wed Dec 06, 2006 4:15 pm Reply with quote    Back to top    

Hi Craig,

Thanks for your response. I actually got it done.

Sylvan Rydes

_________________
sylvan rydes
Rate this response:  
Not yet rated
Vemireddy_Sasi
Participant



Joined: 11 Jul 2007
Posts: 2

Points: 10

Post Posted: Wed Jul 11, 2007 11:35 pm Reply with quote    Back to top    

ram.m wrote:
duh_sk8erboi wrote:
Hello to all DS gurus

I'm new to DS & ETL development, but i'm quickly catching up & learning so many wonderful things about DS. I have come across a new challange, surrogate key assignment. how can one generate a new surrogate key for a column which is the key column in a transformer, which i used to extract data from a complex flat file & attempting to load to a oracle table.

Thanks in Advance


Hi,

by using KeyMgtGetNextval u can generate the sequence number in the transformer stage.

Thanks,
Ram



Hi Ram,

Do you have any idea How can we set the initial value for the Sequence using KeyMgtGetNextval?

Thanks and Regards,
Bhaskar
Rate this response:  
Not yet rated
ArndW

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup

Joined: 16 Nov 2004
Posts: 13833
Location: Germany
Points: 78216

Post Posted: Wed Jul 11, 2007 11:39 pm Reply with quote    Back to top    

There is no way to set the initial value to anything other than 1 using the default routine. But you can create your own copy of the Manager/Routines/sdk/KeyMgt/KeyMgtGetNextValue routine and modify i ...

_________________
Image
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 28418
Location: Denver, CO
Points: 146801

Post Posted: Wed Jul 11, 2007 11:45 pm Reply with quote    Back to top    

More of a 'reset' than a 'set', per se, but perhaps it will help:

Code:
UPDATE SDKSequences USING DICT VOC SET F1 = '?' WHERE @ID = 'YourSequenceName';

YourSequenceName is the 'key' to reset.

? is the value to reset it to.

_________________
-craig

Sarchasm: The gulf between the author of sarcastic wit and the person who just doesn't get it.
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours