For Programmers: Free Programming Magazines  


Home > Archive > Fortran > February 2008 > beginner question about exit values









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author beginner question about exit values
Bernard Barbier

2008-02-13, 8:12 am

Hello,

At first excuse for my poor english....

I have to translate a program from C Language to Fortran.

C Code is like that :
int main () {
/*calculus...*/
if (convergence criteria is OK) return (2);
else return (3) ;
}

And I can use unix variable $? to control my batch process ie :
#!/bin/sh
# my program
calculus
#STATUS shell variable will contain my program exit status
STATUS=$?
# tests and actions
if [ $STATUS -eq 2]
then
action_1
fi
if [ $STATUS -eq 3]
then
action_2
fi

My question is :
How can I set an exit value in Fortran ?

Thanks a lot.
Bernard.
Tim Prince

2008-02-13, 7:14 pm

Bernard Barbier wrote:
> Hello,
>
> At first excuse for my poor english....
>
> I have to translate a program from C Language to Fortran.
>
> C Code is like that :
> int main () {
> /*calculus...*/
> if (convergence criteria is OK) return (2);
> else return (3) ;
> }
>


> My question is :
> How can I set an exit value in Fortran ?
>

You should find a recent thread on this in the archives. Many compilers
support e.g.
STOP 3
but it's not universal.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com