<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>Hello
All,</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>I have the
need to spawn two processes within Perl and was wondering if someone can show me
the way.</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>One process
open() a named pipe and the other runs "sqlldr <A
title=mailto:user/pass@database
href="BLOCKED::mailto:user/pass@database">user/pass@database</A>
control=controlfile.ctl etc...". The problem I am having is, when I
attempt to "open(NP, "> $namedPipe")" before executing sqlldr, the program
hangs at "open()" so I can't continue with the program to execute sqlldr
process. If I start sqlldr first, then open(), sqlldr does not read in the
data from the open().</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>Here
is my test program:</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>
$pipeFile = "/tmp/$d_tblName";<BR> unless (-p $pipeFile)
{<BR> print "$pipeFile does not
exist.\n";<BR> unless (mkfifo($pipeFile, 0777))
{<BR> print "Can't mknod $pipeFile:
$!\n";<BR> exit;<BR>
}<BR> }</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006>#############################################################################<BR>#
COMMENTS: Connect to the source database and prepare the SQL statement to
#<BR># start
fetching the data to send to the named
pipe.
#<BR>#############################################################################<BR>
$s_dbh = sub_connect($s_dbDriver, $INSTANCE, $DBUSER, $DBPASS);<BR>
$s_dbh->{RowCacheSize} = 500;<BR> ($stmtType, $s_sqlString) =
sub_readSQLFile(qq{$SQLDIR/$SQL});<BR> $s_sth = sub_prepare($s_dbDriver,
$s_dbh, qq{$s_sqlString});<BR> $s_sth = sub_execute($s_dbDriver, $s_dbh,
$s_sth);<BR> $cnt = 0;</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006>###############################################################################<BR>#
COMMENTS: Open the named pipe file and start writing to it with the fetched
#<BR># data from the
source
database.
#<BR>###############################################################################<BR>
print STDERR "Opening $pipeFile file to begin writing data.\n";<BR> open
(FIFO, "> $pipeFile") or die
"$!\n";
<STRONG><FONT color=#ff0000><================= It hangs right
here.</FONT></STRONG><BR> print STDERR "Entering while loop to fetch the
source data.\n";<BR> while ($row = $s_sth->fetchrow_arrayref())
{<BR> die "Pipe file disappeared.\n" unless -p
$pipeFile;<BR> #printf(STDERR "%s\n", join($delim, @$row)) if
($DEBUG);<BR> printf(FIFO "%s\n", join($delim,
@$row));<BR> $cnt++;<BR> }<BR> print
STDERR "We are done with while loop. Closing named pipe.\n";<BR>
close(FIFO);<BR> print "Removing named pipe: $pipeFile\n";<BR> print
"Unable to delete $pipeFile.\n" unless (unlink($pipeFile));</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>So my
question is, is there a way to force Perl to continue after the open() statement
so that I can execute "sqlldr" statement to start receiving data from the named
pipe?</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>Thanks in
advance.</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006>Sincerely,</SPAN></FONT></DIV>
<DIV><FONT face="Courier New" size=2><SPAN
class=624521917-13062006></SPAN></FONT> </DIV>
<DIV><FONT face="Courier New" size=2><SPAN class=624521917-13062006>Peter
</SPAN></FONT></DIV></DIV></BODY></HTML>