Page 1 of 1

Usage of DSGetVarInfo in After Job routine

Posted: Tue Feb 26, 2013 8:45 am
by wbeitler
Hi all,

doing something wrong, simple question: what...

I'm trying to populate the user status with the actual value of a stage variable in a parallel job in order to be used by the sequence.
Calling this simple after job routine in the job (parameter is stagename;svname)

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

MyVariable = ''

StageName = Trim(Field(InputArg,";",1))
VarName = Trim(Field(InputArg,";",2))

*Call DSLogInfo(StageName,DSJ.ME)
*Call DSLogInfo(VarName,DSJ.ME)

MyVariable = DSGetVarInfo(DSJ.ME,StageName,VarName,DSJ.VARVALUE)

Call DSLogInfo('{':MyVariable:'}', DSJ.ME)

Call DSSetUserStatus(MyVariable)

ErrorCode = 0    ;* set this to non-zero to stop the stage/job

Can't seem to get the the actual value of the variable into MyVariable... (It's always empty...) :roll:
And yes, it does contain a value at runtime (the stage variable is also written to Oracle, checked the table, and the value is present...)
The parallel job being multi instance shouldn't be a problem right ?

thanks in advance,

William

Posted: Tue Feb 26, 2013 10:14 am
by jwiles
Although the documentation for the DSGetVarInfo doesn't specifically state so, I am going to hazard a guess that this will work properly only for a Server job. By the time the AfterJob routine is executed, the parallel job has shut down and the operator tasks no longer exist in memory. To the best of my knowledge, the parallel engine doesn't try to save the stage variable values at end of job (could get rather convoluted when the job is running in parallel in a cluster).

I would suggest writing the value of the stage variable to an output link of the transformer and subsequently to a text file. In the AfterJob routine or in a Routine or Command Activity in the sequence, interrogate the file to extract the value.

Regards,

Posted: Tue Feb 26, 2013 10:27 am
by wbeitler
Hi,

thanks for the propmpt reply. That perfectly describes our current solution...
We want to get rid of it since a few hundred jobs are trying to access
the file simultaniously, digesting the environment....

Of course we could also create a specific file for each job.
But trying to bypass this seemed more obvious....

If your educated guess is right we will consider moving to a server job and having the good old DSSetUserStatus...

Solution with the parallel job however is still prefered,
so if anbody can confirm jwiles guess ??

William

Posted: Thu Mar 21, 2013 12:11 am
by wbeitler
Ended uip using good old serverjob to workaround it...

William