give a variable as end parameter in loop start activity

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
roshanearly
Participant
Posts: 27
Joined: Thu Aug 09, 2012 4:55 am
Location: bangalore

give a variable as end parameter in loop start activity

Post by roshanearly »

i am using a loop activity .the number of times the loop runs is n which is a variable .how to use this in end parameter of start loop activity
ROSHAN
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
If you want to run a loop using varibale(non numeric),you can not put it in a numeric loop,instead you can invoke List Loop(For Each Things in List).

Using this option you can put your variable in loop definition either by comma,space or other delimiter.

In case your variables are in file,you need to first execute the cat command in Execute command activity then pass the command output in delimited value of start loop activity.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Have you tried passing your "n" times in as a job parameter? I have no idea if that's allowed in the stage but for it to be possible I would imagine that's about the only way you could manage it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Ahh....i didnt see you have mentioned as numeric variable.You can paas these value of n as a parameter in start loop activity.
roshanearly
Participant
Posts: 27
Joined: Thu Aug 09, 2012 4:55 am
Location: bangalore

Post by roshanearly »

this variable i will get at runtime from my db by giving a count query ....that's in a server job ....how do i use this variable in sequence job as input parameter ....shall i use user variable stage ....how??
ROSHAN
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Have the server job place the value into its User Status area.
In the sequence refer to the activity variable $UserStatus (for the activity that runs the server job) to get that value. This can appear directly in any field that can contain an expression and which is downstream of the server job activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
You need to store variable in DSSetUserStatus(Write a routine using this function and invoke in your server job transformer) and before start loop activity,add UserVariable activity,create a sequence variable there and assign its value like:-

Code: Select all

SeqVar=Serverjob.UserStatus
SeqVar you need to pass in start loop activity.
Post Reply