Page 1 of 1

Parsing file names

Posted: Thu Apr 13, 2006 11:32 am
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

Posted: Thu Apr 13, 2006 11:39 am
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.

Posted: Thu Apr 13, 2006 11:42 am
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.

Posted: Thu Apr 13, 2006 1:04 pm
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

Posted: Thu Apr 13, 2006 1:12 pm
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.

Posted: Thu Apr 13, 2006 1:16 pm
by gateleys
Now.. that sounds like a piece of cake. :wink: I will have to try it out.

Thanks Kenneth.
gateleys