Page 1 of 2

Reading txt file with date in its name, in daily cycle

Posted: Tue Oct 20, 2009 5:40 am
by gssr
Hi all,
I have to read a txt file and load it to the database.This is daily cycle.
The file name is in the format say,SAMPLE_20091020.txt,SAMPLE_20091021.txt ..
I cant change the file name manually ...
How can i handle this situation of handling the file and getting the date from it.

Thanks in advance,
Raj :?:

Posted: Tue Oct 20, 2009 5:54 am
by sajidkp
I think this is a common requirementYou can Parameterise the datepart of the file name.

If you are aware that what dates will come in files you can assign the value for date param from Sequencer and pass to the sequential file stage.

your File name in seq file property will look like

SAMPLE_#dataparam#.txt

Posted: Tue Oct 20, 2009 5:54 am
by chulett
Use the File Pattern option in the stage.

Posted: Tue Oct 20, 2009 5:59 am
by gssr
I searched for any topics regarding FILE PATTERN,
but i could find in dsxchange..
Can you please shre me the idea of using it or the thread that has the detail about it..

Thanks,
Raj

Posted: Tue Oct 20, 2009 5:59 am
by gssr
I searched for any topics regarding FILE PATTERN,
but i could find in dsxchange..
Can you please shre me the idea of using it or the thread that has the detail about it..

Thanks,
Raj

Posted: Tue Oct 20, 2009 6:00 am
by sajidkp
But, In that case how can it read yesterdays date's file? i think he had mentioned like daily files comes with the dates

Posted: Tue Oct 20, 2009 6:00 am
by gssr
I searched for any topics regarding FILE PATTERN,
but i could find in dsxchange..
Can you please shre me the idea of using it or the thread that has the detail about it..

Thanks,
Raj

Posted: Tue Oct 20, 2009 6:04 am
by ArndW
Look into your online PDF "Parallel Job Developer Guide" and search for "file pattern".

Posted: Tue Oct 20, 2009 6:07 am
by sajidkp
Raj,

Do you want to disconsider the date part or you need to check the dates when reading from the file?

Posted: Tue Oct 20, 2009 6:18 am
by gssr
i have the date in the records itself, So there is no need to consider the date part...

Posted: Tue Oct 20, 2009 7:04 am
by gssr
But i should not run the yesterdays files again and again..?

Thanks,

Posted: Tue Oct 20, 2009 7:06 am
by gssr
But i should not run the yesterdays files again and again..?

Thanks,

Posted: Tue Oct 20, 2009 7:34 am
by chulett
Then you either need to rename the file once processed so it no longer matches your pattern, or you need to move it to another directory.

Posted: Tue Oct 20, 2009 8:12 am
by gssr
Is there any option other than renamiming the Production files....

Posted: Tue Oct 20, 2009 8:29 am
by chulett
Ummm... moving them to another directory? An 'archive' one would be typical. Harder would be to keep a list of filenames processed and skip those filenames when you see them again.