Hello Bobbee:

I am glad you got your thing working. I have never seen this problem in NT; still I am 
inclined to get that information from "Perl by example" with a grain of salt because 
the intercepting of both standard input and standard error always works for me on NT 
and I use it pretty often. Or they might mean "NT and Windows 9x", not just NT when 
they mention Windows. Here is an example of how you intercept both standard input and 
output in perl on NT:

--------cut here----------
D:\>type a.pl
#!/usr/bin/perl -w
print "THIS IS STANDARD OUPUT\n";
print STDERR "THIS IS STANDARD ERROR\n";

D:\>perl a.pl
THIS IS STANDARD OUPUT
THIS IS STANDARD ERROR

D:\>perl -e "$o = `perl a.pl 2>&1`; print grep(/ERROR/, $o) . \"\n\";"
1

D:\>perl -e "$o = `perl a.pl 2>&1`; print grep(/WILLNOTBEFOUND/, $o) . \"\n\";"
0

D:\>
--------cut here----------

One peculiarity (it is not NT- or other platform specific) is that Perl returns a 
system return code multiplied by 256 (it is because on Unix, it uses the return value 
from the system call wait()). So for %ERRORLEVEL% 18 it should be 4608 (but no way 
zero!):

--------cut here----------
D:\>type a.pl
#!/usr/bin/perl -w
print "THIS IS STANDARD OUPUT\n";
print STDERR "THIS IS STANDARD ERROR\n";
exit 18;

D:\>perl -e "$r=system('perl a.pl'); print $r, '==', $?"
THIS IS STANDARD OUPUT
THIS IS STANDARD ERROR
4608==4608
D:\>perl -e "$r=system('perl a.pl'); print $r>>8, '==', $?>>8"
THIS IS STANDARD OUPUT
THIS IS STANDARD ERROR
18==18
D:\>
--------cut here----------

Also make sure you use at least more or less fresh Perl version (5.6 or later must be 
fine).

Hope this will help,
Pavel




                      Robert Broderick
                      <robertbroderick@H        To:       [EMAIL PROTECTED]
                      OTMAIL.COM>               cc:
                      Sent by: MQSeries         Subject:
                      List
                      <MQSERIES@AKH-Wien
                      .AC.AT>


                      11/04/2002 09:36
                      AM
                      Please respond to
                      MQSeries List






I tried what you suggested. Inside the script there is no return code being
returned at least not one I am trapping. I executed the followig code
suggested by someone on the LISTSERV:

                SYSTEM)"$Import $MessageFlowFile $DeleteOption $LabelOption 
$UUIDOption")
;
                $MyScalar = $?;
                print "\nReturn Code = $MyScalar";

The value printed is zero ('0') BUT....when I try it outside of PERL using
your suggestion I get a value:

C:\Program Files\IBM\WebSphere MQ Integrator 2.1\Tool>mqsiimportmsgflows.bat
c:\myfile.txt -d -l -u

file:/C:/Program Files/IBM/WebSphere MQ Integrator 2.1/Tool/Parser: 1, 0:
Invalid document structure.
BIP1018S: Unexpected exception in utility ImportMsgFlows; method
getMsgFlowsFromExportFile.
An exception was caught by the ImportMsgFlows utility in method
getMsgFlowsFromExportFile. The exception text is: java.lang.Null nt
operation will end.
Retry the operation if possible. If the exception still occurs, contact your
IBM support center.

C:\Program Files\IBM\WebSphere MQ Integrator 2.1\Tool>echo %ERRORLEVEL%
18

I do not know the difference between executing the 'SYSTEM' command inside
the script as opposed to executing the command from the command line and
using the "ERRORLEVEL" variable. I have a work around for the moment. I can
trap the output from the command and do a pattern match on the BIP\d+[SE]
character string. If I get a hit I know I have an eror.


                                                     bobbee

PSSSSSS

I was just looking at a WEB site for the book "perl by EXAMPLE" this was a
statement about the $? and $! special variables. So maybe the "return Code"
point is mute!!

"You can't rely on these variables to check the status of pipes, back-quoted
strings, or the system() function when executing scripts under       the
Windows operating system. My recommendation is to capture the output of the
back-quoted string and check it directly for rror messages. Of course, the
command writes its errors to STDERR and then can't trap them, and you're out
of luck".






--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Reply via email to