Job Sequence question - loops and user 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Job Sequence question - loops and user variables

Post by ArndW »

I have a Job Sequence which loops multiple times, calling a job which returns a single value each iteration (via UserStatus) to the calling sequence.

After n iterations of this loop I would like to have a comma-separated list of those returned values in a variable that I can then pass to yet another job.

Unfortunately the User Variable Activity stage variables do not allow the construct "A = A : <new value>" and I can't see a simple way to do this; but perhaps I'm overthinking the problem and am missing some simple solution that someone else here might find.

I've temporarily worked around the issue by declaring a user-written BASIC function which uses a COMMON block to statically store a variable and append strings to it on each call, but this seems to be a bit too complicated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Maybe an Execute Command activity involving echo with the >> indirection operator to accumulate the values in a file then, outside the loop, another Execute Command activity to cat the file? Of course you'd also need to ensure that the file did not exist or was empty before the loop begins.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Considering that my routine is a 2-liner, that might be the easier way to go after all. I was hoping that there was some "official" method available within the loop to accumulate a value that I'd missed.
vibwipro
Participant
Posts: 40
Joined: Thu Jan 24, 2013 7:34 am

Re: Job Sequence question - loops and user variables

Post by vibwipro »

Execute Command Stage will be an option for this logic to implemented. Every time output value will be over written to existing file with new value concatenated to it. :idea:
Post Reply