Page 1 of 1

Dynamic variable generation

Posted: Fri May 18, 2007 8:44 am
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

Posted: Fri May 18, 2007 9:16 am
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

Posted: Fri May 18, 2007 5:08 pm
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.

Posted: Sat May 19, 2007 12:07 pm
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..

Posted: Sat May 19, 2007 3:35 pm
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.

Posted: Sat May 19, 2007 8:54 pm
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.

Posted: Mon May 21, 2007 3:02 am
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