#!/local/bin/perl ####################################################################### # Create a pink dbm with patents in db2 with a non-null license flag # (And, create the matching pinkYYMMDD.lst file, for reference.) ####################################################################### if ($#ARGV >= 0) { print "Usage is: $0\n"; print " Creates a pink dbm from patents in db2 with a non-null license_flag\n"; exit 100; } $dbname = "pink"; # Get rid of the existing dbm system("rm -f $dbname.pag $dbname.dir"); #------- Open the pinkYYMMDD.lst output file ------- @ltime = localtime; $mon=@ltime[4]+1; $ts = substr("0@ltime[5]",-2).substr("0$mon",-2).substr("0@ltime[3]",-2); $outfile = ">pink$ts.lst"; open(OUT, $outfile) || die "Could not open $outfile"; $db2cmd = 'db2 "select patn from inst1.main where license_flag is not null"'; dbmopen(%PINK, $dbname, 0664) or die "Cannot open $dbname for writing\n"; #------- Connect to the database and issue the query ------- system(qw(db2 connect to patent user ipsrun using ipsrun_password)); open(DB2, "$db2cmd|") || die "Can't exec: $!"; print STDOUT "$db2cmd\n\n"; #------- Process the output of the query ------- # I'm lazy, let's just toss the first 3 lines chop($out1 = ); chop($out2 = ); chop($out3 = ); while () { chop($patn = $_); $l = length($patn); if ($l == 12) { $PINK{$patn} = 1; print OUT "$patn\n"; } elsif ($patn =~ /\s*(\d+) record.*/) { print STDOUT "$1 patents now in the pink dbm\n\n"; } } #------- Terminate our db2 connection and other cleanup ------- close(DB2); system(qw(db2 terminate)); dbmclose(%PINK); close(OUT); #------- Hints for our user ------- # penguin: #print STDOUT "\n\nNext, do: cp -p pink.pag pink.dir /arc/ipn/config\n"; #print STDOUT "Then, after testing, do:\n"; #print STDOUT "scp -p pink.pag pink.dir xxx\@ar0073e0:/dfs/proj/ipn/config\n"; # 301: print STDOUT "\n\nNext, do: cp -p pink.pag pink.dir /dfs/proj/ipn/config\n"; print STDOUT "(And then you can test, using node 16 or www7.)\n";