Page 1 of 1

Can someone repost steps to use the $UserStatus variable

Posted: Thu Apr 19, 2007 1:40 pm
by florianm@us.ibm.com
I have searched the archives of the forum to find the detailed steps of how to use the UserStatus variable in datastage and must say that I don't see it anywhere in the laundry list of posts. Can someone please repost a FAQ of how to set the variable and then subsequently call it later.

Like others, I am looking to get the max date in one job, call a user defined routine that contains the following call "Call DSSetUserStatus(Arg1)", and then reference that in the next job in the sequence.

It may seem like I understand what to do, but in practice, I am the type that needs to see it in action.

thanks in advance.

Posted: Thu Apr 19, 2007 2:41 pm
by ray.wurlod
Welcome aboard. :D

Setting the User Status variable is, as you observe, a matter of calling the DSSetUserStatus subroutine. However, if you need to call it via a transform function you will need an interlude such as:

Code: Select all

FUNCTION SetUserStatus(Arg1)
Ans = Arg1                 ; * pass input argument unchanged
Call DSSetUserStatus(Arg1) ; * load Arg1 into user status area
RETURN(Ans)


To recover this value, you can use DSGetJobInfo(hJob, DSJ.USERSTATUS).
In a job sequence you can also use the name of the Job activity and its associated $UserStatus activity variable, for example:

Code: Select all

JobActivityName.$UserStatus


In versions earlier than 7.5 you will need to type in the variable name; from version 7.5 you can choose it using the expression editor or the parameter helper. The only restriction is that there must exist a connection (links) from the Job activity and wherever you are using the activity variable.