Surrogate Key using sequence ?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Surrogate Key using sequence ?

Post by swades »

Hi,
I am Really stuck please help me..
I have job which generates surrogate key using Surrogate_key_gent_stage, I want to maintain surrogate key in multiple run, I search in forum I found that I can do with Sequence BUT can anyone please tell me how to retrive Last_run_max_value of surrogate key in sequence please help.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Parametrize the start value and provide the start value during run time. You can store the last generated key in a file. During run time, the contents of that file can be passed to the job parameter.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

During run time, the contents of that file can be passed to the job parameter.
Can you please tell me how to do this ? I have read this..in other forums But I want to know how ? please let me know..
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well, write your max value a sequential file. Build a sequence job which has two an command activity stage. Pass the command

Code: Select all

type your/fully/qualified/filename
Have a link coming out of command activity stage to a job activity where your calling your job that generates the keys. Open the job activitie's poperties, in the expression for the job parameter, double click, right click, choose execute_activity.$Return_Value.
Thats one way, i am sure there are other ways. Atleast this will get you started.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

I did that and sequence is running fine. BUT output of command is giving me wrong value what can be reason ?

In command_line, I am passing path of my .txt file which contain only single digit and that digit I am passing as parameter of next job_activity..BUT output of this activity is giving me wrong value of that parameter...so please what can be the reason or Is that I am doing something wrong ?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Did i say $Return_value. SOrry, you need to pick $Command_Output.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Thanks for the Replay.

When I am using Execu_command.$Command_Output as value, then the Sequence gets aborted...what can be reason ?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What does the log say?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For anyone playing along from the home audience, there's no underscore in any of these trigger values. It shouldn't even compile like that, so I'm sure everyone is using them properly but typing them incorrectly here.

We now return you to your regularly scheduled problem.

ps. swades - you need to tell us what the reason was, only then can we help.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Thanks for the clarification Craig. I couldnt remember the exact options off of my head as i havent used that option in ages. :)
I hope the OP is actually choosing those options from the drop down rather than typing it, which he probably is as the job ran and aborted.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

What does the log say?
is:
Message:
k_ren..JobControl (@Execute_Command_2): Executed: /demo/...../filename.txt
Reply=320
Output from command ====>
SH: /demo/....../filename.txt: 0403-006 Execute permission denied.

AND
Message:
k_ren..JobControl (@Execute_Command_2): Command /demo/......../filename.txt did not finish OK,
reply = '320'

We now return you to your regularly scheduled problem
I am sorry this is not scheduled problem
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You were supposed to 'type' the file, not try to execute it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Did you put 'type' before the file's fully qualified name? Does'nt look like it. Put type before your file name.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

chulett wrote:You were supposed to 'type' the file, not try to execute it.
Beat me to it :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

swades wrote:
We now return you to your regularly scheduled problem
I am sorry this is not scheduled problem
:? I don't think you got what Craig meant in that sentence. First, a general announcement was made about the trigger values and then the audience were directed to regular flow of solving the problem. :wink:

Craig! Correct me if I botched up.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Post Reply