db2 commit for every 50 rows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting db2 commit for every 50 rows
# 1  
Old 02-19-2009
Bug db2 commit for every 50 rows

I am writing a unix shell script for the archive purge job.

During purging, the records will be deleted one by one. I didnot mention anything about db2 commit. By default, the records are commited one by one. Now I need to give commit for every 50 records deletion.

The deletion part is as follows.

Code:
while read line
do
 extractcount=`expr $extractcount + 1`
 
 timestampupdated=`expr substr "$line" 1 26`
 
 trackingnum=`expr substr "$line" 229 10`
 
 trackingnumsuffix=`expr substr "$line" 239 5`
 
 db2 -x "DELETE FROM $qualifier.ZB_FSCD_TXN_ERROR_MIG WHERE TIMESTAMP_UPDATED = '$timestampupdated' AND TRACKING_NUM = '$trackingnum' AND TRACKING_NUM_SUFFIX = $trackingnumsuffix" > delstatus
 ReturnCode_Delete=$?
 
 #check whether the record is deleted successfully or not
 if [ ReturnCode_Delete -eq 0 ]
       then
  deletecount=`expr $deletecount + 1`
  echo "$line" >> "$deletedfile"
 else
  notdeletecount=`expr $notdeletecount + 1`
  echo "$line" >> "$notdeletefile"
  cat delstatus >> $logfile
  echo "$line" >> "$logfile"
 fi   
 
done < $extractfile

using.
IBM DB2 8.1
Korn Shell script.

Can anyone help me out.

Thanks in advance.

Krishnakanth M
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

DB2 Query -Convert multi values from column to rows

Hi Team I am using DB2 artisan tool and struck to handle multi values present in columns that are comma(,) separated. I want to convert those column values in separate rows . For example : Column 1 Column2 Jan,Feb Hold,Sell,Buy Expected Result Column1 ... (3 Replies)
Discussion started by: Perlbaby
3 Replies

2. Shell Programming and Scripting

give ldap a/c during commit in commit line section

Is someone help me to achieve my goal I am working on a script actually script is working fine .The goal of script is restrict the user for something like while he is doing tocommit in repository he will commit with comment and with some parameter....here I have one more requirement and that is... (0 Replies)
Discussion started by: anuragpgtgerman
0 Replies

3. UNIX for Dummies Questions & Answers

how to capture no. of rows updated in update sql in unix db2

hi, i am a new user in unix..and we have unix db2. i want to capture the no. of rows updated by a update db2 sql statement and redirect into a log file. I've seen db2 -m...but not sure how the syntax should be. The update sql that I'm going to run is from a file... Can you please share... (1 Reply)
Discussion started by: j_rymbei
1 Replies

4. Shell Programming and Scripting

Commit in PL/SQL using Shell script

Hi All, I have written a shell script in which i am updating records in a table. It is a PL/SQL block. I have to use PL/SQL block as i am using bms_application_info.set_module package But the problem is once the script completes, i cannot see the updated records in Table. I mean result is... (0 Replies)
Discussion started by: Amit.Sagpariya
0 Replies

5. UNIX for Dummies Questions & Answers

Exception while loading DB2 driver Class.forName("com.ibm.db2.jcc.DB2Driver")

Hi... I m working on UNIX z/OS. Actually i have to pass the parameters from the JCL to java-db2 program thru PARM. I am able to pass the arguments but the problem occured is, it is throwing an exception while loading the db2 driver as 'Javaclassnotfound:com.ibm.db2.jcc.DB2Driver'... (0 Replies)
Discussion started by: Sujatha Gowda
0 Replies

6. UNIX for Advanced & Expert Users

cvs[commit aborted]:'root is not allowed to commit changes'

Hi , can u please any one of you give solution for this .. when am tryring to commit files from the CVS in Myeclipse J2ee Environment . that i coundnt able to commit and getting the Following error message cvs :'root' is not allowd to commit files' am using redhat enterprise 5 Server . (1 Reply)
Discussion started by: rksubash
1 Replies

7. UNIX for Advanced & Expert Users

any way to commit idle tasks in unix?

I need to do some code benchmarking in unix. On windows, it is always recommended that before you run any kind of benchmark, that you execute the command Rundll32.exe advapi32.dll,ProcessIdleTasks which commits idle tasks, so that hopefully this does not happen in the middle of your benchmark... (9 Replies)
Discussion started by: fabulous2
9 Replies

8. Shell Programming and Scripting

cvs diff then commit

I would like to run a cvs diff to check which files have been changed and then cvs commit these changed files. Does anyone have a shell script which will automate this process? (1 Reply)
Discussion started by: alangibson
1 Replies

9. AIX

commit

good morning Can you explain to me what is a "commit" (aix 5.3) ? There is no man for this command. thank you (1 Reply)
Discussion started by: pascalbout
1 Replies

10. Shell Programming and Scripting

flags to suppress column output, # of rows selected in db2 sql in UNIX

Hello, I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh. Here is the snippet. if ; then echo "Begin processing VALUEs" ... (1 Reply)
Discussion started by: jerardfjay
1 Replies
Login or Register to Ask a Question