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>FORTRAN</strong> Statements<br />

2.79 SUBROUTINE Statement<br />

<br />

SUBROUTINE sub [( [d [, d] ...] )]<br />

where:<br />

sub<br />

d<br />

is a symbolic name of a subroutine subprogram.<br />

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

argument.<br />

A SUBROUTINE statement is used to define the start of a subroutine subprogram.<br />

Example:<br />

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

END<br />

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

THEMAX = ARGA<br />

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

IF( ARGC .GT. THEMAX ) THEMAX = ARGC<br />

PRINT *, THEMAX<br />

END<br />

In the above example, the subroutine TMAX3 is defined to find and print out the maximum value of three<br />

real variables.<br />

Notes:<br />

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

parentheses () are optional.<br />

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

SUBROUTINE Statement 141

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

Saved successfully!

Ooh no, something went wrong!