I tried to store information from below command using perl code,
dis ql(*) all\'|runmqsc MQ_NAME
Assume the output from this command
You have to check if the QName is matched and remember it:
#!/usr/bin/perl
use warnings;
use strict;
my %QM;
my $qm = 'MQ_NAME';
open (CHS_OUT, "result.txt");
my $QName;
while () {
my ($QUEUE, $QName1) = / ( QUEUE ) \( ( [^)]+ ) /x;
if ($QName1) {
$QName=$QName1;
}
if ( my ($item, $value)
= / ( CURDEPTH | MAXDEPTH ) \( ( [^)]+ ) /x )
{
$QM{$QName}{$item} = $value;
}
}
foreach my $Que (sort keys %QM) {
foreach my $v (keys %{ $QM{$Que} }) {
print "$Que : $v = $QM{$Que}{$v} \n";
}
}
OUTPUT:
SYSTEM.RETAINED.PUB.QUEUE : CURDEPTH = 2
SYSTEM.RETAINED.PUB.QUEUE : MAXDEPTH = 999999999
SYSTEM.SELECTION.EVALUATION.QUEUE : CURDEPTH = 0
SYSTEM.SELECTION.EVALUATION.QUEUE : MAXDEPTH = 999999999
SYSTEM.SELECTION.VALIDATION.QUEUE : MAXDEPTH = 999999999
SYSTEM.SELECTION.VALIDATION.QUEUE : CURDEPTH = 0