Loop Activity- Return status of each loop

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Lovesh_Patni
Premium Member
Premium Member
Posts: 13
Joined: Fri Jun 22, 2007 1:29 am
Location: Perth

Loop Activity- Return status of each loop

Post by Lovesh_Patni »

Hi,
I want to capture the user status of same job executed in loop with different parameters.
Here is my scenario

Job Seq:

Start Loop Activity(For loop i=1 to 4) ->Job Activity->End Loop Activity.

I want user status of each job activity run so that I can use it after End loop activity.I want to avoid dumping the user status into file in each loop run and using it later.Can we store the user status into a varialbe, concatenate it every time in loop and use it after End loop.

Thanks
Lovesh Patni
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There's no concept of a globally scoped variable in Sequence jobs you can update while the job runs. You may be able to build another job that takes in your new UserStatus value and appends it to its current UserStatus, thus concatenating them there but I'm not sure a job can query its own UserStatus value. Worth a shot.

That or just go with the 'write it out to a file' solution. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
JRodriguez
Premium Member
Premium Member
Posts: 425
Joined: Sat Nov 19, 2005 9:26 am
Location: New York City
Contact:

Post by JRodriguez »

This might work:

Start Loop Activity(For loop i=1 to 4) ->Job Activity->UserVariable -->End Loop Activity.

I guess that you want to have two User Variables to keep the previous value of the job status
Julio Rodriguez
ETL Developer by choice

"Sure we have lots of reasons for being rude - But no excuses
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thought about that but honestly don't think you can update values in that stage. Could be wrong, though but have no way to test anything. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

Or instead of setting it as user status, you can write it to a hashed file and look-up the value after your end-loop activity using UtilityLookUpHash.
Arun
Lovesh_Patni
Premium Member
Premium Member
Posts: 13
Joined: Fri Jun 22, 2007 1:29 am
Location: Perth

Post by Lovesh_Patni »

Thanks to all of you for your inputs.
Yes,I think the only way to do is writing into file and then reading it again after End loop activity.
Lovesh Patni
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you go that route, make sure you initialize / empty / clear the sequential file before you hit the loop as inside the loop you'll want to append to the file. That or have your mechanism be smart enough to overwrite on the first iteration and append after that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Lovesh_Patni
Premium Member
Premium Member
Posts: 13
Joined: Fri Jun 22, 2007 1:29 am
Location: Perth

Post by Lovesh_Patni »

Hi chulett,

Yes,I'm creating a file before the loop begins and using basic statement WriteseqF to insert data into the file created and delete the file at Exit.
Lovesh Patni
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok, that should be good... is it all working for you?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply