What could be the issue ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What could be the issue ?
# 1  
Old 02-07-2014
What could be the issue ?

Hi,

when i am trying below script

assume that below values are taken in code
Quote:
QMGR= SUN
NAME= RSB
MQREQ= MQ123
Code:
#!/bin/ksh
if [ $# != 3 ]
then
echo usage: aNlist.sh QMGR NAME MQREQ
fi

NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1`
echo 'define nl('$NL_$2') like('$NL')'|runmqsc $1

i am getting below output from below command

Code:
NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1`

Output from above code is

Quote:
TEMP
now i am trying to take backup from below command which is failing.

below command will take backup

Code:
define nl('$NL_$2') like('$NL')

I am trying to take back up as

Quote:
define nl(TEMP_MQ123) like(TEMP)
but it is doing as

Quote:
define nl(RSB) like(TEMP)
Where is the issue?
# 2  
Old 02-07-2014
Code:
$NL_$2

uses a variable called NL_

Code:
$ NL_=6
$ NL=7
$ echo $NL_
6
$
$ echo ${NL}_
7_
$

# 3  
Old 02-07-2014
when i use below command
Code:
echo 'define nl({'$NL_$2'}) like('$NL')'|runmqsc $1

i am getting below output
Quote:
define nl({RSB}) like(TEMP)
when i use below command

Code:
echo 'define nl('{$NL}_$2'}) like('$NL')'|runmqsc $1

Quote:
define nl({TMP}_RSB}) like(BT.CL.HOME_NL_NAMES)
but i don't want { and } as command can't run with it

i am looking for
Quote:
define nl(TEMP_RSB) like(TEMP)
---------- Post updated at 11:16 AM ---------- Previous update was at 11:09 AM ----------

Thanks, i got it how to apply your answer and it worked now.
This User Gave Thanks to darling For This Post:
# 4  
Old 03-06-2014
i am trying to append the existing one.. and add the value at the last for example

when i fire below command

Code:
 dis nl(RSB)

output is

Quote:
NAMELIST(RSB) NAMCOUNT(3)
NAMES(ONE
,TWO
,THREE)
now i am trying to alter the namelist with below command

Code:
 alter nl(RSB) NAMES(ONE,TWO,THREE,$3)

but i don't know how to edit the existing one and add $3 in the last.
# 5  
Old 03-06-2014
Something like this?
Code:
awk '/^NAMES\(/ {a=1} a==1 {s0=s0 $0; if (/\)/) {sub("\)",","add"\)",s0); print s0; exit} }' add='$3' <output

# 6  
Old 03-07-2014
Hi,

Below one is the script

Code:
#!/bin/ksh
if [ $# != 3 ]
then
echo usage: alterNamelist.sh QMGR MQREQ NAME
fi

NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1`
echo 'define NAMELIST('$NL'_'$2') like('$NL')'|runmqsc -e $1

When i run alterNamelist.sh like below

Quote:
./alterNamelist.sh QM1 MQ123 AUSTRALIA
above code does the activity taking back up

Quote:

define NAMELIST(WORLD_MQ123) like(WORLD)
till here i could do...

Now i want to do 2nd activity - editing existing by adding new names like below


below is command

Code:
dis NAMELIST(WORLD)

output of above one is
Quote:

NAMELIST(WORLD) NAMCOUNT(3)
NAMES(ASIA
,EURPOE
,US) DESCR(MQ0000)
Now i want to edit "WORLD"'S property "NAMES"

When i do manually i do it like below

Quote:

ALTER NAMELIST('WORLD') +
DESCR('MQ123') +
NAMES(ASIA+
,EUROPE+
,US+
,AUSTRALIA)
i am trying to do ALTER NAMELIST part by script.. I am failing to add + and ' and ,

Last edited by darling; 03-07-2014 at 09:32 AM..
# 7  
Old 03-17-2014
Hi,

I didn't get any answers, i tried below one.
this script name is fr.sh

Code:
#!/bin/ksh
if [ $# != 3 ]
then
echo usage: alterNamelist.sh QMGR MQREQ NAME
fi

NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1`
echo 'define nl('$NL'_'$2') like('$NL')'|runmqsc -e $1

echo 'dis nl('$NL') names '|runmqsc $1

from below code i am getting output

Code:
echo 'dis nl('$NL') names '|runmqsc $1

OUTPUT

Code:
 dis nl(HOME_NL_NAMES) names
AMQ8550: Display namelist details.
   NAMELIST(HOME_NL_NAMES)
   NAMES(CLUS1
        ,CLUS2
        ,CLUS3)

Now below thing is i am trying to do

when i run my script like below

Code:
./fr.sh QM MQ123 CLUS4

it should do like below

Code:
alter NAMELIST(HOME_NL_NAMES) +
      DESCR(MQ123) +
      NAMES(CLUS1+
           ,CLUS2+
           ,CLUS3+
           ,CLUS4)

can some one suggest me to achive above one
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with wc -c and wc -m

Hi All, I have a small queries to get the character count i tried with wc -c and wc -m but its not returend current result For eg: wc -c wc -m echo "Name" | wc -c result: 5 but actually it should returned 4 Help me on this to ge the correct one. Thanks! ----------... (4 Replies)
Discussion started by: siva.pitchai
4 Replies

2. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

3. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

4. Shell Programming and Scripting

CP Issue

I want to copy large amount of files aproximately more than 20,000 files from one file system to another file system, but it gives me error like: #cd /opt/appserver/images #cp * /opt/appserver02/public/images Argument list is too long Also above mention error appear again when i run: ... (1 Reply)
Discussion started by: telnor
1 Replies

5. Solaris

IP issue

hi , I have a Solaris server which is part of a domain. The IP for this Solaris box is allocated dyanamically by a DHCP. Everytime the solaris box is restarted the IP gets changed. Being an admin what should i do to find the new ip of the Solaris server sitting at my location? Till now i get... (2 Replies)
Discussion started by: BalajiUthira
2 Replies

6. UNIX for Dummies Questions & Answers

ISSUE and ISSUE.NET files

In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH). Thanks (0 Replies)
Discussion started by: ejjones
0 Replies

7. Shell Programming and Scripting

hi all please help me in this issue.

Hi all, I am very new to shell scripting.I have the requirement like one program is there, if it is running leave like that only and if it is stopped it has to be restart and once again keep watching and it is stopped we a have to restart once agian.I want a shell script for this.Please help me... (10 Replies)
Discussion started by: bhas85
10 Replies

8. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

9. UNIX for Dummies Questions & Answers

ps issue

HI All, Suddenly don't know what happened to redhat linux 7.2 any program start then itsn't listing while using ps -ef ex: ./xyz this xyz program pid not showing in ps-ef Pls let me know what is the reason for the same. Thanks a lot in advance Bache (7 Replies)
Discussion started by: bache_gowda
7 Replies
Login or Register to Ask a Question