----- Original Message -----
From: "Pavel Smejkal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2001 11:06 AM
Subject: Exit status from DCL procedure ??


> use vmsish 'status';
>
> $msg = `\@AA.com`;
> $cmd_status = $?;
> print "cmd status is:$cmd_status\n";
> ------------------------------------------------
>
[...]
> if I am changing XXX value then I am get in perl code
>
> XXX      $?
> 0            1
> 1            1
> 2            268435458
> 3            3
> 4            268435460
> 5            4
> 6            268435462
> 7            7
> 8            8
>
>From perldoc perlVMS
<quote>
$?

The ``status value'' returned in $? is synthesized from the actual exit
status of the subprocess in a way that approximates POSIX wait(5) semantics,
in order to allow Perl programs to portably test for successful completion
of subprocesses. The low order 8 bits of $? are always 0 under VMS, since
the termination status of a process may or may not have been generated by an
exception. The next 8 bits are derived from severity portion of the
subprocess' exit status: if the severity was success or informational, these
bits are all 0; otherwise, they contain the severity value shifted left one
bit. As a result, $? will always be zero if the subprocess' exit status
indicated successful completion, and non-zero if a warning or error
occurred. The actual VMS exit status may be found in $^S (q.v.).

</quote>

The pragma <use vmsish> didnt work in my case.
I use the <system> call instead and check $? afterwards.
Both 0 and 1 are an ok exit status under VMS and are translated to zero.
If $? is -1 it failed to start the program.
Any other non-zero value indicates and abnormal exit from the program. An
description of the error van be found in $^E.

Maarten.

Reply via email to