Sponsored Content
Top Forums Shell Programming and Scripting How to call the System command twice in the same perl script... Post 302513918 by msrahman on Thursday 14th of April 2011 10:23:20 AM
Old 04-14-2011
How to call the System command twice in the same perl script...

Hello experts,
I have a perl script which looks for the ARGV and then loads the data as per it.
Example.
Code:
#Checking the server to connect
if ($ARGV[0] eq 'QA')
{
        $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0";
        $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin";
        $ENV{"ORACLE_SID"} = "db112";
        #$dbsid = 'db111';
        $dbuser = 'zx####';
        #$dbpwd = `/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db111zx####pw`;
}

Now i want to add the same for Prod, which i did;
Code:
#Checking the server to connect
if ($ARGV[0] eq 'QA')
{
        $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0";
        $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin";
        $ENV{"ORACLE_SID"} = "db112";
        #$dbsid = 'db222';
        $dbuser = 'zx####';
        #$dbpwd = `/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db222zx####pw`;
}

But the problem here is, i am using "system" command to call the sqlldr to load the data into QA tables.
Code:
$infile = $inputdirectory.$file;
print $infile;
#Logfile location where it will reside
$logFile = "/A/B/C/log/ZIP_code.log";
#Control file location
$confile = "/A/B/C/control/zip_codes_38.ctl";
print "$dbuser\n";
#print "$dbpwd\n";
system ("/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db111zx####pw | sqlldr userid=$dbuser DATA=$infile control=$confile log=$log
File");

#This is the system command to call Sqlldr for Production.
system ("/usr/local/pl/perlencrypt.pl -k /kda1/system/ealgorithm -d /sdr1/system/db222zx####pw | sqlldr userid=$dbuser DATA=$infile control=$confile log=$log
File");[/CODE]
Can i use the same "System" command for Prod too? Will that work...?
Or, How should i use another ARGV for Production in the same perl script?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

a system call for sed in a awk script

Hi, this is my test file : DELETE FROM TABLE WHERE ID_INTERNAL = :TABLE.ID-INTERNAL, ID-INTERNAL-CRAZY ID-INTERNAL-OPEN ID-INTERNAL /ID-INTERNAL/ I want all occurences of ID-INTERNAL replaced with a one, if ID-INTERNAL has and dash afer it , dont replace it example:... (6 Replies)
Discussion started by: seaten
6 Replies

2. UNIX for Dummies Questions & Answers

how can call perl script as command?

Hello say i have written some perl scripts , now i like to call them in my unix shell as unix command like "more" , "ls" , "grep" so that my say perl script called "foo.pl" will be called from every where as "foo" or "foo arg1 arg2"? Thanks (1 Reply)
Discussion started by: umen
1 Replies

3. Programming

Need help with running the tar command using system() call in C

Hey everyone, I've been trying to use the system(cmd) call in C to tar multiple files together. When i do so i specify the absolute paths of the tar file as well as the files to be included in the tar file. Eg: system("tar -cf /tmp/example.tar /mnt/john/1.xml"); system("tar -uf... (5 Replies)
Discussion started by: vsanjit
5 Replies

4. Shell Programming and Scripting

[Perl] Capture system call error message.

Hi, I googled a bit, but could not find the answer to my problem. But I am sure it is a common issue. I have this code: #!/bin/perl -w #-d use strict; sub remsh_test() { my $host = $_; printf "\n----\n\n"; printf "remsh to $host with system call\n"; my $result = system... (3 Replies)
Discussion started by: ejdv
3 Replies

5. Shell Programming and Scripting

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf,... (1 Reply)
Discussion started by: goraya430
1 Replies

6. Programming

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf, "ss_xxx.pc... (4 Replies)
Discussion started by: goraya430
4 Replies

7. Shell Programming and Scripting

Running a script in system() call and want the script's output

Hi All, I have a script(sample.sh) displaying the output of "dd" command. Now i am using this script in system() call as, system("sh sample.sh") in an application file. I want the output of system("sh sample.sh") in the application file itself. How can i get it? Many thnaks.... (9 Replies)
Discussion started by: amio
9 Replies

8. Shell Programming and Scripting

Perl - Call a sub routine in a command

Hi all I have written a simple perl script that has different options i.e. myscript -l -p etc i have it so when it runs without any switches it runs a subroutine called nvrm_norm i want to be able to do a -p option and run pall -w -f and then called the subruotine pall is... (1 Reply)
Discussion started by: ab52
1 Replies

9. Shell Programming and Scripting

How to call a bash command from within a perl script?

In a bash script, one can call a perl command in the following manner, where "myperlcommand" is a perl command. perl -e 'myperlcommand(arguments)' perl -e 'print("UUUU"x4)' Now, how can one call a bash command from within a perl script? (Suppose that mybashcommand is a bash... (1 Reply)
Discussion started by: LessNux
1 Replies

10. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies
IPC::Run::Debug(3pm)					User Contributed Perl Documentation				      IPC::Run::Debug(3pm)

NAME
IPC::Run::Debug - debugging routines for IPC::Run SYNOPSIS
## ## Environment variable usage ## ## To force debugging off and shave a bit of CPU and memory ## by compile-time optimizing away all debugging code in IPC::Run ## (debug => ...) options to IPC::Run will be ignored. export IPCRUNDEBUG=none ## To force debugging on (levels are from 0..10) export IPCRUNDEBUG=basic ## Leave unset or set to "" to compile in debugging support and ## allow runtime control of it using the debug option. DESCRIPTION
Controls IPC::Run debugging. Debugging levels are now set by using words, but the numbers shown are still supported for backwards compatibility: 0 none disabled (special, see below) 1 basic what's running 2 data what's being sent/recieved 3 details what's going on in more detail 4 gory way too much detail for most uses 10 all use this when submitting bug reports noopts optimizations forbidden due to inherited STDIN The "none" level is special when the environment variable IPCRUNDEBUG is set to this the first time IPC::Run::Debug is loaded: it prevents the debugging code from being compiled in to the remaining IPC::Run modules, saving a bit of cpu. To do this in a script, here's a way that allows it to be overridden: BEGIN { unless ( defined $ENV{IPCRUNDEBUG} ) { eval 'local $ENV{IPCRUNDEBUG} = "none"; require IPC::Run::Debug"' or die $@; } } This should force IPC::Run to not be debuggable unless somebody sets the IPCRUNDEBUG flag; modify this formula to grep @ARGV if need be: BEGIN { unless ( grep /^--debug/, @ARGV ) { eval 'local $ENV{IPCRUNDEBUG} = "none"; require IPC::Run::Debug"' or die $@; } Both of those are untested. AUTHOR
Barrie Slaymaker <barries@slaysys.com>, with numerous suggestions by p5p. perl v5.14.2 2012-01-16 IPC::Run::Debug(3pm)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy