Job aborts due to Execute Command Activity in the loop

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
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

Job aborts due to Execute Command Activity in the loop

Post by UAUITSBI »

Hello,

I have designed a sequencer with the following steps:
1. Executive command reads comma delimited files from a directory (Ex. A_123.xml B_123.xml C_123.xml)
2. Executive command creates a file with these file names separated by comma delimited (Ex. A_123.xml,B_123.xml,C_123.xml)
3. Pass the file names to a start loop activity, which will process the files in the loop using "List Loop" and Comma Delimited Values that are read from the file created in step 2.
4. Execute Command activity stage is used to extract the first field in the file name before the underscore:
Command used: echo #Start_Loop.$Counter# | cut -f1 -d '_'
Result: A, B, C
5. Job Activity to run desired jobs and the result from step 4 is passed as a parameter into the jobs.
6. End Loop Activity

Code: Select all

Flow: 
Execute Command Activity 1 ---> Execute Command Activity 2 ---> Start Loop Activity ---> Execute Command Activity 3 ---> Job Activity ---> 
                                                                End Loop Activity ---> Start Loop Activity
Issue:
When I run the sequencer it executes properly until the last iteration and then sequencer aborts because "Execute Command Activity 3" (Step 4) returns undesired value.

For instance in the source folder if I have 3 files A_123.xml, B_123.xml, C_123.xml sequencer successfully process the iterations for A_123.xml, B_123.xml and Execute Command Activity 3 after executing cut command it returns value A, B respectively.

But for iteration 3 the Execute Command Activity 3 after executing the cut command returns a Reply of "| cut -f1 -d '_'" instead of "C" this is causing the jobs in the job activity to abort hence the sequencer.

This happens only in the last iteration, if I have 30 files in the source 29 files will be processed and 30th file iteration would be aborted because of step 4.

I am confused why it is an issue with the last iteration when other iterations are get processed. Am I missing something here ?

Please advice.

Thanks !!
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

what happens when you put an extra comma in the end of that file name list? and what about just using echo of the variable passed to execute command activity instead of doing 'cut -f1'?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
atul9806
Participant
Posts: 96
Joined: Tue Mar 06, 2012 6:12 am
Location: Pune
Contact:

Post by atul9806 »

When your job is picking last value , it is picking "\n" (new line char) also, please eliminate this before passing to your job. You can do this in command activity or Loop activity
~Atul Singh
<a href=http://www.datagenx.net>DataGenX</a> | <a href=https://www.linkedin.com/in/atulsinghds>LinkedIn</a>
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

Post by UAUITSBI »

Thanks for the reply guys.

Priyadarshikunal,

I have initially gave it a shot to include a extra comm at the end of filename list but the error repeats. I have also tried semicolon but still couldn't get it to work. Appreciate your input.

Atul,

Yor are right, there is a new line in the filenames text file, I have took care of it while creating this file but for some reason it didn't work. As you suggested I have removed the new line while reading filenames file and it allowed the complete all the iterations. Appreciate your help.

Thanks !! :)
Post Reply