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
Env::Sanctify(3pm)					User Contributed Perl Documentation					Env::Sanctify(3pm)

NAME
Env::Sanctify - Lexically scoped sanctification of %ENV VERSION
version 1.06 SYNOPSIS
my $sanctify = Env::Sanctify->sanctify( sanctify => [ '^POE' ] ); # do some stuff, fork some processes etc. $sanctify->restore { my $sanctify = Env::Sanctify->sanctify( env => { POE_TRACE_DEFAULT => 1 } ); # do some stuff, fork some processes etc. } # out of scope, %ENV is back to normal DESCRIPTION
Env::Sanctify is a module that provides lexically scoped manipulation and sanctification of %ENV. You can specify that it alter or add additional environment variables or remove existing ones according to a list of matching regexen. You can then either "restore" the environment back manually or let the object fall out of scope, which automagically restores. Useful for manipulating the environment that forked processes and sub-processes will inherit. CONSTRUCTOR
"sanctify" Creates an Env::Sanctify object. Takes two optional arguments: 'env', a hashref of env vars to add to %ENV; 'sanctify', an arrayref of regex pattern strings to match against current %ENV vars; Any %ENV var that matches a "sanctify" regex is removed from the resultant %ENV. METHODs "restore" Explicitly restore the previous %ENV. This is called automagically when the object is "DESTROY"ed, for instance, when it goes out of scope. AUTHOR
Chris Williams <chris@bingosnet.co.uk> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Chris Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-03-14 Env::Sanctify(3pm)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy