I use sys$forcex to call the exit handler of a detached process, passing in a
status.
This works ok on a Vax, but on the Alpha the exit handler is called, but the
status is not as expected.
Forcex code
j_value = SS$_ABORT
j_status = sys$forcex ( , c_proc_str(1:i_len), %val(j_value) )
Exit Handler
PROGRAM TEST_EXIT
IMPLICIT NONE
EXTERNAL EXIT_HANDLER
STRUCTURE /EXIT_DESCRIPTOR/
INTEGER*4 J_LINK
INTEGER*4 J_ADDR
INTEGER*4 J_ARGS /0/
INTEGER*4 J_ANARG
END STRUCTURE
INTEGER*4 JC_DUMMY
RECORD /EXIT_DESCRIPTOR/ EXIT_DSCRPT
COMMON /EXITDS/ JC_DUMMY
! Declare exit handler
EXIT_DSCRPT.J_ADDR = %LOC(EXIT_HANDLER)
EXIT_DSCRPT.J_ANARG = %LOC(JC_DUMMY)
CALL SYS$DCLEXH(EXIT_DSCRPT)
CALL SYS$SETPRN('TEST_EXIT')
CALL LIB$WAIT(20000.0)
END
SUBROUTINE EXIT_HANDLER (j_status)
IMPLICIT NONE
INTEGER*4 J_STATUS
CALL EXIT (j_status)
END
Any idea?
(9801) Exit Handlers, $forcex and $dclexh?
Re: (9801) Exit Handlers, $forcex and $dclexh?
That the exit handler is triggered would imply the call is arriving
correctly in the process, but that the associated data structures
or the associated exit handler routine is somehow invalid.
On of the key requirements fo the exit handler storage is that it
is declared outside the scope of any routine; that the storage is
declared as a COMMON or as static storage. That appears to be
the case here, but is common source of errors with this call.
You can find a Fortran example of the sys$dclexh call in the
Natural Language Search Assistance (AskQ) database, using a
search string such as
Fortran $dclexh call example?
The support database also includes a number of other examples of
other calls for other routines and other languages, as cited in
the OpenVMS FAQ and elsewhere.
In your case, the OpenVMS Wizard would also expect the argument count
should be set to one (1), as you are passing the condition value to
the exit handler routine; the exit handler has an argument. The
description structure is a declaration of the exit handler argument
list and related, and must match the exit handler calling sequence.
correctly in the process, but that the associated data structures
or the associated exit handler routine is somehow invalid.
On of the key requirements fo the exit handler storage is that it
is declared outside the scope of any routine; that the storage is
declared as a COMMON or as static storage. That appears to be
the case here, but is common source of errors with this call.
You can find a Fortran example of the sys$dclexh call in the
Natural Language Search Assistance (AskQ) database, using a
search string such as
Fortran $dclexh call example?
The support database also includes a number of other examples of
other calls for other routines and other languages, as cited in
the OpenVMS FAQ and elsewhere.
In your case, the OpenVMS Wizard would also expect the argument count
should be set to one (1), as you are passing the condition value to
the exit handler routine; the exit handler has an argument. The
description structure is a declaration of the exit handler argument
list and related, and must match the exit handler calling sequence.