Here is the code for that function. These functions open the file and build some hashes to upload into DB. Always SMSBcastCDR functions completes it work first(Due to less data). To upload the values into DB i am waiting for both the process complete their work.

sub SMSBcastCDR { my @array = @_; foreach my $cdr_file (@array) { chomp $cdr_file; print "file name=$cdr_file\n"; open (FPO,"$cdr_file") or die "Could not open $cdr_file\n"; while (my $line = <FPO>) { #Tue Jun 09 2009 23:00:07.225|user2|KAuser2|2222|919846231 +229|1520095992858641|TextSMS|2009-Jun-09 23:00:07.225||150|Submitted| +|231229|0|Success| chomp ($line); my ($cdr_gen_time,$system_id,$msg_submission_time,$msg_del +ivery_time,$record_type,$last_failure_reason) = (split /\|/,$line)[0, +1,7,8,10,14]; #2009-Jun-09 23:00:07.225 my ($year,$mon_txt,$day,$hr) = (split /[-:\s]+/, $msg_subm +ission_time)[0,1,2,3]; my $statsdate = "$hr:$year-$month_name{$mon_txt}-$day"; if ($record_type eq "Flood_Control_Check") { #Mon Jul 19 2010 15:36:15.682 $msg_submission_time=$cdr_gen_time; my ($mon_txt, $day, $year, $hr) = (split /[-:\s]+/,$c +dr_gen_time)[1,2,3,4]; $statsdate = "$hr:$year-$month_name{$mon_txt}-$day"; } #print "$record_type:$statsdate\n"; if ($msg_submission_time ne "") { push (@date_list,$statsdate) unless $seen{$statsdate}+ ++; } else { my ($txtdate, $time) = split(/\ /,$msg_delivery_time); my ($year,$mon_txt,$day) = split(/\-/,$txtdate); my $mon = $month_name{$mon_txt}; my ($hr,$min,$sec) = split(/\:/,$time); $statsdate = "$hr:$year-$mon-$day"; if ($msg_delivery_time ne "") { push (@date_list,$statsdate) unless $seen{$statsda +te}++; } } $hour_info{$statsdate}{$hr}=0; $system_id_info{$statsdate}{$system_id} = 0; if ($record_type eq "Submitted") { $sub_data{$statsdate}{$system_id} ++; $sub_data{$statsdate}{'all'} ++; } elsif($record_type eq "DND_Check" || $record_type eq "Filt +er_Check" || $record_type eq "Special_Character_Check" || $record_typ +e eq "Message_Length_Check" || $record_type eq "Invalid_Message" || $ +record_type eq "NID_Check" || $record_type eq "Mobile_No_Check" || $r +ecord_type eq "Flood_Control_Check") { push (@rej_error_list,$last_failure_reason) unless $re +j_seen{$last_failure_reason}++; $rej_data{$statsdate}{$system_id} ++; $rej_data{$statsdate}{'all'} ++; $bcast_errcnt{$statsdate}{$system_id}{$last_failure_re +ason}++; $bcast_errcnt{$statsdate}{'all'}{$last_failure_reason} +++; } elsif($record_type eq "SubmitResp") { if ($last_failure_reason ne "Success") { push (@rej_error_list,$last_failure_reason) unless + $rej_seen{$last_failure_reason}++; $smsc_rej_data{$statsdate}{$system_id} ++; $smsc_rej_data{$statsdate}{'all'} ++; $bcast_errcnt{$statsdate}{$system_id}{$last_failur +e_reason}++; $bcast_errcnt{$statsdate}{'all'}{$last_failure_rea +son}++; } } } close (FP); `mv $cdr_file $bcastdir`; } }
sub SMSCDR { my @array = @_; foreach my $cdr_file (@array) { chomp $cdr_file; print "File:::::: $cdr_file",$/; open (FPS,"$cdr_file") or die "Could not open $cdr_file\n"; while (my $line = <FPS>) { chomp ($line); my ( $msg_submission_time,#5 $status,#8 $record_type,#10 $last_failure_reason,#12 $orig_interface,#13 $dcs,#15 $segment_number ,#23 $system_id ,#56 )= (split /\|/,$line) [4,7,9,11,12,14,22,55]; #Wed Jun 10 16:58:58 2009 my ($mon_txt,$day,$hr,$year) = (split /[-:\s]+/,$msg_subm +ission_time)[1,2,3,6]; my $statsdate = "$hr:$year-$month_name{$mon_txt}-$day"; #print "statsdate :$statsdate\n"; push (@date_list,$statsdate) unless $seen{$statsdate}++; $hour_info{$statsdate}{$hr}=0; if (($orig_interface eq "SMPP") && ($record_type eq "Submi +t")) { my ($segment_no,$x) = split (/\//,$segment_number); if ((lc($segment_no) eq "none") || ($dcs eq "8") || ($ +dcs eq "16") || (($dcs eq "ASCII") && ($segment_no eq "1"))) { $system_id_info{$statsdate}{$system_id}=0; if($sms_sub_data{$statsdate}{$system_id} eq "") { $sms_sub_data{$statsdate}{$system_id} = 0; $del_data{$statsdate}{$system_id} = 0; $undel_data{$statsdate}{$system_id} = 0; $exp_data{$statsdate}{$system_id} = 0; } $sms_sub_data{$statsdate}{$system_id} ++; $sms_sub_data{$statsdate}{'all'} ++; if ($status eq "Delivered") { $del_data{$statsdate}{$system_id} ++; $del_data{$statsdate}{'all'} ++; if ($last_failure_reason eq "SMSC_no_error") { $last_failure_reason = "First_Attempt_Deli +vered"; } else { $last_failure_reason = "Delivered_After_Re +try"; } $del_errcnt{$statsdate}{$system_id}{$last_fail +ure_reason} ++; $del_errcnt{$statsdate}{'all'}{$last_failure_r +eason} ++; } elsif ($status eq "Expired") { $exp_data{$statsdate}{$system_id} ++; $exp_data{$statsdate}{'all'} ++; push (@exp_rej_error_list,$last_failure_reason +) unless $exp_seen{$last_failure_reason}++; $exp_errcnt{$statsdate}{$system_id}{$last_fail +ure_reason} ++; $exp_errcnt{$statsdate}{'all'}{$last_failure_r +eason} ++; } else { $undel_data{$statsdate}{$system_id} ++; $undel_data{$statsdate}{'all'} ++; push (@undel_rej_error_list,$last_failure_reas +on) unless $undel_seen{$last_failure_reason}++; $undel_errcnt{$statsdate}{$system_id}{$last_fa +ilure_reason} ++; $undel_errcnt{$statsdate}{'all'}{$last_failure +_reason} ++; } } } } close (FP); `mv $cdr_file $smscdr_archive_directory`; } }

In reply to Re^2: Problem in creating process by ravi45722
in thread Problem in creating process by ravi45722

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.