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.
#!/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
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.
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
dis NAMELIST(NT.CL.HOME_NL_NAMES)
is below
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)