Re: help reqd

From: Sunder Iyengar (Sunder.Iyengar@VERITAS.COM)
Date: Tue Jun 18 2002 - 18:48:56 EDT


Subrata,

Why don't you try this in your script?

If multiple files received, cat all the files in to one file. Rename this
file to match today's date. Pass this one text file to the database.

I am assuming that the receiving directory is clean before any files are
received.

1. Files received
2. ls|wc -l to establish if there is more than one file.
3.
for FILE in *.txt
do
cat $FILE >> TEMPFILE
done

mv TEMPFILE `date '+%Y%m%d'`.txt

4. Pass this one (renamed) file to the database script.

Regds,

Sunder Iyengar.

-----Original Message-----
From: Mondal, Subrata [mailto:SMondal@IMF.ORG]
Sent: Wednesday, 19 June 2002 01:26
To: aix-l@Princeton.EDU
Subject: help reqd

Hi Gurus:

1. I have already a scrpt which runs perfectly on my cron job
   but I need a small tinkering. This is what my process does:

   1. I get a flat file from an external source. The flat file
      has a date.ext eg : 20020617.txt
   2. My scrpt takes care of automatic ftp from their
      site.
   3. I bcp the flat file to my database - Mainly sybase
      Ver 11.9
   4. I run a stored procedure with the date as my parameter.

Now the tinkering in the scrpt :

Regularly I get a single file - My scrpt works fine
But I have cases when they do not send the file -
2 files comes in on teh same day
and there my problem starts. My scrpt at the databadse level taking the
date as parameters at the stored proc level does not work

How do I handle this scenerio - Can some one throw some lights on thelogic.

Subrata



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:00 EDT