Page 1 of 1

DS390: Getting MAX Surrogate value into transform

Posted: Thu Jan 22, 2004 9:54 am
by tomengers
Hi Folks ...

Can anyone suggest an elegant way to get a MAX surrogate value into a DS390 transform (to be used as an assignment start point)? Were this a server job I would use the built-in key management function. I'm presently doing a MAX to obtain the highest value and then using a JOIN to connect this value to each incoming add transaction which is clumsy and inelegant, since only the first incoming row value is actually used. It works, but I really don't like it.

... tom

Posted: Thu Jan 22, 2004 10:01 am
by kcbland
Key West, really Tom, is life rough? :lol:

I don't know DS/390, but what about a job parameter? Initially fetch the max value and then feed into the next job as a parameter?

Posted: Thu Jan 22, 2004 11:39 am
by Mike
Hi Tom,

I've used a GDG dataset as a parameter file for surrogate key management. Job reads gen 0 to get the starting value and writes the last value to gen +1 at the end. Use a stage variable in the transformer to increment (i.e. NextVal = ParmVal + NextVal + 1). NextVal is initialized to 0, and remember that ParmVal is constant throughout the job execution. In case of an ABEND, you still have the original gen 0 for restart purposes.

Mike

Posted: Thu Jan 22, 2004 12:53 pm
by tomengers
Ken ... ah yes ... consulting in 'Paradise' is as good as it gets (but the downside is that none of my clients are here). Thanks for the tip - looks like you and Mike are on the same page.

Mike ... GDG is great idea. That would work for me! But I need a little help here: once I get it, how do I drive the GDG "next val" into a parameter for the next step?

... tks guys

... tom

Posted: Thu Jan 22, 2004 2:09 pm
by Mike
Tom,

It's been a while since I've done 390 work, but from memory:

1) Go to the Parameters tab on the Job Properties page .
2) Put in a DD name (e.g. JOBPARM)
3) Put in the GDG dataset name (e.g. MY.GDG(0))
4) Fill in the parameter names in the grid. These parameters should be available to use in the expression editor.

Mike

Posted: Thu Jan 22, 2004 2:21 pm
by Mike
Tom,

Sorry, I just reread your post and it looks like you might have actually been asking about how to write the final value back out.

Just create an extra flat file as an output from your transformer. Put in a constraint so that it only gets written to when you hit an end of file condition on your input. Assign it a DD name (e.g. NEWPARM). Assign it a Dataset name (e.g. MY.GDG(+1)). Load column metadata so that it matches the column metadata on the Parameters Page of Job Properties. Then simply map your NextVal stage variable into the appropriate target column.

Mike

Posted: Fri Jan 23, 2004 6:16 am
by tomengers
Mike ...

Super! And thanks ... your next-to-last post was the one I needed - didn't realize you could throw DD names into the parameter grid. Really appreciate the help. :D

... tom