KeyMgtGetNextValueConcurrent

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsuser91
Participant
Posts: 17
Joined: Fri Aug 21, 2009 8:11 am

KeyMgtGetNextValueConcurrent

Post by dsuser91 »

How can we generate same value in col2 for one family of records.

the current job is using KeyMgtGetNextValueConcurrent to generate col2

col1 col2
456318#16#1 6578
456318#16#2 6580
456318#16#3 6582


col1 col2
784654#19#1 6598
784654#19#2 6600
784654#19#3 6602

Any idea
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Sort your input records before the transformer and inside the transformer

1. svOld: svNew
2. svNew: <KeyColumn>
3. svCol2: If svOld <> svNew Then svCol2 + 1 Else svCol2

Map this svCol2 to your Col2
Arun
dsuser91
Participant
Posts: 17
Joined: Fri Aug 21, 2009 8:11 am

Post by dsuser91 »

Code: Select all




I am generating a sequential number by using KeyMgtGetNextValueConcurrent

for example

col1 		     col2 
456318#16#1 	6578  
456318#16#2 	6580 
456318#16#3 	6582
784654#19#1 	6584 
784654#19#2 	6586 
784654#19#3 	6588
814544#20#3 	6590
826545#21#3 	6592
835646#22#3 	6594

I want the same sequential number to be assigned for a group of records( i am grouping based on first 2 positions in col1)

col1 		     col2 
456318#16#1 	6578  
456318#16#2 	6578 
456318#16#3 	6578

784654#19#1 	6580
784654#19#2 	6580 
784654#19#3 	6580

814544#20#3 	6590

826545#21#3 	6592

835646#22#3 	6594



Any idea
[/code]
Last edited by dsuser91 on Wed Aug 18, 2010 1:36 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I have no idea what you are trying to add to this conversation in your post, can you try again please? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dsuser91
Participant
Posts: 17
Joined: Fri Aug 21, 2009 8:11 am

Post by dsuser91 »

chulett wrote:I have no idea what you are trying to add to this conversation in your post, can you try again please? :?
I made a change to my pervious posting
arunpramanik
Participant
Posts: 63
Joined: Fri Jun 22, 2007 7:27 am
Location: Kolkata

Post by arunpramanik »

split your output to aggregator

Code: Select all


input ----- xfm ---------seqfile
             |------- srt ----- aggregator ---- xfm(use keymgmy) ---- hashfile
then lookup seq file with hash file
arunpramanik
Participant
Posts: 63
Joined: Fri Jun 22, 2007 7:27 am
Location: Kolkata

Post by arunpramanik »

OR
you can use the same as mentioned,
arunkumarmm wrote:Sort your input records before the transformer and inside the transformer

1. svOld: svNew
2. svNew: <KeyColumn>
3. svCol2: If svOld <> svNew Then svCol2 + 1 Else svCol2

Map this svCol2 to your Col2
And the point 3 needs to be changed to something like

Code: Select all

3. svCol2: If svOld <> svNew Then KeyMgtGetNextValueConcurrent Else svCol2
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Post by adams06 »

I did a modification to stagevar

If lkp.NOTFOUND and svOld <> svNew Then KeyMgtGetNextValueConcurrent Else lkp.ID

I am assiging value for the first record olny, because the the next 2 records fall under the svOld = svNew condition

How can i handle this?

Code: Select all

col1           col2
784654#19#1    6580 
784654#19#2    
784654#19#3  
Thanks

(no clue why the entire post was wrapped in code tags so I 'corrected' it - Moderator)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Little tweak would do

Sort the data based on the key column.

Pass to Transformer.

Default the stage variables to emptly string
svNew = ''
svOld = ''
svSerialNp = 0

Code: Select all

1. svNew: Col1[0,Index(Col1,'#',2)]
2. svSerialNo: If svNew = svOld Then svSerialNo Else KeyMgtGetNextValueConcurrent
3.  svOld = svNew
Last edited by kumar_s on Wed Aug 25, 2010 8:57 am, edited 1 time in total.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Post by adams06 »

do you want me to set intial value to null
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can give two single qoutes. As ''.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
dsuser91
Participant
Posts: 17
Joined: Fri Aug 21, 2009 8:11 am

Post by dsuser91 »

kumar_s wrote:You can give two single qoutes. As ''. ...
I did default stage variable to svNew = '' svOld = ''. but still no change.

In your early post you did mentioned about svSerialNp = 0, do want me to create a new stage variable. i was not able read the entire message

Thanks
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

I just removed the mask, just check if that helps.
Inorder to avail the full feature, you just have to enroll into Premium memership!!
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply