How could I process all files from a directory?

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
tiagogen
Participant
Posts: 22
Joined: Sun May 14, 2006 2:03 pm
Location: Valinhos

How could I process all files from a directory?

Post by tiagogen »

Hi there!
I am newbie in DataStage and in this forum as well.
My doubt is how can I get all files from a directory with a determinate standard.
For example, I want to process all files from a directory that starts with "PCBR*".
This directory comes from a parameter.

The way I found to do that, is using the job sequence.
I execute a find(unix command) , and I call the job once for file.
Anyone has a better way to do that?

thanks a bunch!
(sorry my English mistakes)
Tiago
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. :D

A job sequence is the best way. A StartLoop activity can set up a "list of things" loop based on a regular expression.

Code: Select all

  Pre-loop activity ---->  StartLoop  ---->  Within-loop activities  ---->  EndLoop  ---->  Post-loop activity
                             ^                                                 |
                             |                                                 |
                             +-------------------------------------------------+
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

I dont have the access to Server Edition now. If you have "File Pattern" pattern option as available in PX editon you job will become easiar.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's a strange response in the server forum! :?
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 »

kumar_s wrote:If you have "File Pattern" pattern option as available in PX...
What Ray means is... you don't.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kaps
Participant
Posts: 452
Joined: Tue May 10, 2005 12:36 pm

Post by kaps »

I believe that the sequential file stage accepts wild cards in file names.
we can mention like Directory/PCBR*

Regards
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Wild cards is not supported in server. I believe its supported in PX.
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 »

Final score in the 'Wildcards in the Sequential File stage' Bowl Game: PX 1, Server 0. :wink:
-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 »

Thanks for confirming that Craig, in a very humourous manner :wink:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

For a not too large number of not-too-large files, the Folder stage does support wildcards.

The restriction on not-too-large files is that the Folder stage reads each entire file contents into a single field - it's intended to be used with XML documents rather than data files.
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