The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
FTP Return Code wilsonSurya UNIX for Dummies Questions & Answers 1 10-06-2008 07:27 AM
to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's manas6 UNIX for Dummies Questions & Answers 0 06-05-2008 06:44 AM
asking about return code naamas03 Shell Programming and Scripting 3 08-28-2007 04:53 AM
Incorporte Return Code u263066 Shell Programming and Scripting 2 09-06-2006 04:58 AM
Return Code of tar in AIX dupeng AIX 3 02-23-2004 12:05 AM

Closed Thread
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
  #1 (permalink)  
Old 11-26-2008
mac4rfree mac4rfree is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 168
Need help with return code 1...

Hi Guys,,

I am having a unix script which is running the DB2 Insert command.
For the insert command, there were no records to be updated.

SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
+ + echo 1
STAGE_RC=1
+ [[ 1 != 0 ]]

Because of this, it is returning return code as 1.
My script will work, only if this part of the script is successful as u can see the in the code above.

all 1 in the codes are return code.

is it because of the DB2 insert statement or is it due to something else..When will the return code be 1??
  #2 (permalink)  
Old 12-05-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
I found your post confusing. What command do you run that gives you the exit code of 1? The output you showed above is an unsuccessful fetch/update/delete because the table was empty. I would expect a 1 returned from such a script.
  #3 (permalink)  
Old 12-11-2008
mac4rfree mac4rfree is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 168
sorry guys i inserted the script but somehow the log file got pasted..
  #4 (permalink)  
Old 12-11-2008
mac4rfree mac4rfree is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 168
thanks otheus,, so in the case of no rows found for update or insert,, the return code willl be 1.. rite??

But the same script is running fine, for the other family codes which also shares the same scenario.. (No rows found for update or insert)

could you please explain me that?
  #5 (permalink)  
Old 12-11-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
Like I said, I would expect the return code from such a command to be 1. But since you did not post the command, I cannot possibly know. I probably wouldn't know anyway, since I have very little experience with DB2. I recommend you repost in the "Database" or "AIX" forums with "such-and-such command sometimes returns 1 on failure".
  #6 (permalink)  
Old 12-11-2008
mac4rfree mac4rfree is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 168
This is the piece of code causing trouble.. otheus..

db2 "insert into table \
(col,,,,\
) \
select * from tab1 a, tab2 b where\
a.id=b.id \
with ur"

STAGESUM_RC=`echo $?`
if [[ $STAGESUM_RC != "0" ]] ; then
ReturntoParent $STAGESUM_RC "Error in Insert Fact Stage_Sum"
fi
db2 "commit"
  #7 (permalink)  
Old 12-11-2008
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,886
I doubt this will change anything, but it's better to change the first line to:
Code:
STAGESUM_RC=$?
Still, the db2 error indicates that your select * is failing. Is it possible that select sometimes returns an empty result?
Closed Thread

Bookmarks

Tags
return code 1

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 06:56 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