Need perl script explanation

Hi,
I have the .pl file it is not calling any where by the program,but it is transfering the oracle viewoutput file to another data_top.
how is it possible.
can any body explain me the below file how it is working.
Thanks in advance.
this is the code in the .pl file:
#!/usr/bin/perl
# Author: Stian H. Larssen (Indal Haugseth)
# Created: 2008-06-25
# Description: Removes newline characters when line ends with given string.
# Changelog
# 16.11.2008 Stian Indal Haugseth
# - Write to temp file while processing. Move/rename temp file to
# destination file when finished.
# 16.11.2008 Stian Indal Haugseth
# - Moved init of temp file variable to remove errormassege when not having
# any arguments.
use strict;
use warnings;
use Getopt::Std;
my %option = ();
getopts("dp:", \%option);
my $line = '';
my $in_file_arg = $ARGV[0];
my $out_file_arg = $ARGV[1];
my $replace_string = "¤#¤";
my $time_start = time();
my $temp_dir_name = 'temp';
my $out_dir;
my $out_file_name;
my @system_args;
if ($option{p}) {
$replace_string = $option{p};
if ((!$in_file_arg) || (!$out_file_arg)) {
print STDERR "Syntaks: $0 [-dp <mønster>] <kildefil> <utfil>\n";
print STDERR "Parameter -d vil slette kildefil etter kjøring.\n";
print STDERR "Parameter -p <mønster> lar endre søkemønster.\n";
exit 1;
print "Script startet : ". localtime($time_start) ."\n";
# If $out_file_arg contains any slash, split file name and directory name.
if ($out_file_arg =~ m/\//) {
($out_dir, $out_file_name) = $out_file_arg =~ m/(.*\/)(.*)$/; # split dir and filename
if ((!$out_dir) || (!$out_file_name)) {
print STDERR "Klarte ikke splitte fil/mappe fra $out_file_arg, script stoppet\n";
exit 1;
} else {
# File name does not contain any slashes, set default directory to ./ and use $out_file_arg as file name.
$out_dir = './';
$out_file_name = $out_file_arg;
# Create temp file variable after parameter check to remove errormessage when $out_file_arg not initialized
my $out_tmp_file = $out_file_name.'_tmp_'.$$; # Adding tmp[PID] to temp file
my $out_tmp_dir = $out_dir.$temp_dir_name; # Concatenate temp dir name to out dir
if (!-e $in_file_arg) {
print STDERR "Fant ikke filen $in_file_arg, script stoppet\n";
exit 1;
if (!-r $in_file_arg) {
print STDERR "Har ikke rettigheter til å lese filen $in_file_arg, script stoppet\n";
exit 1;
# Create temp dir.
if (-d $out_tmp_dir) {
if (!-W $out_tmp_dir) {
print STDERR "Har ikke skriverettigheter til midlertidig mappe $out_tmp_dir, script stoppet\n";
exit 1;
} else {
# Mode removed from mkdir command due bug in old perl version 5.005_03.
mkdir $out_tmp_dir or die "Kunne ikke opprette midlertidig mappe $out_tmp_dir, script stoppet";
open (INFILE, "<",$in_file_arg) or die "Kunne ikke åpne kildefilen $in_file_arg, script stoppet";
# create or replace file with +>
open (OUTFILE, "+>", $out_tmp_dir.'/'.$out_tmp_file) or die "Kunne ikke åpne midlertidig målfil ".$out_dir.$out_tmp_file.", script stoppet";
print 'Skriver midlertidig fil '.$out_tmp_dir.'/'.$out_tmp_file.".\n";
while (<INFILE>) {
$line = $_;
$line =~ s/$replace_string\n//;
print OUTFILE $line;
close (INFILE);
close (OUTFILE);
@system_args = ("/bin/mv", $out_tmp_dir.'/'.$out_tmp_file, $out_file_arg);
system(@system_args) == 0 or die 'Klarer ikke flytte '.$out_tmp_dir.'/'.$out_tmp_file.' til '.$out_file_arg.', returkode '.$?.', script stoppet';
print "MÃ¥lfil $out_file_arg opprettet.\n";
if ($option{d}) {
unlink($in_file_arg) or die "Klarer ikke slette kildefilen $in_file_arg, script stoppet";
print "Kildefil $in_file_arg slettet!\n";
print "Script utført : ". localtime(time()) . "\n";
print "Script kjøretid: ". (time - $time_start) . " sekunder.\n";

Wrong forum if I may point out. You are better off posting this in a PERL forum.

Similar Messages

  • Under a GUI, I need to run a perl script, how to do this?

    Hi - I am writing a GUI for my clients and one of the things my program must do is run a perl script. I am able to run perl.exe but it seems like perl.exe is not running the script. I also tried to put the perl script in a batch file and then call the batch file from my java GUI program. I still get the same issue of just perl.exe running but thats not running the script. My last attempt was to write a small class to test if perl.exe can run the script under a command line. I got the perl.exe to run the perl script but how do I but implement that class in my GUI if my test class needs a command line? How can I run a command line in my GUI so the perl script can be run.
    The Runtime.getRuntime.exec(RunPerlScript) is not working like I want it.
    I also tried Runtime r = Runtime.getRuntime();
    Process p = r.exec(RunPerlScript);
    How can I run the MS-DOS prompt from my program if the Runtime Environment is running already. The Runtime Environment seems to not allow another prompt to be opened and from there I can run the perl script manually or automatically from my program.
    What does the "cmd /c start..." or "c:\\windows\\command.com..." do? I have seen that in the forum but it doesn't seem to be running the perl script. The perl.exe runs, but not the perl script. I need anyones help desperately. Damn microsoft, why did they remove completely the functionality of DOS. I have a feeling my program will run perfectly under a UNIX environment, because I needed to do was open another shell. Thats what I need in windows!
    Thank you for your help.
    Seigot

    hi
    I am working on this perl scripts do run on GUI's well the process command is fine try java 1.3 it works fine. if u need more help let me know
    all the best

  • Calling the DTExec from Perl Script and need to get the Return Value (Sucess or Failure)

    I am able to execute the SSIS Package from Perl Script using DTExec. But i need to get the return code of the SSIS Execution. Is their any option available to get the Success or Failure information from Perl ?

    Exit codes returned from dtexec utility             
    When a package runs, dtexec can return an exit code. The exit code is used to populate the ERRORLEVEL variable, the value of which can then be tested in conditional statements or branching logic within a batch file. The following table lists
    the values that the dtexec utility can set when exiting.
    http://technet.microsoft.com/en-us/library/hh231187.aspx
    There's a wrinkle if the package is running in the SSIS Catalog:
    http://www.mattmasson.com/2012/02/exit-codes-dtexec-and-ssis-catalog/
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Need a perl script which monitors a network folder and sends email when new files/folders arrived...

    I need a perl script (or something else better) which monitors a network folder and sends email when new files/folders arrived. I tried it in Automator but failed.
    Thanks!

    Yes. I tried it. But whenever I restart m Mac, the watch folder doesn't work until I reconnect to network or run the Automator... I need a simple system that automatically connects to the network and monitor the folder, even I restart the Mac.
    Thanks!

  • Calling perl script from java ---help needed

    I haven't been doing a lot with java lately and i'm building an app with netbeans and having some difficulty with my button calling an outside perl script I'm pasting the code and error below...any help would be greatly appreciated. It's running on fedora 9 pretty much default install...
    thanks.
    code:
    Runtime r = Runtime.getRuntime();
    Process p = null;
    String s = null;
    String cmd123[] = { "perl /home/deaddev/test1.pl" };
    try {
    p = r.exec(cmd123);
    catch {
    foo bar/etc/etc
    error:
    Oct 12, 2008 4:09:37 PM photomainmgr readToPerlActionPerformed
    SEVERE: null
    java.io.IOException: Cannot run program "perl /home/deaddev/test1.pl": java.io.IOException: error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:474)
    at java.lang.Runtime.exec(Runtime.java:610)
    at java.lang.Runtime.exec(Runtime.java:483)
    at photomainmgr.readToPerlActionPerformed(photomainmgr.java:117)
    at photomainmgr.access$000(photomainmgr.java:21)
    at photomainmgr$1.actionPerformed(photomainmgr.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2335)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:404)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:253)
    at java.awt.Component.processMouseEvent(Component.java:6101)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3276)
    at java.awt.Component.processEvent(Component.java:5866)
    at java.awt.Container.processEvent(Container.java:2105)
    at java.awt.Component.dispatchEventImpl(Component.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2163)
    at java.awt.Component.dispatchEvent(Component.java:4288)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4461)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4125)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4055)
    at java.awt.Container.dispatchEventImpl(Container.java:2149)
    at java.awt.Window.dispatchEventImpl(Window.java:2478)
    at java.awt.Component.dispatchEvent(Component.java:4288)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:604)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
    Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:467)
    ... 30 more
    error executing perl /home/deaddev/test1.pl

    jschell wrote:
    sabre150 wrote:
    As and alternative you can useString cmd123 = "perl /home/deaddev/test1.pl";Using the single string approach YOU have to do any quoting so with this line no quoting takes place and the script /home/deaddev/test1.pl will be executed.Although that should be true apparently it isn't. I have just run  
    Process p = Runtime.getRuntime().exec("perl /home/sabre/work/dev/perl/xxx.pl");
    new Thread(new SyncPipe(p.getErrorStream(), System.err)).start();
    new SyncPipe(p.getInputStream(), System.out).run();
    int returnCode = p.waitFor();
    System.out.println("Return code = " + returnCode);which correctly executes the perl script xxx.pl.
    P.S. SyncPipe is a Runnable that copies an InputStream to an OutputStream.
    Edited by: sabre150 on Oct 14, 2008 9:19 AM
    Interesting! Even though Runtime.exec() works with a single String, ProcessBuilder fails with this approach! You have to split the argument string. This certainly looks like a bug! Some while ago I looked at the source for Runtime.exec() to look at the differences between Runtime.exec() and ProcessBuilder and found that behind the scenes Runtime.exec() uses ProcessBuilder.
    More research is required.

  • How to launching a perl script by the "begin" script of a jumpstart

    Hi all,
    i have an urgent pb with my solaris jumpstart, let me explain to you :
    i want that the begin script launch some perl script, but i have a problem
    here is my "begin" script:
    echo "Begining ISO FLAR based jumpstart."
    echo ""
    echo "Starting Ullink Configuration"
    env > /tmp/env
    /bin/sh << EOF
    /usr/bin/perl /cdrom/.archives/admin-scripts/sethostname.pl
    EOFmy perl script use a STDIN
    with this configuration, the perl script is launching but it runs in a loop indefinitely with an error "use of uninitialized value", because (i think) a value is return to the begin scritp and not to the perl script.
    well, on a pre-installed solaris, if a launch the begin script, it happens the same thing, it runs in a loop, BUT if i comment the line "/bin/sh <<EOF" and "EOF", it works.
    at this step, i say "ok it's cool my script is working", but when i use it during the jumpstart instalaltion, the perl script does not start, without any particular error.
    here is my perl script, if you want to test :
    #!/usr/bin/perl -w^M
    # Set Hostname for Ullink Jumpstart^M
    ^M
    use strict;^M
    ^M
    sub hit_enter {^M
        print "Hit enter to continue\n";^M
        <STDIN>;^M
        print "\033[2J";^M
    }^M
    ^M
    sub get_hostname {^M
        my %towns_list = (^M
            'Paris' => 'PA',^M
            'New-York' => 'NY',^M
        );^M
    ^M
        my %sites_list = (^M
            'Office' => 'OFC',^M
            'Redbus' => 'RED',^M
            'Telehouse' => 'TLH',^M
            'DTC' => 'DTC',^M
            'iAdvantage' => 'IAD',^M
            'Nutley' => 'NUT',^M
            'Level3' => 'LV3',^M
            'Equinix' => 'EQX',^M
            'Tata' => 'TAT',^M
            'Switch-data' => 'SWI',^M
            );^M
    ^M
        my %usage_list = (^M
            'Production' => 'PRD',^M
            'UAT' => 'UAT',^M
            'DMZ' => 'DMZ',^M
        );^M
    ^M
        sub select_list {^M
            my $counter=-1;^M
            my %hash_list = @_;^M
            my @keys = keys %hash_list;^M
    ^M
            # Clear screen^M
            print "\033[2J";^M
            print "In which country this machine is hosted or will be host and will be used ?\n\n";^M
    ^M
            # Get all keys from hash^M
            my $key;
            while ($key = each %hash_list ) {^M
                $counter++;^M
                print "$counter - $key\n";^M
            }^M
    ^M
            print "\nChoose the number corresponding to your choice :\n";^M
            my $choice_number;
            chomp ($choice_number = <STDIN>);^M
    ^M
            # Verify answer^M
            if (($choice_number =~ /\d+/) and ($choice_number <= $counter)) {^M
                # Add choice to chosen hostname^M
                my $chosen=$hash_list{$keys[$choice_number]};^M
                return $chosen;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number between 0 and $counter\n";^M
                &hit_enter;^M
                &select_list;^M
            }^M
        }^M
    ^M
        sub srv_number {^M
            print "\033[2J";^M
            print "What is the server number ?\n";^M
            my $server_number;
            chomp ($server_number = <STDIN>);^M
            if ($server_number =~ /\d+/) {^M
                return $server_number;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number\n";^M
                &hit_enter;^M
                &srv_number;^M
            }^M
        }^M
    ^M
        my $full_hostname = &select_list(%towns_list).'-';^M
        $full_hostname = $full_hostname.&select_list(%sites_list).'-';^M
        $full_hostname = $full_hostname.'SRV-';^M
        $full_hostname = $full_hostname.&select_list(%usage_list).'-';^M
        $full_hostname = $full_hostname.&srv_number;^M
    ^M
        sub write_hostname2tmp {^M
            open (HOSTNAME, ">/tmp/set_hostname") or warn "Couldn't write $_[0] to temp file : $!\n";^M
                print HOSTNAME "$_[0]\n";^M
            close (HOSTNAME);^M
        }^M
    ^M
        print "\033[2J";^M
        print "Is $full_hostname the correct name for this server ? (y/n)\n";^M
        if (<STDIN> =~ /y|yes/i) {^M
            &write_hostname2tmp($full_hostname);^M
        } else {^M
            print "Would you like to retry (r) or set manually the hostname (s) ? (r/s)\n";^M
            if (<STDIN> =~ /s/i) {^M
                print "Type the full required name and hit enter when finished :\n";^M
                chomp ($full_hostname = <STDIN>);^M
                &write_hostname2tmp;^M
            } else {^M
                &get_hostname;^M
            }^M
        }^M
    }^M
    ^M
    # Start configuration^M
    print "\033[2J";^M
    print "\n########################################################\n";^M
    print "#\t\t\t\t\t\t       #\n";^M
    print "#\t\t\tULLINK\t\t\t       #\n";^M
    print '#  Solaris Environnement Installation for Datacenters  #';^M
    print "\n#\t\t\t\t\t\t       #";^M
    print "\n########################################################\n\n";^M
    print "Before starting installation, you need to enter a set of informations.\n(answer to all questions, you can Ctrl+C to stop now)\n\n";^M
    &hit_enter;^M
    ^M
    &get_hostname;^Mthank for your help
    Edited by: ullink on Jun 25, 2009 6:05 AM

    Hi Manju,
    You can try the following command and check if any helps:
    Get-Exchangeserver |where-object{$_.AdminDisplayVersion -like "Version 15*"} |Get-MailboxStatistics | Ft -auto -wrap DisplayName,database,servername,*size*,*time*
    Best regards,
    Niko Cheng
    TechNet Community Support

  • Runtime.exec("Perl Script writing and reading on I/O"), handling Streams

    Hi all !!
    In a first place : sorry for my english if it's not really understandable but I try to do as good as possible !
    I'm writing a GUI with Swing that will allow (in one of my multiple tables) the user to run a Perl Script.
    This Perl Script ask the user to choose a Folder ... then read all the files in this folder and for each file (xml File), extract the datas and put them in a database. But when a file that has to be inserted in the database contains this line : <Template_Used name="ST1.mtt"> and if the Template table in my database doesn't have the "ST1.mtt" stored ... the Perl Script ask to the user to give him the path of the file "ST1.mtt" so that the script can put the "ST1.mtt template" datas in the database.
    This script runs well when it is from a windows console.
    But I need a graphic interface !!!
    So I created a JButton "Process a folder".
    When the button is pressed, a JFileChooser appears and ask the user which Folder has to be processed.
    Then a Process is created with the command : ("cmd.exe /C \"C:\\Program Files\\Fluke\\Ansur\\ProcessFolder.bat\").
    The BatFile :
    {code}cd C:\Documents and Settings\tsd\Desktop\Gael-Project\Project_Files
    perl Process.pl
    exit{code}
    At this moment everything is working well.
    But my Process.pl (which is 300 lines long ... and that you don't even want to hear about), ask in a first time the Path of the folder to process and sometimes ask the path to a file (a template file).
    So I need to read and wirte on the STDIN/STDOUT during the exec of the Process.
    In order to handle this I created two different threads : one reading the Process.getInputStream with a BufferedReader and one other writing on the Process.getOutputStream with a PrintWrinter.
    What I need to do is :
    When I read a line from the InputStream saying "I need the path of the ST1.mtt file", I should run a JFileChooser ... the user find the file in the computer ... and I write in the OutputStream the path of the file, so that my Perl Script doesn't have un Unitialised value on <STDIN> and can continue to process !!
    I'm pretty sure it's possible ... because at the moment I just used a trick :
    When the user push the "process a folder" button, I write the paths in the OutputStream before than the script needs it and it works !
    But I need to write in the OutputStream only when it is time !!!
    Any idea ??
    Here are some parts of my code :
    {code}
    String filename = File.separator+"tmp";
              JFileChooser fc = new JFileChooser(new File(filename));
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY );
              // Show open dialog; this method does not return until the dialog is closed
         fc.showOpenDialog(null);
         Folder = fc.getSelectedFile();
              new GoodExec(cmd);
    {code}
    {code}
    public class GoodExec {
         public static Process proc;
         public static StreamGobbler errorGobbler;
         public static StreamGobbler inputGobbler;
         public static StreamGobbler outputGobbler;
         public GoodExec(String cmd)
         try
                   Runtime rt = Runtime.getRuntime();
              proc = rt.exec(cmd);
         // any error message?
         errorGobbler = new
         StreamGobbler(proc.getErrorStream(), "ERROR");
         // any input?
         inputGobbler = new
         StreamGobbler(proc.getInputStream(), "INPUT");
         // any output?
              outputGobbler = new
              StreamGobbler(proc.getOutputStream(), "OUTPUT");
         // kick them off
         errorGobbler.start();
         inputGobbler.start();
         outputGobbler.start();
         // any error???
         int exitVal = proc.waitFor();
         System.out.println("ExitValue: " + exitVal);
         } catch (Throwable t)
         t.printStackTrace();
    {code}
    {code}
    public class StreamGobbler implements Runnable
    InputStream is;
    OutputStream os;
    String type;
    Thread thread;
    public static String chaine;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.os=null;
    this.type = type;
    StreamGobbler(OutputStream os, String type)
    this.os = os;
    this.is=null;
    this.type = type;
    public void start () {
         thread = new Thread(this);
         thread.start ();
    public void run()
    try
    if (is == null){
         PrintWriter toProgram = new PrintWriter(os);
         File FolderToProcess = ProcessFolder.Folder;
    String Folder = FolderToProcess.getPath();
    toProgram.write(Folder);
    toProgram.close();
    else {
         if (os == null){
         InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    String comp = "Please enter the exact path of the directory that contains the files you want to process.";
    while ( (line = br.readLine()) != null){
         if (type.equals("INPUT")){
              chaine+=line+"\n";
         if (line.equals(comp)) {
              System.out.println("give directory");RUN A JFILECHOOSER AND GIVE THE DIRECTORY TO THE OUTPUTSTREAM
    System.out.println(type + ">" + line);
    is.close ();
    catch (IOException ioe){
         ioe.printStackTrace();
    {code}
    And here is an example of a simple perl script that could be used (it s a simple one !!) :
    {code}
    #!/usr/bin/perl -w
    use strict;
    print "Please enter the exact path of the directory that contains the files you want to process.\n";
    my $dir= <STDIN>;
    chomp ($dir);
    print "titallala $dir";
    if (the template of the file is not in the database){
    print "Please give me the template so that I can put it in the database";
    $dir= <STDIN>;
    chomp ($dir);
    {code}
    Thank you for your help ... if it's possible to help me !!
    Gael

    BalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
    Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
    SomeObject someObject = null; // The someObject reference is null.
    someObject.doSomething(); // Invoking a reference which is null would throw NPE.

  • To write a perl script for running a java program from cgi of web server

    I have to write a perl script to call a java program(.exe).I want to run this file through the cgi of the web server.
    java myprogram
    can anyone help me to write a perl script??

    It depends on what the java program does. For example, does it parse HTTP headers from standard input, or what?
    Are you sure it wouldn't be easier to turn the class into a servlet? etc.
    Take a look at IPC::Open2 and IPC::Open3 though. You may need them. (That's just a guess.)

  • Shell or perl script from OS command_Sender File Channel

    Hi All,
    I am trying to execute a perl script from the File Sender Channel(NFS), OS command Before Message Processing. The script works fine if i run it from the shell. But when PI calls the script,  the script does not get executed. The audit logs mention that the OS command has been called.
    I tried using:
    1) /<fullpath>perlScript.pl /<fullpath>filename.dat
    2) perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    Both these commands work fine when i execute them on the shell.
    I am on solaris and PI 7.0. The permission for the perl script and input files are all 777.
    FYI.. i am using this perl script to transpose a complex file and make it # delimited file.
    I have already read the blogs for OS command and executed some sample scenarios successfully.
    I tried to call a shell script that does the same functionality as the perl script. Even that does not work.
    Also, wrote a shell script to call the perl script inside it. No luck.
    eg:
    touch /fullpath>/create_before.dat
    perl /<fullpath>perlScript.pl /<fullpath>filename.dat
    touch /<fullpath>/create_after.dat
    In this case, the create_before.dat and create_after.dat is getting created but the perl is not called. I know this because i cant see the output files of the perl script.
    Regards,
    Balaji
    Edited by: Balaji M on Oct 30, 2008 2:36 PM

    Hi,
    The problem is fixed. The shell or perl both have logic to transpose a non industry starndard file to the delimited file which PI can use an FCC to pick up.
    This was the fix:
    we need to mention the shell the script is going to be run in.
    In the shell script we mentioned --> *#!/usr/bin/bash* as the first line
    normally, when we use the command -- which bash on the unix command prompt, it tells us the path for the bash used.
    another option --> #!/usr/bin/ksh
    again, on the command prompt -- which ksh command will tell us what ksh is being used.
    If the script is a simple one that does copy or move commands, i believe we need not use the commands above. But is a good practice to have them in the script.
    Regards,
    Balaji
    Edited by: Balaji M on Nov 3, 2008 4:38 PM

  • Converting Perl Scripts into Java Servlets

    Hello,
    I have just been assigned the job of converting some perl scripts into Java Servlets. The first problem i have run into is with quotes. The problem is in perl you can just print out blocks of html without worrying about the quotes. ie (name="joe"). It will be a pain if i have to delimit every quote that is in the html so that i can add it to my java string. I was just wondering if anyone knows of an easy way of accomplishing this task.
    Thanks,
    Jon

    jonhorsman said
       I have just been assigned the job of converting some perl
       scripts into Java Servlets.I was just wondering if anyone
       knows of an easy way of accomplishing this task. The easy way is to not do it - is there a business need to do this or just because someone likes java more than perl.
    But presuming there is a business need, then the easist way I can think (and certainly more interesting than doing it by hand) is to write a perl script that does it for you.

  • Calling stored procedure from Perl Script

    Need help with the syntax to call a stored procedure with an input paramter using Perl. The input paramter will be set within the perl script.

    there is an oracle module you can find on cpan
    http://cpan.org/modules/by-category/07_Database_Interfaces/Oracle
    of course, you could also use sqlplus binary, as you would do in shell
    hth

  • Perl Script in PLSQL

    When do we typically need to use external scripts like perl scripts while working in oracle?
    For file manipulation,perls split function would be better than pl/sql code ,however,performance wise which one is better?
    How many such scenarios are there where a perl is better to be used as opposed to pl/sql
    please advise

    That depends on where the data is. If it is outside Oracle then PL/SQL is not the best approach. The UTL_FILE I/O interface is primitive.
    If the data is inside Oracle, then PL/SQL is the best approach.
    One method to consider is loading the files to be processed by Perl, as CLOBs, into Oracle. And once in Oracle, use PL and SQL to process the contents.
    Performance wise, I expect pretty similar performance. It is unlikely that one would be significantly faster than the other in this case. Regular expressions are also supported in Oracle.
    There are however features and advantages on the Oracle side that you do not have on the o/s side with Perl. Concurrency controls. Transactions. How do you rollback changes made when in Perl? Code them - which can be complex. In PL/SQL, you simply use the rollback command. And save points are also supported.
    Other factors can include the availability of the file to other applications and web reporting systems, and security and backup.
    If the file resides outside Oracle and a web reporting system for example needs to show the file contents plus the structured data set parsed from the file... this gets hairy when Perl was used to load the structured into a database (easily accessible via web app layer) and the file still sits on the o/s (another method required by app layer to access file, another set of authentication and authorisation to deal with, etc).
    It is a lot easier if the file is a CLOB inside Oracle - as any application will use the database (single access method and point of access) to obtain both the structured data and the file's contents.
    Then there's also the issue of backups. If the file is a CLOB in the database, it is part of the backup and security mechanisms implemented on that database. No need to deal with it at o/s level and its complexities.
    Of course, I assume that these are requirements accompanying the need to process and parse the file. And that is the bottom line - the requirements should drive the decision of whether to use Perl or PL/SQL in such a case. It is not a mere matter of which one may perform better than the other (especially not when it cannot be shown that there will be a significant performance improvement).
    By the way - the above scenario is a real world one for us. And interestingly, we had more performance issues with the Perl code (huge knock on server resources) than doing the same inside Oracle using PL/SQL.

  • Recovering Permissions on /usr/lib - pkgchk or perl script?

    We have a SUN 280R running solaris 8 which accidently had a 'chmod-R 644 /usr/lib' run on it. The result was that on reboot, the system could not 'execute' or 'find' specific libraries such as ld.so.1 and some files associated with the veritas volume software we have installed on the system. We have been able to chmod most of /usr/lib 755 including ld.so.1. We would like to restore permissions to prevent any system stablity problems. so what is the better method to use here?
    1.) do a grep /usr/lib on /var/sadm/install/contents, pull out all the package names with an awk statement and then run them in a loop with pkgchk -fa?
    2.) Run a perl script which parses /var/sadm/install/contents, pulls out all the individual files in /usr/lib, and run a chmod <perm> $file on each file name?
    Which method would be less destructive? My concern is that running pkgchk on all packages associated with /usr/lib may 'fix' something, or modify something which would prevent the system from coming up.
    What key files in /usr/lib would prevent the system from coming back up, if permissions were incorrect? (i.e 644)? Should a chmod <perm> <file> for each file in the contents file for all files in /usr/lib resolve this problem completely?
    Any advice would be appreciated.

    If you don't already have a current backup, back up all data, then reinstall the OS. You don't need to erase the startup volume, and you won't need your backup unless something goes wrong. If your Mac was upgraded from an older version of OS X, you’ll need the Apple ID and password you used to upgrade.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it.

  • Facing Problem in Perl Script

    Hi ,
    I m facing one problem in perl script.
    Oracle Database 10g.
    DBD::Oracle::db selectall_arrayref failed: handle 2 is owned by thread 225ffc not c
    urrent thread 1c4f8ac (handles can't be shared between threads and your driver may
    need a CLONE method added) at c:\perl\update_card_numbers_oracle.pl line 258, <STDI
    N> line 1.
    Thx in advance....

    There are forums here at OTN for Perl related issues ... this isn't it.
    Return to the list of all forums and find the one where your inquiry belongs.

  • How to run the perl script from java ?

    Hi , I need to run the pearl script from the server and to get the result of the script thro' java using SSH
    Is there any 3rd party SSH API in java ?
    Please help me out
    thanks in advance
    karthik

    This seems like a very strange thing to want to do.
    What is the perl script doing?
    Do other programs (not some shell script) access this server-side perl script from a different machine?
    If so how do they do it?
    What currently triggers the perl script to execute?
    What currently handles the output from the perl script?
    If you can answer these questions (and understand the answers) you should be able to come up with a different approach to this.
    You do not really want to call a remote perl script from a Java program, you want to achieve the effect you think that would have if you could do it.
    So find the answers to the above questions, write them on 3" x 5" cards and lay them out on your desk.
    What flow of control needs to happen? Which piece of code needs to produce or consume which piece of data?
    If that fails, ask you self or who ever is making you do this what are the use-cases?
    If you do not know what use-cases are or do not understand them well enough try reading
    Use Case Modeling (The Addison-Wesley Object Technology Series) by Kurt Bittner and Ian Spence (Paperback - Aug 30, 2002)
    http://www.amazon.com/s/ref=nb_ss_gw/002-7908514-4043267?url=search-alias%3Dstripbooks&field-keywords=use+cases&x=0&y=0
    It is a short and easy to read book on the subject and also one of the best.
    You MUST understand WHAT you are trying to achieve before you can decide HOW you are going to achieve it.

Maybe you are looking for