Dynamic variable generation

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
47shailesh
Participant
Posts: 60
Joined: Tue Aug 29, 2006 11:14 pm

Dynamic variable generation

Post by 47shailesh »

scenario:

1. I have a counter that creates instance one by one...
2. There is a errohandlingjob that is called if any instance fails...
3. for every instance parameters that are passed are same but there
value differs as the instace picks value from some xyz table.

Problem:
1. Say the parameter that 1st intance is taking is param and for 1st instance it's value is '2'. for 2nd intance the this value is say '6'.

2. now problem is if both instance aborts then two 2 seprate instance of errorhandling job should run with param values(i.e for 2 & 3) of both the instance.
But since the instances are running in parallel the param value of 1st instance is overwritten by 2nd instance param..
That's why both the errohandling instance run for same param value(of 2nd instance)...

Now i wud like someone to help me genrating random values of param vased on counter so that errohandling job can get correct value for correct instance..

Thanks
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

While calling Error Handling job pass the fully qualified name of the main calling job or any distinct output parameter you can get from the output of the calling job as instance id
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why not just use the parameter value as the invocation ID? Otherwise, call KeyMgtGetNextValue() to establish a sequence of unique invocation IDs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
47shailesh
Participant
Posts: 60
Joined: Tue Aug 29, 2006 11:14 pm

Post by 47shailesh »

i think none get what my problem is:

closer look:

step1:a loop runs for counter=0 a instance(1) is created which pick a unique value from file and assign it to variable 'param'.

step2:when a loop comes again for counter=1 again a instance(2) is created that pick next value than that picked by first instance from file and assign it to same variable 'param'.(thus value is overwritten)

now if instance 1 aborts then i want to run the errorhandlling job for intance one with param value that was assigned to instance one when counter was 0

but since param value is overwritten every time a instance is called, i m unable to do so..
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No problem; you simply need to record the instance=paramvalue pairs somewhere. A hashed file keyed by instance would be ideal, even SDKSequences could be used. Just remember to remove the record from the hashed file upon successful completion.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Call an instance 'sequence' insted of job and pass the parameters to that sub-sequence. That sub-sequence should have your job and error handling job. So if the instance job in that sub-sequence fails, an instance of error handling job can be called with the same parameters you passed to the sub-sequence.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
47shailesh
Participant
Posts: 60
Joined: Tue Aug 29, 2006 11:14 pm

Post by 47shailesh »

i was thinking if this could handle in the Batch job itself bt some code.. else to put values in a hashfile i have a to create another job to populate hashfile and some addtional code in the batch job
Post Reply