Shaunn,

You need a shell script for this.  Example:

   #!/bin/ksh

   db2 connect to $db
   for file in /directory/*.ixf ; do
     tab=$(basename ${file} | cut -d. -f1)
     db2 "import from ${file} of ixf replace_create into ${tab}"
   done
   db2 terminate


Good luck.




----- Original Message ----- 
From: "Johnson, Shaunn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 20, 2001 1:37 PM
Subject: DB2EUG: SQL and Shell / perl?


> Howdy:
> 
> Sorry if this seems silly or lame.  
> 
> I want to automate loading ixf files into my
> database.  I'm not sure if it's do-able.
> 
> For example, I want to say in a shell (or perl)
> script:
> 
> for I in  `ls -1 /this/directory/*ixf`
> do
> db2 -tf make.script
> done
> 
> But I'm not sure if I can create a make script
> that looks at a list of *ixf files and 
> implements something like:
> 
> db2> import from /this/directory/clients.ixf of ixf replace_create into
> clients
> 
> I hope I'm describing this correctly.  I want to automate that part
> taken from a list of IXF files I get from another place and time.  So
> the end results would be something like:
> 
> for I in `ls -1 /this/directory/*ixf`
> do
> connect to database user joe using joespassword
> import from $i of ixf replace_create into `$i | cut -d. -f1`
> terminate
> done
> mail $address < /tmp/finish_results.txt
> 
> 
> In my mind, this seems straight forward, but I don't know
> enough about SQL to say whether or not I can add external
> commands to pass an argument.
> 
> Suggestions?
> 
> -X
> 


=====
To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
For other info (and scripts), see http://people.mn.mediaone.net/scottrmcleod

Reply via email to