
gurki88
New User
Jul 13, 2009, 4:30 AM
Post #1 of 1
(573 views)
|
Hi guys,,,, This is extremely URGENT ... Im an intermediate perl programmer. Im developing a script for accessing database contents and displaying them on html page, filtering on the basis of user input supplied in the form. However im having a strange problem. I usually extract data frm databse, and store in a file. When the file contents( records) are small, in the range of 300-800, then it displays succesfully. But when the file records exceed that limit, say near 1000 records, then the html page displayes only the page heading and nothing below it. Does anyone know why did this happen ? Has anyone experienced such a problem ?? Kindly reply here , or at my email adress: gurkiratstation@gmail.com
#!/usr/bin/perl use Date::Calc qw(Delta_Days); print <<HTML; Content-type: text/html\n\n <html><head> <script type="text/javascript"> function newPopup(url) { popupWindow = window.open( url,'popUpWindow','height=400,width=1200,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } </script> <title>MRM/TRM System</title> <body > HTML print "<br/>"; ########## GET INPUT PARAMETERS FROM FORM $input=$ENV{QUERY_STRING}; @key_value=split(/&/,$input); foreach $pair (@key_value){ ($key, $value) = split(/=/, $pair); $value=~s/%(..)/pack("C", hex($1))/ge; $value=~s/\+/ /g; $value =~ s/\n/ /g; if (!defined $input{$key}) { $input{$key} = $value; } else { $input{$key} .= ','.$value; } } $source=$input{'source'}; chomp($source); ############## CHECK THE SOURCE SCRIPT if($source eq "top") { $tenure=$input{'tenure'}; $name=$input{'top'}; @fname=split "\," ,$name; chop($tenure); print "<form name=\"export\" action=\"http://vl-gbedi:8080/cgi-bin/export.cgi\" method=\"post\">"; print "<input type=\"hidden\" name=\"query\" value=\"queryfile2\">"; print "<input type=\"hidden\" name=\"acname\" value=\"$fname[0]\">"; print "<image src=\"/xls.jpg\" align=\"right\"><input type=\"image\" align=\"right\" src=\"/exp.jpg\" height=\"45\" width=\"160\">"; print "</form></br/>"; print "<p align=\"center\"><b style=\"font-family:Arial;font-size:16px;color:Blue\">You Queried For</b><br/><table align=\"center\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\"><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Name </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $fname[0]</b></td></tr><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Tenure </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $tenure Months</b></td></tr></table></p>"; $fileName = "/home/gbedi/apache/cgi-bin/queryfile2.txt"; $ccrqueryDir = "/grid/common/pkgs/ccrtools"; `CCRDIR="$ccrqueryDir"; QUERY="accountname in ($name) and family like 'CIC%' and origsubmitdt <= (to_char(sysdate,'mm/dd/yyyy')) and origsubmitdt >= to_char((add_months(sysdate,-$tenure)),'mm/dd/yyyy') and repseverity !=2 and engagementtype='M' "; export CCRDIR QUERY; $ccrqueryDir/ccrcquery -sort id -id -accountname -repurgency -repseverity -stateabbrev -origsubmitdt -title -keywords -checkindt -rtmdt -enghotfixdt > $fileName`; } elsif($source eq "index") { $urg=$input{'urg'}; $sev=$input{'sev'}; $name=$input{'name'}; $sday=$input{'sday'}; $smonth=$input{'smonth'}; $syear=$input{'syear'}; $eday=$input{'eday'}; $emonth=$input{'emonth'}; $eyear=$input{'eyear'}; if ($urg eq "All" ) { $urg="'D','U'"; } $sdate=$smonth."/".$sday."/".$syear; $edate=$emonth."/".$eday."/".$eyear; print "<form action=\"http://vl-gbedi:8080/cgi-bin/export.cgi\" method=\"post\">"; print "<input type=\"hidden\" name=\"query\" value=\"queryfile1\">"; print "<input type=\"hidden\" name=\"acname\" value=\"$name\">"; print "<image src=\"/xls.jpg\" align=\"right\"><input type=\"image\" align=\"right\" src=\"/exp.jpg\" height=\"45\" width=\"160\">"; print "</form><br/>"; print "<p align=\"center\"><b style=\"font-family:Arial;font-size:16px;color:Blue\">You Queried For</b><br/><table align=\"center\" border=\"0\" cellspacing=\"3\" cellpadding=\"2\"><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Name </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $name</b></td></tr><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Severity </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $sev</b></td></tr><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Urgency </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $urg</b></td></tr><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">Start-Date </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $sdate</b></td></tr><tr><td><b style=\"font-family:Georgia;font-size:14px;color:Maroon\">End-Date </b></td><td><b style=\"font-family:Georgia;font-size:14px;color:DarkBlue\"> $edate</b></td></tr></table></p>"; @newname=split ",",$name; my @name2; foreach $n(@newname) { $n="'".$n."'"; if($n ne $newname[-1]) { $n=$n.","; } push(@name2,$n); } $fileName = "/home/gbedi/apache/cgi-bin/queryfile1.txt"; $ccrqueryDir = "/grid/common/pkgs/ccrtools"; `CCRDIR="$ccrqueryDir"; QUERY="accountname in (@name2) and family like 'CIC%' and origsubmitdt >='$sdate' and origsubmitdt <='$edate' and repseverity in($sev) and repurgency in($urg) and engagementtype='M' "; export CCRDIR QUERY; $ccrqueryDir/ccrcquery -sort id -id -accountname -repurgency -repseverity -stateabbrev -origsubmitdt -title -keywords -checkindt -rtmdt -enghotfixdt > $fileName`; } ################ PRINT THE RECORD DETAILS $s1=0; $s0=0; $fixed=0; $void=0; $inactive=0; $validated=0; $checkedin=0; $answered=0; $open=0; $lcount=0; open (COUNT,"<$fileName") or die "CANNOT OPEN FILE"; while($in = <COUNT>) { $lcount++; if($lcount>=4) { chomp($in); @line=split('\|',$in); if($line[3]==0){ $s0++; } if($line[3]==1){ $s1++; } } } close(COUNT); $lcount=$lcount-3; ########################## if($lcount <=0) { print "<br/><p align=\"center\" style=\"font-size:22px;color:Blue\">QUERY RESULTS</p>"; print "<br/><h1 align=\"center\">SORRY , NO MATCHING RECORDS FOUND !!!</h1><br/>"; } else{ print "<br/><p align=\"center\" ><image src=\"/bar.gif\"></p><br/>"; print "<p align=\"center\" style=\"font-size:22px;color:Blue\"><u>QUERY RESULTS</u><br/><b style=\"font-size:20px;color:Black\">Total Records : $lcount</b></p>"; } ######################### $fix=0; $del=0; for($k=0;$k<2;$k++) { $x=1; $fixed=0; $void=0; $inactive=0; $validated=0; $checkedin=0; $answered=0; $open=0; $numc=0; $numuc=0; $numred=0; $lcount=0; $fix=0; $del=0; if(${"s".$k} !=0) { open (COUNT,"<$fileName") or die "CANNOT OPEN FILE"; while($in = <COUNT>) { $lcount++; if($lcount>=4) { chomp($in); @line=split('\|',$in); $acname=$line[1]; $acname =~s/\s+$//; $sev=$line[3]; if($line[3]==$k){ @checkin=split("-",$line[8]); ###### GET CHECKIN DATE $mon1=$checkin[0]; $dat1=$checkin[1]; $year1=$checkin[2]; @cd=($year1,$mon1,$dat1); if($mon1==0 && $dat1==0 && $year==0) ###### IF CHECKIN DT IS NULL, REPLACE BY SYSDATE { $mon1=(localtime)[4] + 1; # months $dat1=(localtime)[3]; # days $year1=(localtime)[5] + 1900; # years @cd=($year1,$mon1,$dat1); } $cd=join("",@cd); @orig=split("-",$line[5]); $mon2=$orig[0]; $dat2=$orig[1]; $year2=$orig[2]; @od=($year2,$mon2,$dat2); $od=join("",@od); $dif=abs(Delta_Days(@cd,@od)); $state=$line[4]; $word=$line[7]; $state =~s/\s+$//; $dif2=0; if(($state ne 'VL' && $state ne 'CI '&& $state ne 'AN' && $state ne 'VD')&&($acname eq "IBM")) { if(($dif > 30)&&($sev==1)) { $fix++; $numred++; } elsif($sev==0) { @rtm=split("-",$line[9]); $mon3=$rtm[0]; $dat3=$rtm[1]; $year3=$rtm[2]; @rtm=($year3,$mon3,$dat3); $rtm=join("",@rtm); @eng=split("-",$line[10]); $mon4=$eng[0]; $dat4=$eng[1]; $year4=$eng[2]; @eng=($year4,$mon4,$dat4); $eng=join("",@eng); if($rtm==0 && $eng!=0) { $dif2=abs(Delta_Days(@od,@eng)); } elsif($rtm!=0 && $eng==0) { $dif2=abs(Delta_Days(@od,@rtm)); } elsif($rtm!=0 && $eng!=0) { $dif2=abs(Delta_Days(@od,($rtm+$eng+abs($rtm-$eng))/2)); } elsif($rtm==0 && $eng==0) { @nowdt=((localtime)[5]+1900,(localtime)[4]+1,(localtime)[3]); $dif2=abs(Delta_Days(@od,@nowdt)); } if($dif2 <=10 && $dif > 7) { print "<h3>FIXED</h3>"; $fix++; $numred++; } if($dif2 > 10) { print "<h2>DELIVERED</h2>"; #$del++; $fix++; $numred++; } } } #endif elsif(($state ne 'VL'&&$state ne 'CI'&&$state ne 'AN'&&$state ne 'VD')&&($acname ne 'IBM')) { if((($dif > 30)&&($sev==1))||(($dif > 14)&&($sev==0))) { $fix++; $numred++; } } #endif if($state eq "VL") { $fixed++; $validated++; } elsif($state eq "CI") { $fixed++; $checkedin++; } elsif($state eq "AN") { $fixed++; $answered++; } elsif($state eq "IN") { $inactive++; } elsif($state eq "VD") { $void++; } else { $open++; } if(($word=~m/[^U]CRASH/) && ($sev==$line[3])) { $numc++; } elsif(($word=~m/UCRASH/) && ($sev==$line[3])) { $numuc++; } } } } close(COUNT); print "<table border=\"0\" rows=\"10\" cols=\"4\" width=\"100%\"> <tr><td colspan=\"2\"><b style=\"font-size:22px\">Total S$k Records </b></td><td width=\"5%\" align=\"center\"><b style=\"font-size:20px\"> ${\"s\".$k}</b></td><td></td></tr> <tr><td width=\"13%\"><b style=\"font-size:16px;color:DarkBlue\">Total Fixed</td><td></td><td width=\"7%\" align=\"center\"><b style=\"font-size:16px;color:DarkBlue\"> $fixed</td></tr>"; print " <tr> <td width=\"13%\"></td><td width=\"3%\" align=\"left\"><b style=\"font-size:14px;color:Green\">Validated</td><td width=\"7%\" align=\"center\"><b style=\"font-size:14px;color:DarkBlue\"><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$validated&type=VL')\" style=\"color:DarkGreen\">$validated</b></a></td>"; print" <td rowspan='7' align=\"center\" width=\"70%\"> <img align=\"center\" src=\"http://chart.apis.google.com/chart? chs=400x130 &chco=00FF00|32CD32|008000|FFD700|FFFF00|DC143C &chd=t:$validated,$checkedin,$answered,$inactive,$void,$open &cht=p3 &chl=Validated ( $validated )|Checked-In ( $checkedin )|Answered ( $answered )|Inactive ( $inactive )|Void ( $void )|Open ( $open )\"></td> "; print " </tr><tr> <td width=\"15%\"></td><td width=\"3%\" align=\"left\"><b style=\"font-size:14px;color:DarkGreen\">Checked-In</td></b><td width=\"7%\" align=\"center\"><b style=\"font-size:14px;color:DarkGreen\"><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$checkedin&type=CI')\" style=\"color:DarkGreen\">$checkedin</b></a></td> </tr><tr> <td width=\"15%\"></td><td width=\"3%\" align=\"left\"><b style=\"font-size:14px;color:DarkGreen\">Answered</td></b><td width=\"7%\" align=\"center\"><b style=\"font-size:14px;color:DarkGreen\"> <a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$answered&type=AN')\" style=\"color:DarkGreen\">$answered</b></a></td> </tr> <tr><td width=\"15%\"><b style=\"font-size:16px;color:GoldenRod\">Total Inactive</b></td><td width=\"3%\"></td><td width=\"7%\" align=\"center\"><b style=\"font-size:16px;color:GoldenRod\"><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$inactive&type=IN')\" style=\"color:GoldenRod\">$inactive</b></a></td></tr> <tr><td width=\"15%\"><b style=\"font-size:16px;color:GoldenRod\">Total Void</b></td><td width=\"3%\"></td><td width=\"7%\" align=\"center\"><b style=\"font-size:16px;color:GoldenRod\"><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$void&type=VD')\" style=\"color:GoldenRod\">$void</b></a></td></tr> <tr><td width=\"15%\"><b style=\"font-size:16px;color:DarkRed\">Total Open</b></td><td width=\"3%\"></td><td width=\"7%\" align=\"center\"><b style=\"font-size:16px;color:DarkRed\"><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/pop.cgi?source=$source&sev=$k&num=$open&type=OP')\" style=\"color:DarkRed\">$open</b></a></td></tr><br/>"; print "<tr><td width=\"13%\"><b style=\"font-size:16px;color:DarkBlue\">Crash CCRs</b></td></tr>"; print "<tr><td width=\"13%\"></td><td ><b style=\"font-size:15px;color:DarkRed\">Reproducible </b></td><td width=\"7%\" align=\"center\"><b><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/crash.cgi?source=$source&sev=$k&status=CRASH')\" style=\"color:DarkRed\">$numc </a></b></td></tr>"; print "<tr><td width=\"13%\"></td><td ><b style=\"font-size:15px;color:DarkRed\">UnReproducible </b></td><td width=\"7%\" align=\"center\"><b><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/crash.cgi?source=$source&sev=$k&status=UCRASH')\" style=\"color:DarkRed\">$numuc</a></b></td></tr>"; print "<tr ><td width=\"15%\" bgcolor=\"#DC143C\"><b style=\"font-size:16px;color:Yellow\">RED-HOT CCRs</b></td><td bgcolor=\"#DC143C\"></td><td width=\"7%\" align=\"center\" bgcolor=\"#DC143C\"><b style=\"color:Yellow\">$numred</b></td><td align=\"left\"><img src=\"/arrow.gif\"></td></tr>"; if($acname eq 'IBM' && $sv==0) { print "<tr><td width=\"13%\"></td><td bgcolor=\"#DC143C\"><b style=\"font-size:15px;color:Yellow\">To Fix/Deliver</b></td><td width=\"7%\" align=\"center\" bgcolor=\"#DC143C\"><b><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/hot.cgi?source=$source&sev=$k')\" style=\"color:Yellow\">$fix</a></b></td></tr>"; } else{ print "<tr><td width=\"13%\"></td><td bgcolor=\"#DC143C\"><b style=\"font-size:15px;color:Yellow\">To Fix</b></td><td width=\"7%\" align=\"center\" bgcolor=\"#DC143C\"><b><a href=\"Javascript:newPopup('http://vl-gbedi:8080/cgi-bin/hot.cgi?source=$source&sev=$k')\" style=\"color:Yellow\">$fix </a></b></td></tr>"; } print "</table><br/><br/><br/>"; } } #endfor print "<p align=\"center\"><b style=\"font-size:18px;color:magenta\"><a href=\"http://vl-gbedi:8080/cgi-bin/main.cgi\">Return To Previous Page</a></b></p><br/>"; print "<p align=\"center\" ><image src=\"/bar.gif\"></p>"; print "</head></html>";
|