-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs_chk_dmpbufp.pl
executable file
·103 lines (75 loc) · 2.68 KB
/
js_chk_dmpbufp.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/perl
##########################################
# program name : js_chk_dmpbufp.pl
# Copyright © 2018 Jun Su Lee. All rights reserved.
# Modifier : Jun Su Lee ( [email protected] )
# Description : Check object id from db2pd -dmpbufp output
# Category : DB2
# Usage
# Date : January 18, 2018
# Revision History
# - Aug. 18 , 2018 : Add logic to grab object information in rows
# Usage example :
#$ js_chk_dmpbufp.pl -i='13369778.000.db2pd.fmt'
#
# ############ Checking the file : 13369778.000.db2pd.fmt
#
#PageNum PoolID ObjectID ObjectType = 183450 85 137 0
#PageNum PoolID ObjectID ObjectType = 46351 85 25 0
#PageNum PoolID ObjectID ObjectType = 133351 85 25 0
#PageNum PoolID ObjectID ObjectType = 72451 85 25 1
#PageNum PoolID ObjectID ObjectType = 2 85 19 1
#PageNum PoolID ObjectID ObjectType = 375152 85 25 1
#..<snippet>..
##########################################
### Pattern
#x0000 pageKey.pageID.pkPageNum 183450
#x0004 pageKey.pageID.pkPoolID 85
#x0006 pageKey.pageID.pkObjectID 137
#x0008 pageKey.pageID.pkObjectType 0
use strict;
use Getopt::Long;
my @fileList;
my $fileName;
## Global variables to have the values temporarily, this set should be printed out
my $pkPageNum;
my $pkPoolID;
my $pkObjectID;
my $pkObjectType;
GetOptions (
'i=s' => \$fileName,
)
or die "Incorrect usage !\n";
@fileList = glob($fileName);
sub doChkDmpbufp {
my ( $fn ) = @_ ;
open FH, $fn or die "\n\nNo such file $fn\n";
print "\n ############ Checking the file : $fn \n\n";
#print "PageNum PoolID ObjectID ObjectType \n";
while ( <FH> ) {
if ( m/^x0000\s+pageKey\.pageID\.pkPageNum\s+(\d+)/ ) {
#print "aaa=$1\n";
$pkPageNum = $1;
}
if ( m/^x0004\s+pageKey\.pageID\.pkPoolID\s+(\d+)/ ) {
$pkPoolID = $1;
}
if ( m/^x0006\s+pageKey\.pageID\.pkObjectID\s+(\d+)/ ) {
$pkObjectID = $1;
}
if ( m/^x0008\s+pageKey\.pageID\.pkObjectType\s+(\d+)/ ) {
$pkObjectType = $1;
print "PageNum PoolID ObjectID ObjectType = $pkPageNum $pkPoolID $pkObjectID $pkObjectType\n";
## reset the values after printing out
$pkPageNum="";
$pkPoolID="";
$pkObjectID="";
$pkObjectType="";
}
}
close FH;
}
foreach my $inputFile ( @fileList ) {
doChkDmpbufp $inputFile;
print "\n";
}