The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to get SQLCODE ? regnumber UNIX for Advanced & Expert Users 1 10-15-2008 02:10 AM
return DB2 SQLCODE kjaisan Shell Programming and Scripting 0 11-16-2005 01:00 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-23-2008
kmanivan82 kmanivan82 is offline
Registered User
  
 

Join Date: Oct 2008
Location: Chennai, INDIA
Posts: 19
how to get SQLcode

I am doing Archive Purge for a table. Following is the script ...


Code:
#! /bin/ksh
############################
#   AFI Monitor Script
############################
. /db2/uszlad48/sqllib/db2profile
export mondir=/home/bmwdev1/script/krishna/arc
export monlog1=$mondir/Archive_ZB_RCBL_ERROR_MSG_MIG_`date +%Y%m%d`.log
# connect to DB
db2 "connect to r2pdev user bmwdevup using summer08"
# extract the records from the table ZB_RCBL_ERROR_MSG_MIG
db2 -x "SELECT * FROM ZB_RCBL_ERROR_MSG_MIG WHERE TIMESTAMP_UPDATED < (CURRENT TIMESTAMP - 1 YEAR) WITH UR" >> "$monlog1"
echo "extraction completed"
while read line
do
 trackingnum=`expr substr "$line" 1 12`
 trackingnumsuffix=`expr substr "$line" 27 6`
 msgnum=`expr substr "$line" 47 5`
 tstmp=`expr substr "$line" 185 26`
#Delete the extracted records one by one
 db2 "DELETE FROM ZB_RCBL_ERROR_MSG_MIG WHERE TRACKING_NUM = '$trackingnum' AND TRACKING_NUM_SUFFIX = $trackingnumsuffix AND TIMESTAMP_UPDATED = '$tstmp'"
done < "$monlog1"
echo "purging completed"
# disconnect from DB2
db2 terminate
exit 0

While in the delete query I need to know whether the DELETE query is executed successfully or not. In mainframes we will be having SQLCODE to check this condition.

DB using is IBM DB2 Version 8.1

Using Shell script how to get the SQLCODE or else any other way to know whether the row is deleted successfully or not.

Can any one help us to fix this problem

Krishnakanth
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0