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
Problem In Shell Script satyakide Shell Programming and Scripting 11 09-24-2007 10:00 AM
Help! Problem with Shell Script. pektl Shell Programming and Scripting 7 05-29-2006 05:08 AM
Problem with SU or SSH in shell script sravanp UNIX for Dummies Questions & Answers 2 01-24-2006 12:00 PM
Shell Script problem bnohifi Shell Programming and Scripting 1 07-07-2005 02:02 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-12-2007
arnie_nits arnie_nits is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 1
Question Problem in shell script


Hi,

I have written a script which calls a stored procrdure. The Stored procedure has 2 inputs and 6 outputs. I need to capture one of the outputs.
But I am not able to get any result from this simple script-

! /bin/ksh
echo "connect to dbau user etlbitst using anf1892;" > /tmp/Nscript3.sql
echo "call CORRTEST.XSD060('${1}', '${2}',?,?,?,?,?,?);" >> /tmp/Nscript3.sql
db2 -tvf /tmp/Nscript3.sql -z /tmp/Nscript3.out > /dev/null
OutPut2=`head -12 /tmp/Nscript3.out | tail -1`
rm -f /tmp/Nscript3.out
RtrnCode=`echo $OutPut2 | cut -c3-19`
echo $RtrnCode

please let me know if there is any mistake.....

Regards
Arnie
  #2 (permalink)  
Old 12-12-2007
Vicky Narayan Vicky Narayan is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 21
Hi Arnie,

Are you able to execute the proc from ur shell script? I guess you wont be able to do so...Seems ur database is DB2...
Ur shell script doesn't have any command to connect to database.....

db2 -tvf /tmp/Nscript3.sql -z /tmp/Nscript3.out > /dev/null

I dont ve any idea about this command but i guess in no way this command going to connect the shell to the database...

The /tmp/Nscript3.sql file contains the procedure call....

I ll tell you another simple approach....
First get connected to the database....
Then just call the procedure and store its output in some variables....This way you ll not to have to use the temp file...

I have been using this process in many of my scripts...Try it out...
Sponsored Links
Closed Thread

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 03:50 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