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

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

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

Post 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 :?:
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

Post 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
Regards,
Sajid KP
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use the File Pattern option in the stage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

Post 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
Regards,
Sajid KP
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Look into your online PDF "Parallel Job Developer Guide" and search for "file pattern".
sajidkp
Participant
Posts: 114
Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi

Post by sajidkp »

Raj,

Do you want to disconsider the date part or you need to check the dates when reading from the file?
Regards,
Sajid KP
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

i have the date in the records itself, So there is no need to consider the date part...
RAJ
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

But i should not run the yesterdays files again and again..?

Thanks,
RAJ
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

But i should not run the yesterdays files again and again..?

Thanks,
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Is there any option other than renamiming the Production files....
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply