What could be the issue ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What could be the issue ?
# 15  
Old 03-18-2014
Thanks it is done almost but it is coming in below format

Quote:
alter NAMELIST(CL.HOME_NL_NAMES) NAMES(CLUS1 ,CLUS2 ,CLUS3 ,CLUS4,CLUS5)
but i am looking here as
Quote:
ALTER NAMELIST(CL.HOME_NL_NAMES) +
NAMES(CLUS1+
,CLUS2+
,CLUS3+
,CLUS4+
,CLUS5)
in the above one there should be space front of +. Space is required only in first line. value should start in new line followed by ,

---------- Post updated at 10:36 AM ---------- Previous update was at 06:34 AM ----------

command is coming but it is not executing..
below is the code
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 | nawk '
$1~/^NAMELIST ?\(/ {nl=$0}
$1~/^NAMES ?\(/ {a=1}
a==1 {
  s0=s0 $0
  if (/\)/) {
sub( /\)/, ","add"\)", s0)
print "alter",nl,s0
    exit
  }
}' add="$3"

i ran script like below
Code:
./alterNamelist.sh QMGR MQ123 CLUS5

output is coming like below

Quote:
AMQ8552: WebSphere MQ namelist created.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
alter NAMELIST(CL.HOME_NL_NAMES) NAMES(CLUS1 ,CLUS2 ,CLUS3 ,CLUS4,CLUS5)
below command is coming but not getting executed. I think i need to put it in echo

Quote:
alter NAMELIST(CL.HOME_NL_NAMES) NAMES(CLUS1 ,CLUS2 ,CLUS3 ,CLUS4,CLUS5)
but i want it as like below

Code:
ALTER NAMELIST(CL.HOME_NL_NAMES) +
NAMES(CLUS1+
,CLUS2+
,CLUS3+
,CLUS4+
,CLUS5)

and it should execute

Last edited by darling; 03-18-2014 at 12:41 PM..
# 16  
Old 03-19-2014
I think the 'alter ...' command is like the previous 'define ...' command, so needs to be piped to your application in order to execute?
... | runmqsc -e $1
# 17  
Old 03-21-2014
Yes. but as there was S0 and bit of scripting. So i am not sure where to add this pipe. and actually i have given the alter namelist format which i am looking for in above.

alter name list we achived with your help is coming like below

Code:
alter NAMELIST(CL.HOME_NL_NAMES) NAMES(CLUS1 ,CLUS2 ,CLUS3 ,CLUS4,CLUS5)

but what i am looking is like below

Code:
ALTER NAMELIST(CL.HOME_NL_NAMES) + (infront of + there should be one space)
DESCR('$2') +                      (infront of + there should be one space)
NAMES(CLUS1+                       (No Space in front of + from here onwards) 
,CLUS2+ 
,CLUS3+ 
,CLUS4+ 
,CLUS5)

---------- Post updated 03-21-14 at 04:49 AM ---------- Previous update was 03-20-14 at 05:08 AM ----------

I tried giving "|runmqsc -e $1" next to below lines but it is not executed.

Like below

Code:
1. }' add="$3"|runmqsc -e $1
2. exit
  }|runmqsc -e $1

3. print "alter",nl,s0|runmqsc -e $1
4. sub( /\)/, ","add"\)", s0)|runmqsc -e $1

i tried these above 4 steps individually but alter namelist command didn't execute

Last edited by darling; 03-20-2014 at 07:44 AM..
# 18  
Old 03-24-2014
Hi,

Can you please let me know on executing the above command from script?
# 19  
Old 03-26-2014
This is correct:
Quote:
1. }' add="$3"|runmqsc -e $1
Because the shell should redirect the stdout from the screen to the runmqsc command.
Everything between the 'ticks'
Code:
nawk '
...
'

is an argument for nawk (and in awk syntax - not shell syntax).
You mean you want to put another DESCR command with the shell's $2 parameter?
Like the add="$3" (3rd shell parameter passed to the add awk variable),
we can pass the $2 to another awk variable.
Code:
...
echo 'dis nl('$NL') names ' | runmqsc $1 | nawk '
$1~/^NAMELIST ?\(/ {nl=$0}
$1~/^NAMES ?\(/ {a=1}
a==1 {
  s0=s0 $0
  if (/\)/) {
sub( /\)/, ","addname"\)", s0)
print "ALTER", nl, s0, "DESCR (", descr, ")"
  }
}' addname="$3" descr="$2" | runmqsc -e $1


Last edited by MadeInGermany; 03-26-2014 at 09:30 AM..
# 20  
Old 03-26-2014
Thanks.. It worked. Your help is much appreciated.
Good thing is you understood my techonlogy commands and output also

---------- Post updated at 08:48 AM ---------- Previous update was at 08:40 AM ----------

Below is the code which worked.

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 | nawk '
$1~/^NAMELIST ?\(/ {nl=$0}
$1~/^NAMES ?\(/ {a=1}
a==1 {
  s0=s0 $0
  if (/\)/) {
sub( /\)/, ","add"\)", s0)
print "alter",nl,s0
    exit
  }
}' add="$3" descr="$2" | runmqsc -e $1

---------- Post updated at 09:07 AM ---------- Previous update was at 08:48 AM ----------

There is an issue came..
When i am doing for large no of clusters it is throwing error like below

Code:
alter     NAMELIST(NT.CL.HOME_NL_NAMES)             NAMES(CLUS1                                   ,CLUS2                                   ,CLUS3                                   ,CLUS4                                   ,CLUS21                                  ,CLUS31                                  ,CLUS41                                  ,CLUS22                                  ,CLUS32                                  ,CLUS42                                  ,CLUS23                                                                  ,CLUS322                                 ,CLUS422                                 ,CLUS212                                 ,CLUS3D12                                ,CLUS4D12                                ,CLUS2S22                                ,CLUS3DD2S2                              ,CLUS4S22                                ,CLUS2D32                                ,CLUS3S32                                ,CLUS432                                ,CLUS5
AMQ8427: Valid syntax for the MQSC command:

  ALTER NAMELIST( namelist_name )
   [ DESCR( string ) ]
   [ NAMES( string ) ]
One MQSC command read.
One command has a syntax error.

It is giving because when there are large no of (more than 1 line) then it throws syntax error. If it is altering like below then it will work.

Code:
ALTER NAMELIST(BT.CL.HOME_NL_NAMES) +
NAMES(CLUS1+
,CLUS2+
,CLUS3+
,CLUS4+
,CLUS21+
,CLUS31+
,CLUS41+
,CLUS22+
,CLUS32+
,CLUS42+
,CLUS23+
,CLUS33+
,CLUS43+
,CLUS222+
,CLUS322+
,CLUS422+
,CLUS212+
,CLUS312+
,CLUS412+
,CLUS222+
,CLUS322+
,CLUS422+
,CLUS232+
,CLUS332+
,CLUS3s32+
,CLUS432+
,CLUS5)

out put: of
Code:
 dis NAMELIST(NT.CL.HOME_NL_NAMES)

is below



Code:
dis NAMELIST(NT.CL.HOME_NL_NAMES)
AMQ8550: Display namelist details.
   NAMELIST(NT.CL.HOME_NL_NAMES)           NAMCOUNT(21)
   NAMES(CLUS1
        ,CLUS2
        ,CLUS3
        ,CLUS4
        ,CLUS21
        ,CLUS31
        ,CLUS41
        ,CLUS22
        ,CLUS32
        ,CLUS42
        ,CLUS23
        ,CLUS33
        ,CLUS43
        ,CLUS222
        ,CLUS322
        ,CLUS422
        ,CLUS212
        ,CLUS312
        ,CLUS412
        ,CLUS222
        ,CLUS5
        ,CL06)                             DESCR(MQ123)
   ALTDATE(2014-03-26)                     ALTTIME(13.37.48)

# 21  
Old 04-01-2014
Code:
...
echo 'dis nl('$NL') names ' | runmqsc $1 | nawk '
$1~/^NAMELIST ?\(/ {nl=$0}
$1~/^NAMES ?\(/ {a=1}
a==1 {
  s0=s0 "+\n" $0
  if (/\)/) {
sub( /\)/, ","addname"\)", s0)
print "ALTER", nl, s0, "DESCR (", descr, ")"; exit
  }
}' addname="$3" descr="$2" | runmqsc -e $1

Add the blue stuff to split the line.
Add the green stuff to also alter the description.
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