Reading multiple files of same pattern

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
mouthou
Participant
Posts: 208
Joined: Sun Jul 04, 2004 11:57 pm

Reading multiple files of same pattern

Post by mouthou »

Hi,

Can anyone help me how to read the files of some patterm using sequential file stage in server stage. It seems like server version doesnt support wild cards unlike in parallel version.

The files will be at the location like AA_010.dat, AA_02.dat etc. I want to give like AA_*.dat so that the job picks up all the files.
Is there anyway to do it?

Thanks in advance.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

You'r best bet would be to concatenate all these files and then read them, as your file pattern is the same
or else build a Job Sequences using Loop Activiy Sequences to handle it.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, the Server Sequential stage does not support wildcards, as least not as easily as the PX version does. Read up on the Filter option, there are times it can be leveraged for that. Use a command like:

Code: Select all

cat AA_*.dat
there to send all files, one after another, to 'standard out'. The stage will then read standard out stream as if it was a single file.

You can also read up on the Folder stage, which can handle small files. It's typically used for XML files but could make do in a pinch. You could also play with named pipes for yet-another-way to accomplish this. Or concatenate all into one combo file for processing. Or... :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
g_goli
Participant
Posts: 2
Joined: Tue Jan 10, 2006 12:30 pm
Contact:

Re: Reading multiple files of same pattern

Post by g_goli »

mouthou wrote: Can anyone help me how to read the files of some patterm using sequential file stage in server stage. It seems like server version doesnt support wild cards unlike in parallel version.
Hi,

you can read files by a wildcard in server version using a Folder stage (Output tab -> Properties -> Wildcard).
It will read file names which you can process then and put into a hashed file or other sequential file which would read the files consecutively in a separate job (or a sequence).

Regards,
ggoli
mouthou
Participant
Posts: 208
Joined: Sun Jul 04, 2004 11:57 pm

Re: Reading multiple files of same pattern

Post by mouthou »

I tried using Folder stage. It has got couple of limitations.

It takes exactly 2 columns and expecting a key column. And when it creates the final file, it adds one extra record as the header.

So, I gave COPY command as the before-job subroutine to concatenate the files and create a single file at the same location and reading that file in my job.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Job sequence with StartLoop activity based on the regular expression?
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