The code I'm having is :
sub rerateandupdate (@)
{
my $currAcct = shift;
my $getAccumsForAcct = qq{ select distinct usage_acum_seq_nbr fro
+m svc_price sp,svc_agrmnt_line_item sali,sbscrp_Asgm sa where sp.free
+_usage_across_acct_ind in ('Y','A') and sp.svc_name=sali.svc_name and
+ sp.comm_svc_area_id=sali.comm_svc_area_id and sp.charge_type_cd='F'
+and sp.svc_price_expr_dt is null and svc_agrmnt_trmntn_dt is null an
+d sali.sbscrp_id=sa.sbscrp_id and sa.sbscrp_asgm_expr_dt is null and
+acct_nbr=:currAcct};
my $getAccums = $lda->prepare($getAccumsForAcct);
if(defined($getAccums))
{
$getAccums->execute();
while (my @accums = $getAccums->fetchrow_array() ) {
foreach(@accums)
{
int returnCode = SUCCESS;
my $xmlFile = "GetUsgSummary_" . $acct_nbr . ".xml
+";
createXmlForUpd( $xmlFile, $acct_nbr, );
$returnCode = invokeServer( $acct_nbr , $xmlFi
+le );
if ( $returnCode != SUCCESS ) { return $return
+Code; }
return $returnCode;
}
}
}
}
sub createXmlForUpd($$)
{
my $xmlFile = shift;
my $acct_nbr = shift;
my $returnCode = SUCCESS;
# Generate XML API input file for UpdateAccount API
open(INFILE,">$xmlFile")||die "Can not find file $xmlFile\n";
print INFILE '<envelope>' . "\n";
print INFILE '<header>' . "\n";
print INFILE '</header>' . "\n";
print INFILE '<body>' . "\n";
print INFILE '<inputGetUsageSummary acctNbr="' . $acct_nbr .'" bil
+lUnbilledInd="U" "\n";
print INFILE "</body>\n";
print INFILE "</envelope>\n\n";
close(INFILE);
return $returnCode;
}
sub invokeServer($$)
{
my $acct_nbr = shift;
my $xmlFile = shift;
my $pwd = $ENV{'PWD'};
my $api_call = ${pwd} . "/REAccount1 -stdin < " . $xmlFile;
my $cleanup_call = "rm ". $xmlFile;
if ($opt_c eq "Y" || $opt_c eq "y")
{
my $output = `$api_call`; # Execute Unix command
}
else
{
print LOG_FILE "[$acct_nbr] NO_GO - XML Input file successfull
+y created for acct_nbr = $acct_nbr -> API hasn't been invoked\n";
return SUCCESS;
}
}
in the subroutine invokeServer,from the 'output' of api call,I need to fetch the values I mentioned in my post and the output of XML api call I already posted.