StartLoop Activity fail when I have an empty iteration list

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
jnguyen
Premium Member
Premium Member
Posts: 13
Joined: Wed Aug 09, 2006 9:59 am

StartLoop Activity fail when I have an empty iteration list

Post by jnguyen »

Hi,

Could some one help me with the issue as follow:

I have used a startloop activity to loop each date I specified in the iteration list to call a server job to insert a blank record base on the date from the list. This worked fine when I have a list like this (2008-4-16,2008-4-17,2008-4-18) but it failed when I have an empty list.

What I think is that it should not aborted if there was no item in the list or I may missing some coding here.

Thanks alot.

JN
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

A list loop expects values , you cannot have an empty list, what you can do is to populate the list with a default value in case the list is actually empty and use a nested condition activity that reads the list (counter) value and directs an appropriate sequence of jobs to run

HTH
jnguyen
Premium Member
Premium Member
Posts: 13
Joined: Wed Aug 09, 2006 9:59 am

Post by jnguyen »

Thanks, So you are saying that I should have a nested condition activity where I will set the condition in the expression under the Trigger tab that if the list is empty then don't run the startloop and if there is something in the list then run the startloop. Right?

If so, could you show me an example?
I have a file under UNIX that contains one line (eg: 2008-4-16, 2008-4-17, 2008-4-18 ) these are the number of items in the list I called for inputing to the startloop

THanks alot
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

you will need to have 1 default value populated in the file that supplies the list like 'XXXX-X-YY', and in the nested condition branch the execution to a different sequence if StartLoop.CounterValue = ''XXXX-X-YY'' , alternatively , you can load the list to an user variable activity and use an If then Else derivation to supply a value to the start loop list, you would process the list inthe user varable activity ( if len(command.output) = 0 then ''XXXX-X-YY' else command.output), where command would be like cat <filename> , subsequently use the value of user variable as the input to your list loop.. its up to you now

HTH

Thanks
Ramesh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

As suggested, a Nested Condition prior to the Start Loop activity is an efficient technique. Don't even enter the Start Loop activity unless the length of the list is non-zero.
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