Parsing file names

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
dwandbi
Participant
Posts: 29
Joined: Sat Feb 04, 2006 6:17 pm

Parsing file names

Post by dwandbi »

Hi,
Would any one let me know how to parse files name on input file stage in a sequential file stage? Say for example source file names are:
file1_20040825_132154.txt
file2_20040418_211536.txt

etc. There a bunch of files in the source directory and I don't want to pass each file everytime.
How can this be accomplished?

thanks,
Tom
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

I believe u can give the filename u want to extratct and going further looking at ur files u can use processing date as a job parameter and pass it in the file name.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You could concatenate and process as a single large file, or use job parameters to pass the appropriate filename to the job in a loop.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

kcbland wrote:use job parameters to pass the appropriate filename to the job in a loop.
Hi, Sorry for hijacking the thread, but I was curious about how to create a loop that passes user-defined filenames in a loop during a job run. I use DS ver 7.0, and it does not have the loop activity stages. Kenneth, can you shed some light on this?

Thanks,
gateleys
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Custom job control, use a Batch job, use DSExecute API to browse a directory for a list of files, parse the screen output and loop running your jobs, probably doing something like tagging/moving the file after processed so that it doesn't get handled again. Check out Batch jobs from Director, they're really cool. Shows you everything to get started with the APIs for running/managing a job.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

Now.. that sounds like a piece of cake. :wink: I will have to try it out.

Thanks Kenneth.
gateleys
Post Reply