My loop stopped working

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
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

My loop stopped working

Post by PhilHibbs »

I have a loop that processes a set of files. It takes its input from an ExecuteCommand Activity, and it's telling me in the log that it has 9 items, so I know that's working. The list has a trailing comma, so there are only 8 real entries. There's a Nested Condition that skips the last, blank entry, and a Sequencer set to Any that takes the links from the condition and job stages.

When the loop is attached to the end of my master control loop sequence, it only runs once. I deleted everything else so there's just a User Variables activity that reads a parameter file at the start, and now it works fine.

I'm currently going through a process of deleting stuff one by one until it works. Any suggestions?

*Update:* I've worked back from the exec_GetFileList stage that reads the file list, deleting chunks or individual stages, and it only starts working again when everything is gone apart from the uv_Set_Global_Parameters at the very start.

This is my job layout:
http://dl.dropbox.com/u/8129635/J20.png
Image
Phil Hibbs | Capgemini
Technical Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you create a Routine activity on an output link from the End Loop activity - call UtilityMessageToLog() to report anything you like, but also perhaps the value of the loop $Counter activity variable.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's... odd. I have no idea what would cause something like that or why you'd have to take such drastic action to get it to loop properly. One suggestion would be to look at the Job Properties tab with all of that loverly generated code and step through that, see if anything there lets you know what is going on. You could even copy that code out into a regular Server job or a Batch:: style job and add breadcrumb loggers into it to aid in the debugging. That in addition / support of the normal 'Logging Text' capability most of those stages have.

The only other thing that pops into my head is the fact that I've never built a loop that doesn't have an explicit exit process, even if it doesn't really do anything. So, it would put my mind a little more at ease of you would add a Sequencer at the end that's just named something like 'Done' and drag a link from the End Loop to it. Probably won't change a thing but you never know! :wink:

Good luck.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

chulett wrote:The only other thing that pops into my head is the fact that I've never built a loop that doesn't have an explicit exit process, even if it doesn't really do anything. So, it would put my mind a little more at ease of you would add a Sequencer at the end that's just named something like 'Done' and drag a link from the End Loop to it. Probably won't change a thing but you never know!
When I first noticed it had stopped working, I had just added a second output link from the EndLoop Activity stage. That's what I thought had broken it at first.
ray.wurlod wrote:Can you create a Routine activity on an output link from the End Loop activity
It isn't getting as far as the EndLoop stage. It runs the Job Activity, but doesn't do the Execute Command that is immediately after it.

*Update*: I've just been told by my client that they "don't do" complex sequence jobs because they tend to mysteriously stop working when they get too big. So, I have to break it down anyway into smaller chunks that will be run by an external scheduler. I'm keeping the all-in-one version and I might find time to debug it, but I doubt it.
Phil Hibbs | Capgemini
Technical Consultant
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Fair enough. In hindsight while I didn't generally have issues with 'complex' sequence jobs, I did have an issue with one and oddly enough it also involved a loop. It had been working fine and then went sideways after I tweaked some innocuous thing. Now that I think about it, it started looping once only as well and then declaring it was done. Turned out it was actually starting my in-loop Job Activity job and then immediately dropping out right there. So Sequence declared itself Done! and downstream jobs would kick off but then immediately fail as the looped jobs were still actually running. :evil:

IBM Support never could get me either an answer to or a fix for it, so ended up working around it much as you are doing.

ps. I've marked your post as such, feel free to adjust that as you see fit.
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Loops have always been a bit "loopy"... I've had several cases like this with complex code in a loop not executing properly. I would suggest two things.

1) Have the "blank" link lead to either a STOP condition or an exec command that echos a message to the log.
2) Put an exit link on the end-loop also leading to the same.

I suspect it is having difficulty with the multiple paths within the loop. Once I simplified my loops I stopped having execution issues.

Nice code by the way, very neat, very well laid out.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

I too had a similar problem where the job activity before the end loop behaved as it had the 'Unconditional' trigger. I included a Nested condition between the job activity and the end loop and defined something like EXXXX_AddDetailAndTrailer.$JobStatus = DSJS.RUNOK and connected this to end loop. It works fine now.
Arun
Post Reply