Topic: Anyone know about setrcd?

I have the F90 source code for an older program that when I build, it complains about not having access to setrcd.

The specific code is:

subroutine EXIT_WITH_STATUS ( STATUS )
  ! Exit and return STATUS to the invoking process
    integer, intent(in) :: STATUS
    external :: SETRCD
    call setrcd ( status )
    stop
  end subroutine EXIT_WITH_STATUS

In Googling, this appears to possibly be from Lahey/Fujitsu Fortran, and provides some sort of integer/byte for a status code.

Can anyone shed any more light on this topic? Possible problems with deleting this reference?

2 (edited by peter.kelly 2023-12-03 10:23:47)

Re: Anyone know about setrcd?

I haven't seen that in a long time smile
What that code snippet is doing is accepting a status from its caller and transmitting it back to whomever actually started the application and exiting the application. Say my program wanted to open a file "foobar.dat" and failed to open it. I would take the status given by the Fortran Open command (iostat=my_open_fail_status) and call EXIT_WITH_STATUS(my_open_fail_status). It would then cause my program to exit and return "my_open_fail_status" to whatever had actually called the program. That could be the dos shell, or in Unix, whatever had spawned the program.
If you are using the Simply Fortran GCC compiler, you can replace EXIT_WITH_STATUS(me_status) with CALL EXIT(me_status) and everything will work identically. "Call Exit()" is a language extension and not part of the standard as far as I know, so you may wish to use the "error stop" construct such as "error stop me_status, quiet=.true."  to stop the program as you can use that out of a pure subroutine, and no stderror output but pass the exit status to the invoker.
I hope this helps and is clear enough. If not, reply and & try to clarify