Reading input from a sequential file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Mohana Krishnan
Participant
Posts: 10
Joined: Thu May 24, 2007 12:34 am
Location: India

Reading input from a sequential file

Post by Mohana Krishnan »

Hi,

I need to read the data from excel ,and the excel will be placed in our server and with the timestamp, i need to get the latest excel and update oracle table. I m using Sequential file->Transformer->OCI
Now how do i know which is the latest excel in the server..?

please help me out.

Thanks.
Mohana Krishnan
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You will need one process to determine the correct file to use, then passing that value to the DataStage job that reads the file.
There are many ways of getting the "latest" file; it depends if you do it by date-time created/modified or by the name. This would be a single UNIX statement, i.e. "ls /test/path/TestSheet*.xls -ls | head -1"
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

regarding date and time you will not be sure, for that purpose using logic suggested by ArndW you create one fix named file for example

testdata_20080305.xls to testdata.xls. and use this fix named file in your job and after processing the file , remove fix named file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So you plan to put the Excel (.xls) file on a Unix machine? Good luck!!

Or is it a text dump (.csv or .txt file) that you plan to put on the Unix machine?

In either case you can work out which is the latest by checking the date/time accessed/modified, which the ls option suggested by ArndW uses to sort the file names. That's why a head -1 command selects the most recent.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mohana Krishnan
Participant
Posts: 10
Joined: Thu May 24, 2007 12:34 am
Location: India

Post by Mohana Krishnan »

ray.wurlod wrote:So you plan to put the Excel (.xls) file on a Unix machine? Good luck!!

Or is it a text dump (.csv or .txt file) that you plan to put on the Unix machine?

In either case you can work out whi ...
We are going o place .xls file in the unix path. I could not able to see all ur coments.

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

Post by ray.wurlod »

Premium membership costs less than 30c (Rs12) per day. Among other things it will let you read the five premium posters' contributions in their entirety. All revenue from premium memberships is devoted to defraying hosting and bandwidth costs incurred by DSXchange so, by taking up premium membership, you are helping to keep DSXchange alive.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'd need to purchase and leverage UNIX drivers that can read Excel files. For example, an 'adapter' from someone like iWay Software. Otherwise you'll need to export the data, do a 'save as' in a sequential file format like the .txt or .cvs formats, which can be easily processed.
-craig

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