Urgent: please replace the perl script in the post with following code


 
Thread Tools Search this Thread
Contact Us Post Here to Contact Site Administrators and Moderators Urgent: please replace the perl script in the post with following code
# 1  
Old 11-05-2015
Urgent: please replace the perl script in the post with following code

Hi
This is very urgent as it is confidential info posted by mistake.Kindly help us asap.

post link below:
perl while loop for each


please replace the perl script with following script in the post

Code:
 ###########################################################################
# Description:  This  perl does the following:
#               1.Checks if the target load has completed successfully.If so,
#                 truncates the stage table.
#               2.Mails the no. of records loaded in case the target load has happened.
##############################################################################l
#
# Modification History:
#
#
###############################################################################
$Program = $0 ; $Program =~ s/.*\/// ;
$MyDir   = $0 ; $MyDir   =~ s/[^\/]*$// ;
push ( @INC, "$ENV{Samp_COMMON_SCR}" ) ;
push (@INC, "$ENV{Samp_SCR}") ;
$SIG{'INT'}  = "sub_handle" ;
$SIG{'TERM'} = "sub_handle" ;
require "getopts.pl" ;
require "Samp_misc.pl" ;
require "Samp_exit.pl" ;
require "Samp_db.pl";
require "Samp_job.pl";
require "Samp_log_error.pl";
require "www_gi_date_ext.pl";
###############################################################################
# Get user input.
###############################################################################
&Getopts ( "j:h" ) ;
if ( defined ( $opt_h ) )
{
    &print_help_msg ;
    &sub_exit ( 0 ) ;
}
if ( !defined ( $opt_j ) )
{
        &Samp_msg("Option j - Autosys Job name required",ERROR);
        &sub_exit(9) ;
}
else
{
        $job_name = $opt_j;
        &Samp_msg("Reading autosys job name - $job_name","",INFO,$job_name);
        $jobname = $job_name;
}
###############################################################################
# Creates connection to Database.
###############################################################################
if ( ! ( $dbh = &Samp_user_ora_connect ) )
{
  &Samp_msg ( "*** Failed to open connection to $ENV{'Samp_ORA_SID'}***","",ERROR,$job_name ) ;
  &sub_exit ( 9 ) ;
}
#=============================================================================#
# Pre-load. Makes an entry in job_run table and job_step_run table
#=============================================================================#
#$res=&Samp_ins_job_run('I',$job_name);
#if ($res) { &Samp_db_close(\$dbh); &sub_exit ( 9 ) ; }
#$res=&Samp_insupd_job_step_run('I',$job_name,'fiusicanlt_qt_ramp_chk','I');
#if ($res) { &Samp_db_close(\$dbh); &sub_exit ( 9 ) ; }
#$res=&Samp_insupd_job_step_run('I',$job_name,'wwww_LDING_CNT_VALIDN','I');
#if ($res) { &Samp_db_close(\$dbh); &sub_exit ( 9 ) ; }
# declaring the count to 5
##################Get records loaded from file generated by Informatica #############
#change the directory to $Samp_RECEIVE
cd $Samp_RECEIVE ;
# see the files that start with feedmgr.usfed.tips
$CycleDate      = &fi_get_curr_date('US','batch','PROCESS');
 @filelist = `head -1 GNM_GEO.DAT.EMBS* |grep -v GNM_GEO.DAT.EMBS |   awk  '{$4 $5}'`;
foreach $item (@filelist)
{
&Samp_msg (" item is equal to  ","",INFO,$item ) ; 
$filedate = `$item | awk '{ $2}'`;
if ($filedate =  $CycleDate)
{
###############################################################################
# Call procedure wwww_LDING_CNT_VALIDN
###############################################################################
&Samp_msg (" Job Name: $job_name ","",INFO,$job_name ) ;
$sql_header= "BEGIN Metric.IDX_wwww_LOADING_PKG.wwww_LDING_CNT_VALIDN(
                                                        :pv_out_stg_rowcount,
                                                        :pv_out_tgt_rowcount,
                                                        :pv_out_cnt_matched,
                                                        :pv_in_tgt_rowcount,
                                                        :pv_in_jobname
                                                        );
:st :=0;
                         EXCEPTION
                WHEN OTHERS THEN
                        :st:=1;
                        :st_err_no:=-1 *sqlcode;
                        :st_err:=sqlerrm;
                 END;";
my $sth = $dbh->prepare($sql_header);
$sth->bind_param_inout(":pv_out_stg_rowcount",\$stg_count,15);
$sth->bind_param_inout(":pv_out_tgt_rowcount",\$tgt_count,15);
$sth->bind_param_inout(":pv_out_cnt_matched",\$matched,15);
$sth->bind_param(":pv_in_jobname",$job_name);
$sth->bind_param(":pv_in_tgt_rowcount",$rec_cnt);
$sth->bind_param_inout(":st_err_no",\$errno,10);
$sth->bind_param_inout(":st",\$status,5);
$sth->bind_param_inout(":st_err",\$err_msg,1000);
$sth->bind_param_inout(":st",\$status,5);
$sth->execute();
&Samp_msg(" Stage Records processed $stg_count","",INFO,$job_name);
&Samp_msg("Target record count $tgt_count","",INFO,$job_name);
&Samp_msg("The matched flag:$matched","",INFO,$job_name);
&Samp_msg("Error message:$err_msg","",INFO,$job_name);
&Samp_msg(" Mailing flag $mail_ind","",INFO,$job_name);
&Samp_msg(" Status:$status","",INFO,$job_name);
  } 
 
 
else 
{
&Samp_msg ( "Received SAT Ctrl-C from the user.  Aborting.","",ERROR ) ;
&sub_exit (9) ;
}
}
 ###############################################################################
# The End.
###############################################################################
&sub_exit ( 0 ) ;
  
###############################################################################
sub sig_handle
###############################################################################
{
    my ( $signame ) = @_ ;
    if ( $signame eq "INT" )
    { &Samp_msg ( "Received SAT Ctrl-C from the user.  Aborting.","",ERROR ) ; }
    if ( $signame eq "TERM" )
    { &Samp_msg ( "Received termination signal (15).  Aborting.","",ERROR ) ; }
    $res=&Samp_upd_job_run('U',$jobname,'F');
    &Samp_db_close(\$dbh);
    &sub_exit ( 9 ) ;
}
############################################################################### 
sub print_help_msg
#
# Description: Prints the usage information for the script.
# Input:       None.
# Output:      The usage information is written to STDERR.
###############################################################################
{
    print STDERR "
Usage:
  \$Samp_PERL \$Samp_SCR/$Program -j<Job name> [-h help]
  where,
    -h   Print this message and exit.
    -j   Jobname corresponding to the perl script
" ;
}


Last edited by Don Cragun; 11-05-2015 at 05:18 AM.. Reason: Add CODE tags.
# 2  
Old 11-05-2015
The code has been replaced as requested.
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find and replace, perl code

Hi, Can somebody tell whats wrong with "find and replace perl code". I wanted to find "\n".write(status,data" and replace with "\n",data" in multipls files. #!/usr/bin/perl my @files = <*.c>; foreach $fileName (@files) { print "$fileName\n"; my $searchStr0 =... (4 Replies)
Discussion started by: chettyravi
4 Replies

2. Shell Programming and Scripting

Have a find/replace perl script thats broke

Hello Folks, #!/usr/bin/perl use File::Find; open F,shift or die $!; my %ip=map/(\S+)\s+(\S+)/,<F>; close F; find sub{ if( -f ){ local @ARGV=($_); local $^I=""; while( <> ){ !/#/ && s/(\w+)\.fs\.rich\.us/$ip{$1}/g; print; } }... (8 Replies)
Discussion started by: richsark
8 Replies

3. Shell Programming and Scripting

replace a string in perl - Urgent

Hi, Can anyone help me to replace ='is NOT NULL' to is NOT NULL in perl. I tried all the methods which i know, i didnt arrive at the solution. please help!! ---------- Post updated at 03:01 PM ---------- Previous update was at 02:56 PM ---------- I got it.......! Thanks, (1 Reply)
Discussion started by: jam_prasanna
1 Replies

4. UNIX for Dummies Questions & Answers

Replace line via perl script of file

Hi All, I wanted to do following. 1) If file exit then open file for reading and check if my string is there then i wanted to replace the entire line with that string + something else then close the file. 2) If file does not exit then i need to open the file and write to it. I am done with... (0 Replies)
Discussion started by: Tarun24
0 Replies

5. Shell Programming and Scripting

Perl script help URGENT???

Friends I generated a code too read a list if names from file and store it in array. The file contains names of some files. like a.txt b.txt c.txt ........ while I am running the script and gives a file name as argument I have to check wehere the file processed or not. if processed exit the... (4 Replies)
Discussion started by: jaganadh
4 Replies

6. Shell Programming and Scripting

Urgent help for perl script

I am having the autosys script for the perl as follows #!/usr/bin/perl print "Welcome to Autosys Ice Script\n"; print "Please enter the Environment (UAT PRD TRN ST DEV ALL):\n"; $environment = <STDIN>; chomp($environment); print "Please enter the Action (ON_ICE OFF_ICE):\n"; $action =... (0 Replies)
Discussion started by: shellscript22
0 Replies

7. Shell Programming and Scripting

Script Needed Urgent in shell or PERL!!!!!!!!!!!!!!!!!!!!

My I/p FIle #%npr # { { collectionBeginTime_Date 19Jul2007 granularityPeriod 900 NODEID BSC19 RLC_Raw_Blocksize_CS2 2048 START_DATE 19Jul07 measTimeStamp_Date 20Jul2007 COLLECTION_INTERVAL_MINS 15 RLC_User_Blocksize_CS2 1024 ... (1 Reply)
Discussion started by: aajan
1 Replies

8. Shell Programming and Scripting

String replace perl script error

I have written down a simple perl program to replace a string from a word file. My script does'nt seem to work. Any pointers to make it work will be appreciated. The code is given below. #!/usr/bin/perl while (<>) { open(FILE,$_); while (<FILE>) { s/This/I did it/g; }... (6 Replies)
Discussion started by: MobileUser
6 Replies

9. Shell Programming and Scripting

Calling CGI Perl in Shell script [urgent]

All I want to call a perl program from my shell script. Please help me. I want to call through URL only. Like " http://www.test.com/CGI-bin/test?test=value" Please help to write this script. Thanx in advance. Thanking you Regards Deepak Xavier (0 Replies)
Discussion started by: DeepakXavier
0 Replies
Login or Register to Ask a Question