Dynamic number

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
diogo.cwb
Participant
Posts: 12
Joined: Tue Apr 29, 2008 12:36 pm

Dynamic number

Post by diogo.cwb »

Hi all,

I must insert on my table an dynamic number called by PROCESS_NUMBER. So this number must be different each time i run my DS job.

Any idea ?
Diogo de Oliveira Vasconcellos
diogo.cwb@gmail.com
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

:idea: "Generate surrogate key".

If this is not the answer you expected, Frame your question properly :?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can fetch the OS process number of the process leader.

Best way is to hold and external control table and populate it with job run information.
diogo.cwb
Participant
Posts: 12
Joined: Tue Apr 29, 2008 12:36 pm

Post by diogo.cwb »

Can't i make an Oracle stage to select max(PROCESS_ID) and on Transformer i increase +1 ?
Diogo de Oliveira Vasconcellos
diogo.cwb@gmail.com
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

there are number of ways to do it if you just want a unique process number to be populated in to target.

One of them is like you mentioned.
you can select max(process_number)+1 as process_number and feed it to your input record.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
diogo.cwb
Participant
Posts: 12
Joined: Tue Apr 29, 2008 12:36 pm

Post by diogo.cwb »

ok. but tis solution doesn't increase my number each row ? because i don't want it.
Diogo de Oliveira Vasconcellos
diogo.cwb@gmail.com
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

As long as you do not change the PROCESS_NUMBER column in the table it is max() from, the value will remain same.

In other words, commit the max(PROCESS_NUMBER) + 1 back in the table after successful completion of current run.

If it is from the same target table where you are loading the rows, then extract the value into an hash file or something similar. That way you avoid referring your target table.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

It will be a static value for the job unless you change it. If you want to be constant for all jobs for a perticular then get the value in sequence and pass it to all the jobs as parameter or store it in sequential file or hashed file and use it in jobs.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
diogo.cwb
Participant
Posts: 12
Joined: Tue Apr 29, 2008 12:36 pm

Post by diogo.cwb »

OK Thank's for all.
Diogo de Oliveira Vasconcellos
diogo.cwb@gmail.com
Post Reply