Page 1 of 1

How to assignment a sql to a variables

Posted: Mon Feb 13, 2012 2:25 am
by dongyingying
Hi,All
I got a issue, I want to put the column_1which select column_1 from sysibm.syssummy1 to a varibale ,so who can you please to tell me how i do it?

Posted: Mon Feb 13, 2012 2:29 am
by ray.wurlod
Use a sequence.

Create a job to perform the SQL and either load the result into its user status area or write the result into a file.

Once control returns to the sequence populate a user variable from the result either using the $UserStatus activity variable from the Job activity or by using an Execute Command activity to read the file.

Posted: Mon Feb 13, 2012 4:01 am
by dongyingying
Thanks ray,
I think I know what you mean . Yes I create a job and defined a job var in job parameter and set the value to the var in a UserVariables Activity stage and the other stage then reference the var .

what do you think ray?

Posted: Mon Feb 13, 2012 3:29 pm
by ray.wurlod
You understand correctly. That is what I described. You can use the user variable, for example, to provide a value to a downstream job parameter.

Posted: Mon Oct 01, 2012 11:28 am
by max.madsen
Ray, how do I load the result of a job into its user status area?
Tks!!
Best Regards,

Posted: Mon Oct 01, 2012 3:00 pm
by ray.wurlod
Use a server job to perform the query. In a Transformer stage call a routine that puts the value into the job's user status area. You'll need to create the routine, which is an interlude to the subroutine DSSetUserStatus.

Code: Select all

FUNCTION SetUserStatus(Arg1)
$INCLUDE DSINCLUDE JOBCONTROL.H
Ans = 0
Call DSSetUserStatus(Arg1)
RETURN(Ans)