Usage of DSGetVarInfo in After Job routine

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
wbeitler
Premium Member
Premium Member
Posts: 70
Joined: Tue Feb 21, 2006 2:58 am
Location: Netherlands
Contact:

Usage of DSGetVarInfo in After Job routine

Post 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
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post 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,
- james wiles


All generalizations are false, including this one - Mark Twain.
wbeitler
Premium Member
Premium Member
Posts: 70
Joined: Tue Feb 21, 2006 2:58 am
Location: Netherlands
Contact:

Post 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
wbeitler
Premium Member
Premium Member
Posts: 70
Joined: Tue Feb 21, 2006 2:58 am
Location: Netherlands
Contact:

Post by wbeitler »

Ended uip using good old serverjob to workaround it...

William
Post Reply