How to assignment a sql to a variables

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
dongyingying
Participant
Posts: 35
Joined: Tue Feb 07, 2012 2:28 am
Location: China BeiJing

How to assignment a sql to a variables

Post 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?
Dong Ying Ying Come on.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dongyingying
Participant
Posts: 35
Joined: Tue Feb 07, 2012 2:28 am
Location: China BeiJing

Post 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?
Dong Ying Ying Come on.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
max.madsen
Premium Member
Premium Member
Posts: 62
Joined: Tue Dec 07, 2004 7:41 am
Location: Brasil
Contact:

Post by max.madsen »

Ray, how do I load the result of a job into its user status area?
Tks!!
Best Regards,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply