substitue of values.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting substitue of values.
# 1  
Old 08-17-2008
substitue of values.

$db2 connection ...........Q

a=`$db2 -x "select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur"`
b=`$db2 -x "select B from tablename where z in (select z from tablename Q where condition fetch first 1 rows only) with ur"`

$db2 connection ...........W

c=`$db2 -x "select C from tablename W where R in ('$a') with ur"`


this is a part in my script.

The problem is the value of a is not getting substituted in '$a'. Please help.
# 2  
Old 08-17-2008
There is nothing in what you posted which would seem to disable variable expansion. Indeed, you can test it on the command line:

Code:
vnix$ db2=echo
vnix$ a=`$db2 -x "select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur"`
vnix$ c=`$db2 -x "select C from tablename W where R in ('$a') with ur"`
vnix$ set | grep ^c=
c='-x select C from tablename W where R in ('\''-x select A from tablename where z in (select z from tablename Q where condition fetch first 1 rows only ) with ur'\'') with ur'

# 3  
Old 08-17-2008
Thx a lot for trying to help me.

Now i have rectified that mistake.

can we use substr for the decimal type of data?

I get Error like this
SQL0440N No authorized routine named "SUBSTR" of type "FUNCTION" having
compatible arguments was found. SQLSTATE=42884
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed substitue whole file + 1 substitue with variables on one sed line?.

I'm trying to remove '--X' from the whole file and using variables replace $oldvar with $newvar. I have tried with double quotes but it doesn't seem to work. $newvar is set to /usr/bin/bash. Would appreciate some guidance. newvar=$(which bash) oldvar=/bin/bash sed... (1 Reply)
Discussion started by: itman73
1 Replies

2. Shell Programming and Scripting

awk file to read values from Db2 table replacing hard coded values

Hi, I want to replace a chain of if-else statement in an old AWK file with values from Db2 table or CSV file. The part of code is below... if (start_new_rec=="true"){ exclude_user="false"; user=toupper($6); match(user, "XXXXX."); if (RSTART ==2 ) { ... (9 Replies)
Discussion started by: asandy1234
9 Replies

3. Shell Programming and Scripting

Converting odd values to even values(or vice-versa) located in a column

Hello All, I have a below data in a .csv file where all rows where col1 is A, col2 is odd numbers, similarly even numbers for all rows where col1 is B. Note that my data has some other columns(not shown here) too (around 100) after col2. Tool,Data A,1 A,3 A,5 .... so on B,2 B,4 .... ... (4 Replies)
Discussion started by: ks_reddy
4 Replies

4. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

5. Homework & Coursework Questions

Bash Scripting - sed (substitue)

1. The problem statement, all variables and given/known data: I have been asked to create a bash script to delete comments from another file but in the file they have an echo command with this inside of it /* this is an echo */\ so obviously they want to keep this one in the file. I have found... (5 Replies)
Discussion started by: syco__
5 Replies

6. Shell Programming and Scripting

How to pick values from column based on key values by usin AWK

Dear Guyz:) I have 2 different input files like this. I would like to pick the values or letters from the inputfile2 based on inputfile1 keys (A,F,N,X,Z). I have done similar task by using awk but in that case the inputfiles are similar like in inputfile2 (all keys in 1st column and values in... (16 Replies)
Discussion started by: repinementer
16 Replies

7. UNIX for Dummies Questions & Answers

Substitue 'Special Characters' in VI

Hi All, I am using LATEX and need to delete all the lines in a file matching: \begin{work} I know there are several ways to do this, but I am trying to do it with the substitute command in VI. The problem is I can't get substitute to recognize the character '\'! How do I do it? ... (7 Replies)
Discussion started by: ScKaSx
7 Replies

8. Shell Programming and Scripting

sed command - substitue first instance

hi i have one file where i want to substitute only first instance of swap with swap1 i want to replcae only first instance of swap in my script i know we can do this with awk. but i need to do this with sed only i tried follwoing code sed 's/swap/swap1' filename but here all... (15 Replies)
Discussion started by: d_swapneel14
15 Replies

9. Shell Programming and Scripting

Need to substitue space with \n

I have a file with a single line in it as below. field1 field2 field3 Different fields separated by spaces. I need the output as below. field1 field2 field3 Any sed/awk solution you can suggest? (6 Replies)
Discussion started by: krishmaths
6 Replies

10. UNIX for Advanced & Expert Users

Need help for VNS substitue solution.....

Hello Unix Gurus, We are doing large system upgrade. We expect upgrade to last 180-200 hours. The servers are located remotely. I am looking for solution which allows me to reconnect to the same session active on unix server where I launched the process. This would protect from local client... (0 Replies)
Discussion started by: mehtasa
0 Replies
Login or Register to Ask a Question