473,472 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Remove import file after load

kk
Hello,

I am using the udb 8.1 task scheduler to schedule a load. Is there
any way to also schedule an OS command (win32) to delete the file
after the load? I have a python script that will do what I need, I
just need to call it after the load. One more question: is there
anyway to use the import (rather than the load) to import fixed width
data. It is scheduled every 10 minutes. I would rather insert and
update rather than load. Right now, I have an ugly hack written in
Python that concat's text files(IMS data) and drops them into a load
directory as one file. The DB2 scheduler runs and they are imported.
I just need to delete the file after load so I will not get duplicated
entries in my table. (I do have a primary key but the load seems to
ignore it). any suggestions would be appreciated.

Thank You,

Keith
Nov 12 '05 #1
5 2556
Use the exclamation mark in the db2 script file.

select ...
!del someFile

the ! means open an os shell and execute the command.

PM

"kk" <kk********@hotmail.com> a écrit dans le message de
news:44**************************@posting.google.c om...
Hello,

I am using the udb 8.1 task scheduler to schedule a load. Is there
any way to also schedule an OS command (win32) to delete the file
after the load? I have a python script that will do what I need, I
just need to call it after the load. One more question: is there
anyway to use the import (rather than the load) to import fixed width
data. It is scheduled every 10 minutes. I would rather insert and
update rather than load. Right now, I have an ugly hack written in
Python that concat's text files(IMS data) and drops them into a load
directory as one file. The DB2 scheduler runs and they are imported.
I just need to delete the file after load so I will not get duplicated
entries in my table. (I do have a primary key but the load seems to
ignore it). any suggestions would be appreciated.

Thank You,

Keith

Nov 12 '05 #2
The IMPORT command supports the ASC file type which is a fixed length
record. The METHOD options allow you to specify the beginning and ending
column locations in the input file. You can use the INSERT_UPDATE option if
there's a primary key on the table if you want to use SQL to modify the
table.
"kk" <kk********@hotmail.com> wrote in message
news:44**************************@posting.google.c om...
Hello,

I am using the udb 8.1 task scheduler to schedule a load. Is there
any way to also schedule an OS command (win32) to delete the file
after the load? I have a python script that will do what I need, I
just need to call it after the load. One more question: is there
anyway to use the import (rather than the load) to import fixed width
data. It is scheduled every 10 minutes. I would rather insert and
update rather than load. Right now, I have an ugly hack written in
Python that concat's text files(IMS data) and drops them into a load
directory as one file. The DB2 scheduler runs and they are imported.
I just need to delete the file after load so I will not get duplicated
entries in my table. (I do have a primary key but the load seems to
ignore it). any suggestions would be appreciated.

Thank You,

Keith

Nov 12 '05 #3
Ken
kk********@hotmail.com (kk) wrote in message news:<44**************************@posting.google. com>...
One more question: is there anyway to use the import (rather than the load) to import fixed width
Nope, and unfortunately neither import nor load appear to accept
multi-character delimiters.
any suggestions would be appreciated.


Well, the load should enforce your primary key, sounds like something
isn't right there. Imports are nicer for concurrency, but perhaps you
can get the load working better - sending your duplicate data off to
an exceptions table, etc.

You might want to take some precaution prior to loading to ensure that
you don't reload a file - in the event that your delete steps fails.
A check before the load to confirm that no files were left over from
the prior load could help.

Also, would it be simpler to run everything out of python and then
escape out to run the db2 load (using os.system, popen2.Popen3, etc)
than running everything out of db2 scripts and escaping out to run
python?

Lastly, there is a python dbi module for db2, writing a custom import
script might be the ticket.

ken
Nov 12 '05 #4
Ken
ke******@yahoo.com wrote:
No


Shoot, just realized that I was thinking about extracts, not imports
when I wrote this. Please ignore that comment and forgive me for
attempting to multitask over a sandwhich and db2. :-)

ken
Nov 12 '05 #5
kk
Thanks for the suggestions. I haven't worked with db2 in a long time
(although I tried hacking it to get it to run on my RH9 box several
months ago...with no success) I was under a time crunch due to
requirements changing daily (ugh!). I'd prefer to write everything in
python (or C#..nice plugin for VS.net) but just not enough time. I
changed my load to an import and used insert_update to ignore
duplicates via my PK. Nice to know that ! gives os commands.

Keith
ke******@yahoo.com (Ken) wrote in message news:<ea**************************@posting.google. com>...
ke******@yahoo.com wrote:
No


Shoot, just realized that I was thinking about extracts, not imports
when I wrote this. Please ignore that comment and forgive me for
attempting to multitask over a sandwhich and db2. :-)

ken

Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve Holden | last post by:
I'm trying to load module code from a database, which stores for each module its full name, code, load date and a Boolean indicating whether it's a package or not. The following simple program:...
4
by: MackS | last post by:
Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main():
2
by: Keith Chadwick | last post by:
I have been running some tests with regards to xsl:include and xsl:import with the same results on both and I am wondering if someone can explain this behavior to me! First off the xslt file is...
14
by: Demetris | last post by:
Hello people! I have a table with more than 30 million rows,a lot of columns and indexes. We need to change a column which is dec(15,2) and nullable to have a default value of zero. As I know you...
1
by: Nick Craig-Wood | last post by:
I've been dumping a database in a python code format (for use with Python on S60 mobile phone actually) and I've noticed that it uses absolutely tons of memory as compared to how much the data...
4
by: db2admin | last post by:
Hello, If i import data into tables, import will write all warnings in message file and will tell me why any exception row is rejected. I wanted to get exception rows in seperate table which i...
1
by: Christof Winter | last post by:
I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl" intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) The...
20
by: Nates | last post by:
I have a .bas file saved locally that I load into my Acces project to run a particular sub. I use the following code to load the module (which works fine): I use the following loop to remove...
6
by: falconsx23 | last post by:
I am trying to write a code for a Phone Directory program. This program is suppose to allow the user to enter a name or directory and then program can either add, save or even delete an entry. Also...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.