Sequential File Stage file name

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
taufik
Participant
Posts: 46
Joined: Fri Jul 18, 2008 5:21 am

Sequential File Stage file name

Post by taufik »

Dear All,

I need to create job that read file generated every 15 minutes. The file name was generated base on time file generated, e.g. rec20080701132610 and next 15 minutes file rec20080701133110 (recYYYYMMDDHHMISS) was generated.

All I know that we need to write filename explicitly in Sequential Stage. Is there anyway so I can throw kind of filename variable for Sequential File stage, so the stage read "current time" file only?

Thanks in advance,
Taufik
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, but exactly how depends on your actual requirement. For example if you always want the latest file, capture its name with an operating system command like ls -lrt dirpath | head -1 or DIR /OD/4 dirpath | SORT /R in an Execute Command activity (in a job sequence), then capture that output to feed to the filename job parameter in a Job activity. You will probably need to strip field mark characters (@FM) from the command output.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
taufik
Participant
Posts: 46
Joined: Fri Jul 18, 2008 5:21 am

Post by taufik »

Where should I put those command? There is filter command text box on sequential file properties window, but looks like it's disable to edit.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In a job sequence.

Code: Select all

ExecuteCommand --->  Job activity
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

Sorry Ray but i have one doubt how can he execute 'ls' commandS when his OS is windows.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's why I also gave a DIR command. Many Windows sites have a UNIX emulator such as MKS Toolkit that could be used to execute the ls command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply