473,725 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOS Batch file to run a Stored Procedure

2 New Member
I have a clean up proceudre that needs to be scheduled on weekly basis. My company owns a schedular that can kick off MS DOS Batch file for me.

If only I can execute the stored procedure from a .BAT file my work will be done.

I tried I created a simple batch file which uses DB2 CLP to execute the stored procedure, but I'm getting this error "SQL1024N A database connection does not exist. SQLSTATE=08003" when I run this batch file.

Batch file contains:

db2cmd -c -w -i db2 connect to DBNAME user ***** using *****
db2cmd -c -w -i db2 call PROCSHEMA.PROCN AME(INARG1, INARG2,?,?,?,?, ?) >ProcOutput.t xt

Please let me know how I can exstablish a connection or is there any better way to create a bacth file that can do a simple task like executing a procedure.

Any help is greatly appreciated. Thanks
Oct 5 '07 #1
2 11789
da123
2 New Member
The environment is DB2 UDB 8.2 and a client is installed on the local m/c
Oct 5 '07 #2
jooh
1 New Member
Try running the connect and the SP call in one db2 script and have the scheduler run the CLP with the script file...

script.sql:
connect to DBNAME user ***** using *****;
call PROCSHEMA.PROCN AME(INARG1, INARG2,?,?,?,?, ?);
db2cmd /c /w db2 -tvf script.sql -z script.out
Nov 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
6915
by: Lauren Quantrell | last post by:
Just wondering if this is good form: Alter Procedure "mySPName" @UniqueID int AS set nocount on set xact_abort off DELETE FROM tblNameOne
1
1383
by: Compkitty | last post by:
Hi, I'm sort of new to Stored Procedures; and I'm building a search page where there are 9 parameters the user can put in; as little as 1, at most 9.. then it runs the Stored P and looks at the values. I am using the COALESCE; to skips nulls,... but I'm still not getting the right results.. either I get 0 or 4000.. CREATE PROCEDURE Sp_Search ( @AcctNum varchar (100),
10
3739
by: Thomas R. Hummel | last post by:
I have a stored procedure that suddenly started performing horribly. The query plan didn't look right to me, so I copy/pasted the code and ran it (it's a single SELECT statement). That ran pretty well and used a query plan that made sense. Now, I know what you're all thinking... stored procedures have to optimize for variable parameters, etc. Here's what I've tried to fix the issue: 1. Recompiled the stored procedure 2. Created a new,...
1
3682
by: DB_2 | last post by:
Hello, I created the following stored procedure. (Please ignore the logic in it; at this point it is not complete and I am trying to get the basic structure working first.) CREATE PROCEDURE upgrade_sal () LANGUAGE SQL BEGIN DECLARE eldest INT;
6
2803
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses Dynamic SQL to Bulk Insert the file to a temp table then processes it into the final table.) My...
1
2444
by: sshankar | last post by:
Hi, New to Stored procedure. Basically just installed DB2 v8.1.0.36 Was trying to build a stored procedure.. It is giving following error.. Looks like some error related to configuration files... Can you help I tried to have a look at all the files .. however unable to solve it .. can anyone let me know what i'm missing.. This is what i'm getting db2admin.PROCEDURE1 - Build started.
0
1914
by: sree078 | last post by:
Hi I have written stored procedures to create a database with db name as input parameter I need to create a batch file to run the stored procedure with input value given in the command prompt along with the batch file will be my dbname which will be used by the stored procedure to create the databse. Plz could any one help me out to create code to create a batch file
0
3190
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
2147
by: piperdawn | last post by:
Hi Guys, We have a requirement wherein when the value in the column of a particular DB2 table changes to a certain value, a job must be triggered which will execute a program and generate a report. This is in a Z/OS environment and we use DB2 for Z/OS version 8. I had thought of the following solution for this – Ø Create an ‘after update’ DB2 trigger which would call a DB2 stored procedure (could be written in REXX or COBOL) when...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9179
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4519
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
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 we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.