Need routine/job to get the old file name based on time

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
mvrkreddy
Participant
Posts: 12
Joined: Sun Apr 13, 2014 11:46 pm

Need routine/job to get the old file name based on time

Post by mvrkreddy »

Hi,

I will get the files every 2 minutes in to unix directory.
Now i need to process the files in FIRST IN FIRST OUT...
here i am facing the problem ,how can i get the old file name based on time and need to pass the same file name to my another job as parameter.

Regards,
Rajesh
RAJESH
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How are you planning on processing these files, especially with them arriving 'every two minutes'... looping job? Multi-instance jobs? Is it going to take longer than two minutes to process any given file?

Getting the order of the files is just a small part of what you need to do and that can be as simple as a "ls -t <pattern>" listing to list them based on time descending or "ls -tr <pattern>" for time reversed, as in ascending or oldest first.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PaulVL
Premium Member
Premium Member
Posts: 1309
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

I guess you could

ls -rt | mv ./processing
ls -rt ./processing > filelist.ini

or something like that.

then simply read the file and loop a sequencer with each entry as a parm to your job.
Post Reply