24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Language</strong> <strong>Reference</strong><br />

2.39 ENTRY Statement<br />

<br />

ENTRY name [( [d [, d] ...] )]<br />

where:<br />

name<br />

d<br />

is a symbolic name of an entry in a function or subroutine subprogram. If the ENTRY statement<br />

appears in a subroutine subprogram then name is a subroutine name. If the ENTRY statement<br />

appears in a function subprogram then name is an external function name.<br />

is a variable name, array name, dummy procedure name, or an asterisk. d is called a dummy<br />

argument. An asterisk is allowed only in a subroutine subprogram.<br />

The ENTRY statement is used to define an alternate entry into a subprogram.<br />

Example:<br />

PRINT *, TMAX2( 121.0, -290.0 )<br />

PRINT *, TMAX3( -1.0, 12.0, 5.0 )<br />

END<br />

FUNCTION TMAX3( ARGA, ARGB, ARGC )<br />

T3 = ARGC<br />

GO TO 10<br />

ENTRY TMAX2( ARGA, ARGB )<br />

T3 = ARGA<br />

10 TMAX2 = ARGA<br />

IF( ARGB .GT. TMAX2 ) TMAX2 = ARGB<br />

IF( T3 .GT. TMAX2 ) TMAX2 = T3<br />

END<br />

In the above example, an entry was defined to permit us to find the maximum of two real variables. Either<br />

the entry name TMAX2 or the function name TMAX3 could have been used as the variable for returning the<br />

maximum value since they agree in type. It is not necessary to precede an ENTRY statement with a transfer<br />

statement as the ENTRY statement is not an executable statement; the next statement executed will be the<br />

first executable statement following the ENTRY statement.<br />

Notes:<br />

1. No dummy arguments need be specified in the ENTRY statement. If this is the case, the<br />

parentheses () are optional.<br />

For more information, see the chapter entitled "Functions and Subroutines" on page 243.<br />

70 ENTRY Statement

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!