Start loop and End Loop in sequencer

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
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Start loop and End Loop in sequencer

Post by meena »

Hi All,
I have to handle multiple files to be loaded into an oracle.Has there is job dependencies , I designed a sequencer to handle multiple files. But for some reason the designed sequencer is not working for multiple files.

Files Type: YUR30120070607.001, YUR30120070619.003 etc.

Sequencer design::

1) Execute Command stage:
Command: cd
parameter: /path/ && ls -1m YUR301*
Trigger: len(EX1.$CommandOutput) > 1

2) Start loop:
Delimiter value: #EX1.$CommandOutput#
Delimiter: Comma.
Trigger: Unconditional.
3) DS job to execute : JOB1
4) Stop loop:
Trigger: Unconditional.

Sequencer error:
Error calling DSSetParam(FILE), code=-4
[ParamValue/Limitvalue is not appropriate]
The sequencer is able to handle only one file and when the job runs for second file I am getting the above error.

Job error:
Failed to open YUR30120070619.003 in directory
STATUS = -1.|
I am not understanding where exactly I am doing wrong.

Thanks in advance....
Aruna Evoori
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I believe there is a new line character at the end of the list. I tried doing this for a fellow collegue but removing the @FM character at the end does not work while specifying it in the list.
You will have to preprocess the list, remove the @FM character and send it as a job parameter to be supplied to the list.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You really shouldn't have to "pre-process" the list but can do the removal as you use them. This an example from one of my jobs, directly in the "filename" parameter in the Job Activity that the Loop drives:

Code: Select all

Trim(EReplace(Start_File_Loop.$Counter,@FM,''))
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Craig, are you using a counter or a list? I tried with list but for some reason its not accepting any functions like Field() or Convert() etc; in the list specification.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Thank you DSGuru2B and Craig..

I used the expression given by Craig and it is working.
Aruna Evoori
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

It worked for list huh? Boy, I have to try that again at my end.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, I'm not using this expression in the Loop stage itself but rather in the Job Activity stage that receives the parameters from the Loop / User Variables stages.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Ok now thats what I was doing wrong. Bummer. Thanks Craig.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
klsrao
Participant
Posts: 7
Joined: Fri Oct 22, 2004 9:07 am

Post by klsrao »

Hi, It may look silly question but... Why not we use folder stage
Lakshmi Srinivas
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The Folder stage is great for bringing in multiple XML files or anything else where you need the entire contents of the file in a single record.

When you need to process multiple 'normal' files, then you need to either concatenate them all together, do something similar in the Filter option of the Sequential File stage or build an iterative loop in a Sequence job. The latter tends to happen when, due to the business rules in effect, each file must be processed separately.
-craig

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