CPAR$ CONTEXT_SHARED var_name[,...,var_name] CPAR$ CONTEXT_SHARED_ALL CPAR$ DO_PARALLEL [distribution-size] CPAR$ LOCKON lock-variable CPAR$ LOCKOFF lock-variable CPAR$ PRIVATE name[,...,name] CPAR$ PRIVATE_ALL CPAR$ SHARED common_name[,...,common_name] CPAR$ SHARED_ALL
You can use directives in a Fortran source program to influence certain aspects of the compilation process.
Directives are prefixed, starting in column 1, with a 5-character identifier and a space (or tab). Directives prefixed with CDEC$ are enabled in all Fortran compilation units, regardless of the qualifiers used on the FORTRAN command line.
Directives prefixed with CPAR$ are enabled only in Fortran compilation units involved in parallel processing (that is, when the /PARALLEL qualifier is specified on the FORTRAN command line). If the /PARALLEL qualifier is not specified, parallel-processing directives (CPAR$ directives) are interpreted as comment lines.
A directive statement cannot be continued across multiple lines in a source program, and any blanks appearing after column 6 are insignificant.
Continuation lines cannot appear in directive statements.
If a blank common block is used in a compiler directive, it must be specified as two slashes (/ /).
Additional Information on:
ACCEPT, ASSIGN, assignment statements, BACKSPACE, CALL, CLOSE,
CONTINUE, DELETE, DO, END DO, ELSE, END, ENDFILE, FIND, GO TO, IF,
END IF, INQUIRE, OPEN, PAUSE, PRINT, READ, RETURN, REWIND, REWRITE,
STOP, TYPE, UNLOCK, and WRITE.
Specification_Statements
The specification statements are:
AUTOMATIC, BLOCK DATA, COMMON, DATA, DIMENSION, EQUIVALENCE,
EXTERNAL, IMPLICIT, INTRINSIC, NAMELIST, PARAMETER, POINTER,
PROGRAM, RECORD, SAVE, STATIC, structure declarations, type
declarations, and VOLATILE.
ACCEPT
Formatted ACCEPT f[,iolist]
List-directed ACCEPT *[,iolist]
Namelist ACCEPT n
f Is a format specifier not prefaced by FMT=.
iolist Is a simple I/O list element or an implied-DO list.
* Specifies list-directed formatting (can be specified as FMT=*).
n The nonkeyword form of a namelist specifier.
The control-list parameters are "f," "*" (or FMT=*), and "n". The I/O list parameter is "iolist".
The formatted ACCEPT statement transfers data from your terminal to internal storage. The access mode is sequential.
The list-directed ACCEPT statement translates the data from character to binary format according to the data types of the variables in the I/O list.
The namelist ACCEPT statement translates the data from character to binary format according to the data types of the list entities in the corresponding NAMELIST statement.
Also see the READ Statement.
ASSERT
See CDEC$ ASSERT under Statements Directive_Statements in this Help
file.
ASSIGN
Assigns the value of a statement label to an integer variable.
Statement format:
ASSIGN s TO v
s Is the label of an executable statement or a FORMAT statement. You must specify the label as an unsigned integer (from 1-5 characters long, using digits 0-9).
v Is an integer variable name (must be INTEGER*4).
When the value of a statement label is assigned to an integer
variable: the variable can then be used as a transfer destination
in a following assigned GOTO statement or as a format specifier in
a formatted I/O statement. The ASSIGN statement must be in the
same program unit as and must be executed before the statement(s)
in which the assigned variable is used.
Assignment
Assigns the value of the expression to the variable.
Arithmetic/Logical/Character assignment takes the form:
v = e
v Is a scalar memory reference.
e Is an arithmetic expression (arithmetic assignment), a character scalar memory reference (character assignment), or a logical scalar memory reference (logical assignment).
The right side of the equation must evaluate to a data type compatible with the variable on the left side. If aggregates are involved, the aggregate reference and the aggregate must have matching structures.
Additional Information on:
AUTOMATIC v [,v]... STATIC v [,v]...
v Is the name of a variable, array, or array declarator.
The following table summarizes the difference between automatic and static variables upon entry to and exit from a subprogram:
+-----------+---------------------------+------------------------+ | Variable | Entry | Exit | +-----------+---------------------------+------------------------+ | AUTOMATIC | Variables are unassigned, | The storage area allo- | | | and do not reflect any | cated to the variable | | | changes caused in the | is deleted. | | | previous execution of | | | | the program. | | +-----------+---------------------------+------------------------+ | STATIC | Values of the subprogram | The current values of | | | variables are unchanged | the variables are kept | | | since the last execution | in the static storage | | | of the subprogram. | area. | +-----------+---------------------------+------------------------+
By default, all variables are STATIC. To change the default from STATIC to AUTOMATIC, specify the /RECURSIVE compiler option.
To override the compiler option in effect for specific variables, specify the variables in AUTOMATIC or STATIC type statements.
NOTE
Variables in COMMON, DATA, EQUIVALENCE, and SAVE statements, or in BLOCK DATA subprograms are always STATIC, regardless of the /RECURSIVE compiler option or any previous AUTOMATIC specification.
AUTOMATIC variables can reduce memory use because only the variables currently being used are allocated to memory.
AUTOMATIC variables permit recursion. With recursion, a subprogram
can call itself (directly or indirectly), and resulting values are
available upon a following call or return to the subprogram.
BACKSPACE
Repositions a sequential file that is currently open for sequential
access to the beginning of the preceding record. The file must be
on disk or tape. Statement format:
BACKSPACE ([UNIT=]u[,ERR=s][,IOSTAT=ios]) BACKSPACE u
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. s Is the label of a statement that receives control if an error occurs, prefaced by ERR=. ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT= (positive if an error occurs, zero if no error occurs).
A BACKSPACE statement should not be specified for a file that is
open for direct or append access. Backspacing from record "n" can
be done by rewinding to the start of the file and then performing
n-1 successive reads to reach the previous record. For direct and
append access, the current record count ("n") is not available to
the Fortran I/O system.
BLOCK_DATA
Begins a block data program unit. Statement format:
BLOCK DATA [nam]
nam Is the symbolic name used to identify the block.
A BLOCK DATA statement and its associated specification statements are a special kind of program unit, called a block data subprogram. The block data subprogram has the following syntax rules:
- Any of the following specification statements can appear in a block data subprogram:
COMMON RECORD DATA SAVE DIMENSION STATIC EQUIVALENCE Structure declaration IMPLICIT Type declaration statements PARAMETER
- A block data subprogram must not contain any executable statements.
- As with other types of program units, the last statement in a block data subprogram must be an END statement.
- Within a block data subprogram, if a DATA statement initializes any entity in a named common block, the subprogram must have a complete set of speci- fication statements that establishes the common block. However, all the entities in the block do not have to be assigned initial values in a DATA statement.
- One block data subprogram can establish and define initial values for more than one common block.
- The name of a block data subprogram can appear in the
EXTERNAL statement of a different program unit to force
a search of object libraries for the BLOCK DATA program
unit at link time.
CALL
Transfers control and passes arguments to a subprogram.
CALL sub[([a][,[a]]...)]
sub Is the name of a subroutine, or other external procedure, or a dummy argument associated with a subroutine subprogram or other external procedure.
a Is a value to be passed to the subroutine.
If you specify an argument list, the CALL statement associates the values in the list with the dummy arguments in the subroutine. It then transfers control to the first executable statement following the SUBROUTINE or ENTRY statement referenced by the CALL statement.
The arguments in the CALL statement must agree in number, order, and data type with the dummy arguments in the subroutine. They can be variables, arrays, array elements, records, record elements, record arrays, record array elements, substring references, constants, expressions, Hollerith constants, alternate return specifiers, or subprogram names. An unsubscripted array name or record array name in the argument list refers to the entire array.
An alternate return specifier is an asterisk (or ampersand) followed by the label of a statement in the program unit containing the CALL statement.
DEC Fortran allows direct or indirect recursive calls to
subroutines, if you specify the /RECURSIVE compiler option.
CLOSE
Closes a file. Statement format:
CLOSE ([UNIT=]u[,p][,ERR=s][,IOSTAT=ios])
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
p Is the disposition of the file after closing, prefaced by STATUS=, DISPOSE= or DISP=. Dispositions are as follows:
'KEEP' Retains the file. *DEFAULT FOR ALL BUT SCRATCH FILES* 'SAVE' Retains the file. 'DELETE' Deletes the file. *DEFAULT FOR SCRATCH FILES* 'PRINT' Submits the file as a print job. 'PRINT/DELETE' Submits then deletes the file as a print job. 'SUBMIT' Submits the file as a batch job. 'SUBMIT/DELETE' Submits then deletes the file as a batch job.
s Is the label of an executable statement.
ios Is an integer scalar memory reference. (Returns a zero if no error condition exists or a positive integer if an error condition exists.)
The disposition specified in a CLOSE statement supersedes the
disposition specified in the OPEN statement, except that a file
opened as a scratch file cannot be saved, printed, or submitted,
nor can a file opened for read-only access be deleted.
COMMON
Defines one or more contiguous blocks of storage shared among
separate subprograms. You can define the same common block in
different program units of your program. The first COMMON
statement in a program unit to name a common block defines it;
later COMMON statements that name the block reference it. You can
leave one common block (the "blank" common block) unnamed.
Statement format:
COMMON [/[cb]/]nlist[[,]/[cb]/nlist]...
cb Is a symbolic name to identify the common block.
nlist Is one or more names of variables, arrays, array declarators, or records to identify elements of the common block.
Any common block name, blank or otherwise, can appear more than once in one or more COMMON statements in a program unit. The list following each successive appearance of the same common block name is treated as a continuation of the list for the block associated with that name.
You can use array declarators in the COMMON statement to define arrays.
A common block can have the same name as a variable, array, record, structure, or field. However, in a program with one or more program units, a common block cannot have the same name as a function, subroutine, or entry name in the executable program.
When common blocks from different program units have the same name, they share the same storage area when the units are combined into an executable program.
Entities are assigned storage in common blocks on a one-for-one basis. Thus, the entities assigned by a COMMON statement in one program unit should agree with the data type of entities placed in a common block by another program unit; for example, consider a program unit containing the following statement:
COMMON CENTS
Consider another program unit containing the following statements:
INTEGER*2 MONEY COMMON MONEY
When these program units are combined into an executable program,
incorrect results can occur if the 2-byte integer variable MONEY is
made to correspond to the lower-addressed two bytes of the real
variable CENTS.
CONTINUE
Transfers control to the next executable statement. The CONTINUE
statement is used primarily as the terminal statement of a labeled
DO loop when that loop would otherwise end improperly with a GOTO,
arithmetic IF, or other prohibited control statement. Statement
format:
CONTINUE
DATA
Assigns values to variables at compile time. The values within the
backslashes are assigned to the preceding variables left to right;
the number of values must equal the number of variable elements.
Statement format:
DATA nlist/clist/[[,] nlist/clist]...
nlist Is a list combining any combination of variable names, array names, array element names, character substring names, and implied-DO lists. (RECORDs are not allowed in this list.) Elements in the list must be separated by commas.
Subscript expressions and expressions in substring references must be integer expressions containing integer constants and implied-DO variables.
An implied-DO list in a DATA statement takes the following form:
(dlist, i = n1,n2[,n3])
dlist Is a list of one or more array element names, character substring names, or implied-DO lists, separated by commas.
i Is the name of an integer variable.
n1,n2,n3 Are integer constant expressions. The expression can contain implied-DO variables of other implied-DO lists that have this implied-DO list within their ranges.
clist Is a list of constants separated by commas; "clist" constants take one of the following forms:
c OR n *c
c Is a constant or the symbolic name of a constant.
n Defines the number of times the same value is to be assigned to successive entities in the associated "nlist"; "n" is a nonzero, unsigned integer constant or the symbolic name of an unsigned integer constant.
The DATA statement assigns the constant values in each "clist" to the entities in the preceding "nlist", from left to right, as they appear in the "nlist". The number of constants must equal the number of entities in the "nlist".
When an unsubscripted array name appears in a DATA statement, values are assigned to every element of that array in the order of subscript progression. The associated constant list must contain enough values to fill the array.
For more information on the relationship between "nlist" and
"clist", see your user manual.
DELETE
Deletes a record from an indexed or relative file.
Format -- indexed:
DELETE ([UNIT=]u[,ERR=s][,IOSTAT=ios])
Deletes the current record (last record read) from an indexed file.
Format -- Relative:
DELETE ([UNIT=]u,REC=r[,ERR=s][,IOSTAT=ios])
DELETE (u'r[,ERR=s][,IOSTAT=ios])
Deletes the specified record from a relative file.
u Is the logical unit specifier, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
r Is a record position specifier, prefaced by REC=.
u'r Is a unit and a record position specifier, not prefaced by REC=.
s Is the label of a statement to which control is transferred if an error occurs, prefaced by ERR=.
ios Is an I/O status specifier, prefaced by IOSTAT=.
The forms of the DELETE statement with relative files are direct access deletes. These forms delete the record specified by the number "r".
The DELETE statement logically removes the appropriate record from the specified file by locating the record and marking it as a deleted record. A new record can be written into that position.
Following a direct access delete, any associated variable is set to
the next record number.
DICTIONARY
At compile time, incorporates VAX Common Data Dictionary data
definitions into the current Fortran source file. The DICTIONARY
statement can appear anywhere in a Fortran source file that a
specification statement is allowed. Statement format:
DICTIONARY 'cdd-path [/[NO]LIST]'
cdd-path The full or relative pathname of a Common Data Dictionary object. The resulting pathname must conform to the rules for forming Common Data Dictionary pathnames. The object must be a record description.
/[NO]LIST Directs the compiler to include (or not include) the resulting Fortran source representation in the program listing. /LIST and /NOLIST must be spelled completely.
In the following example, the logical name definition specifies the beginning of the CDD pathname; thus, a relative pathname specifies the remainder of the path to the record definition:
$ DEFINE CDD$DEFAULT CDD$TOP.FOR
The following examples show how a CDD pathname beginning with CDD$TOP overrides the default CDD pathname. Consider a record with the pathname CDD$TOP.SALES.JONES.SALARY. If you defined CDD$DEFAULT to be CDD$TOP.SALES.JONES, you could then specify a relative pathname:
DICTIONARY 'SALARY'
Alternatively, you could specify a full pathname:
DICTIONARY 'CDD$TOP.SALES.JONES.SALARY'
DIMENSION
Defines the number of dimensions in an array and the number of
elements in each dimension. Statement format:
DIMENSION a([d1:]d2)[,a([d1:]d2)]...
a Is the symbolic name of the array. If the array is not defined in a data type statement, the array takes an implicit data type.
[d1:]d2 Is the optional lower (d1) and required upper (d2)
bounds of the array.
DO
Executes a block of statements repeatedly until the value of a
control variable equals, exceeds, or is less than the terminal
value, according to the control variable specified in the DO loop.
The block of statements starts immediately following the DO
statement.
You can transfer control out of a DO loop, but not out of a parallel DO loop.
Statement format:
DO [s[,]] v = e1,e2[,e3]
s Is the optional label of an executable statement that follows the DO statement in the same program unit. The label designates the last statement of the DO loop. If omitted, an END DO statement is required.
v Is the control variable; an integer or real variable (it cannot be a record field). You cannot modify the control variable inside the DO loop.
e1 Is the initial value of the control variable; an integer or real value.
e2 Is the terminal value of the control variable; an integer or real value.
e3 Is the value by which to increment the control variable after each execution of the DO loop; integer or real value. It cannot be 0. The default of e3 is 1.
If the iteration count (the number of executions of the DO range)
is zero or negative, the body of the loop is not executed. If the
/NOF77 compiler option is specified and the iteration count is zero
or negative, the body of the loop is executed once.
DO_WHILE
Executes a block of statements repeatedly until the value of a
logical expression is false. Statement format:
DO [s[,]] WHILE (e)
s Is the label of an executable statement that follows the DO statement in the same program unit. The label designates the last statement of the DO loop. If omitted, an END DO statement is required.
e Is a logical expression. You can reference and modify the variable elements of the expression within the DO loop.
You can transfer control out of a DO WHILE loop but not into a loop from elsewhere in the program.
The DO WHILE statement tests the logical expression at the beginning of each execution of the loop, including the first. If the value of the expression is true, the statements in the body of the loop are executed; if the expression is false, control transfers to the statement following the loop.
If no label appears in the DO WHILE statement, the DO WHILE loop
must be terminated with an END DO statement.
ELSE
Executes a block of statements if no preceding statement block in a
block IF construct was executed. The block of statements starts
immediately following the ELSE statement. The block is terminated
by an END IF statement. Statement format:
ELSE
ELSE_IF
Executes a block of statements if no preceding statement block in a
block IF construct was executed and if the value of a logical
expression is true. The block of statements starts immediately
following the ELSE IF statement. The block is terminated by
another ELSE IF statement, an ELSE statement, or an END IF
statement. Statement format:
ELSE IF (e) THEN
Where e represents a logical expression.
END
Marks the end of a program unit. The END statement must be present
as the last statement of every program unit. In a main program,
execution terminates if control reaches the END statement. In a
subprogram, a RETURN statement is implicitly executed. Statement
format:
END
END_DO
Terminates the block of statements following a DO or DO WHILE
statement when a label is not used. Statement format:
END DO
END_MAP
Marks the end of a map declaration within a union declaration in a
structure declaration block. Terminates a field declaration or a
series of field declarations that started with the MAP statement.
The END MAP statement must be present in a map declaration.
Statement format:
END MAP
END_STRUCTURE
Marks the end of a structure declaration. The END STRUCTURE
statement must be present as the last statement of every structure
declaration. Statement format:
END STRUCTURE
END_UNION
Marks the end of a union declaration within a structure declaration
block. The END statement must be present as the last statement of
every union declaration. Statement format:
END UNION
ENDFILE
Writes an end of file record to a file. An end of file record
consists of one byte with the ASCII value 26 (CTRL/Z). An end-file
record can be written only to sequential organization files that
are accessed as formatted sequential files or unformatted segmented
sequential files. Statement format:
ENDFILE ([UNIT=]u[,ERR=s][,IOSTAT=ios]) ENDFILE u
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
s Is the label of a statement to which control is transferred if an error occurs, prefaced by ERR=.
ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT= (a zero if no error occurs; a positive value if an error occurs).
If the unit specified in the ENDFILE statement is not open, the default file is opened for unformatted output.
An end-of-file record consists of one byte with the ASCII value 26 (Ctrl/Z). An end-of-file record can be written only to sequential organization files that are accessed as formatted sequential files or unformatted segmented sequential files.
An ENDFILE statement must not be specified for a file that is open
for direct access. End-of-file records should not be written in
files that are read by programs written in a language other than
Fortran.
END_IF
Terminates a block IF construct. Statement format:
END IF
ENTRY
Designates an alternate entry point at which execution of a
subprogram can commence. You cannot use an ENTRY statement in a DO
loop or a block IF construct. Statement format:
ENTRY nam[([p[,p]...])]
nam Is a symbolic name for the entry point. The name must be unique among all global names in the program. In a function subprogram, the data type defined for or implied by the name and the data type of the function must be consistent within the following groups:
Group 1: BYTE, INTEGER*1, INTEGER*2, INTEGER*4, LOGICAL*1, LOGICAL*2, LOGICAL*4, REAL*4, REAL*8, and COMPLEX*8 Group 2: REAL*16 and COMPLEX*16 Group 3: CHARACTER
If the data type is character, the length of the entry point name must be the same as the function name or must be of passed length.
p Is a dummy argument or an alternate return argument (designated by an asterisk). The arguments must agree in order, number, and type with the actual arguments of the statement invoking the entry point. The arguments need not agree in name, order, number, or type with the dummy arguments in the SUBROUTINE or FUNCTION statement for the subprogram. You must use only the dummy arguments defined in the ENTRY statement.
The ENTRY statement is not executable and can appear within a
function or subroutine program after the FUNCTION or SUBROUTINE
statement. Execution of a subprogram referred to by an entry name
begins with the first executable statement after the ENTRY
statement.
EQUIVALENCE
Starts two or more data elements in one program unit at the same
storage location, thereby overlaying them in memory. Statement
format:
EQUIVALENCE (nlist)[,(nlist)]...
nlist Is a list of variables, array elements, arrays, or character substring references, separated by commas. You must specify at least two of these entities in each list.
The elements named within each set of parentheses are given the same storage location. The data elements do not have to be of the same type or length. An equivalency begins with the first byte of each element. When an array or substring element is equivalenced, the entire array or string is equivalenced in its normal linear storage.
You cannot equivalence array or string elements in a manner that is inconsistent with their normal linear order. You cannot equivalence elements of the same array or string. You cannot equivalence two elements that are both in common areas.
Records, record fields, and dummy arguments cannot be specified in EQUIVALENCE statements.
You can identify a multidimensional array element by a single
subscript. The single subscript designates the absolute position
of the element within the array.
EXTERNAL
Specifies that a name is a global symbol defined outside the
program unit. Statement format:
EXTERNAL v[,v]... EXTERNAL *v[,*v]...
v Is the symbolic name of a user-supplied subprogram, or the name of a dummy argument associated with the name of a subprogram. If you name an intrinsic subprogram, that name becomes disassociated from the intrinsic subprogram and is assumed to be the name of an external element. (The INTRINSIC statement allows intrinsic function names to be used as arguments.)
* Is permitted only with the -nof77 option.
You must use EXTERNAL statements in the following cases:
- To identify subprogram or entry point names passed as actual arguments
- To identify a block data program unit that will reside in a library module not explicitly referenced at link time.
You do not need to use an EXTERNAL statement to identify a
subprogram or entry point name used as the object of a CALL
statement or function reference; these names are recognized as
external implicitly.
FORMAT
Defines the conversion of data in formatted data transfer
operations. Statement format:
FORMAT (q1 f1s1 f2s2 ... fnsn qn)
qn Is zero or more slash (/) record terminators.
fn Is a field descriptor, an edit descriptor, or a group of field and edit descriptors enclosed in parentheses.
sn Is a field separator (a comma or slash). A comma can be omitted in the following cases:
o Between a P edit descriptor and an immediately following F, E, D, or G edit descriptor.
o Before or after a slash (/) record terminator.
o Before or after a colon (:) edit descriptor.
The "field descriptor" has one of the following forms:
[r]c [r]cw [r]cw.m [r]cw.d[Ee]
r Is the optional repeat count. (If you omit r, the repeat count is assumed to be 1.)
c Is a format code (I,O,Z,F,E,D,G,L, or A).
w Is the external field width in characters. Each data item in the external medium is called an external field.
m Is the minimum number of characters that must appear in the field (including leading zeros).
d Is the number of characters to the right of the decimal point.
E Is an exponent field.
e Is the number of characters in the exponent.
The terms "r", "w", "m" and "d" must all be unsigned integer constants or variable format expressions. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution.
The values of "r" and "w" must be in the range of 1 through 32767 (2**15-1), the values of "m" and "d" must be in the range of 0 through 255 (2**8-1), and "e" must be in the range of 1 through 255 (2**8-1). You cannot use PARAMETER constants for the terms "r", "w", "m", "d", or "e".
The "edit descriptor" has one of the following forms:
c [n]c c[n]
c Is a format code (X,T,TL,TR,SP,SS,S,BN,BZ,P,H,Q,'...' $, or :).
n Is the optional number of characters or character positions.
The term "n" must be an unsigned integer constant (for format code P, it can be signed or unsigned) or a variable format expression. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution.
The value of "n" for P must be within the range -128 to 127. For all other format codes, the value of "n" must be within the range 1 through 65535 (2**16-1); above 65535, the value truncates to 16 bits. Note that if you write to a record, it must be able to accommodate the size of "n".
For more detail see Format_Specifiers.
FUNCTION
Begins a function subprogram. Identifies the data type of the
function and names the dummy arguments. Format:
[typ] FUNCTION nam[*m][([p[,p]...])]
typ Is a data type. If you do not specify a data type, the data type of the function is implied from its name. If the data type is CHARACTER, you can specify CHARACTER*(*) to indicate a passed length function type -- the function type assumes the length of its definition in the program unit invoking it.
nam Is a symbolic name for the function. The name must be unique among all global names in the program. The name is used as a variable within the function. The value of the variable is returned to the caller of the function as the value of the function.
m Is an unsigned, nonzero integer specifying the length of the data type. It must be one of the valid length specifiers for "typ". This length overrides the length specified or implied by the type.
p Is an unsubscripted variable name specifying a dummy argument. The arguments must agree in order, number, and type with the actual arguments of the statement invoking the function. A dummy argument must not be defined as an array with more elements than the actual argument holds.
The array declarator for a dummy argument can itself contain integer values that are dummy arguments or are references to a common block, providing for adjustable size arrays in functions. The upper bound of the array declarator for a dummy argument can be specified as an asterisk, in which case the upper bound of the dummy argument assumes the size of the upper bound of the actual argument. The size in a character string declarator for a dummy argument can be specified as an asterisk in parentheses -- in which case the size of the actual argument is passed to the dummy argument.
The values of the actual arguments in the invoking program unit become the values of the dummy arguments in the function. If you modify a dummy argument, the corresponding actual argument in the invoking program unit is also modified; the actual argument must be a variable if it is to be modified.
If the actual argument is a character constant, the dummy argument can be either character or numeric in type, unless the name of the subprogram being invoked is a dummy argument in the invoking program unit. If the actual argument is a Hollerith constant, the dummy argument must be numeric.
The FUNCTION statement must be the first statement of a function subprogram, unless an OPTIONS statement is specified. A function subprogram cannot contain a SUBROUTINE statement, a BLOCK DATA statement, a PROGRAM statement, or another FUNCTION statement. ENTRY statements can be included to provide multiple entry points to the subprogram.
NOTE
In a function, the function name identifier refers to the return value, not the function itself, unless an argument list is present. Therefore, it is not possible to pass a function as an argument to another routine from inside the function. For example, consider the following:
INTEGER FUNCTION RECURSIVE_FUNCTION . . . CALL OTHERSUB (RECURSIVE_FUNCTION)
The reference to RECURSIVE_FUNCTION in the CALL statement passes the function return value, not the function itself.
Function_Reference
Transfers control and passes arguments to a function. Format:
nam(p[,p]...)
nam Is the name of the function or the name of an entry point to the function.
p Is a value to be passed to the function. The value
can be a constant, the name of a variable, the name
of an array element, the name of an array, an expression,
a substring, field reference, or the name of a subprogram
or entry point to a subprogram (must be defined as
external). You must not specify more than 255 arguments.
GOTO
Transfers control within a program unit. Depending upon the value
of an expression, control is transferred either to the same
statement every time GO TO is executed or to one of a set of
statements.
Additional Information on:
For each type of IF statement, the decision to transfer control or to execute the statement or block of statements is based on the evaluation of an expression within the IF statement.
Additional Information on:
IMPLICIT typ(a[,a]...)[,typ(a[,a]...)]...
typ Is any data type except CHARACTER*(*). When "typ" is equal to CHARACTER*len, "len" specifies the length for character data type. The "len" is an unsigned integer constant or an integer constant expression enclosed in parentheses, and must be in the range of 1 to 65535.
a Is an alphabetical character. If you specify a range of alphabetic characters (two characters joined by a hyphen), the first character must be less than the second.
The IMPLICIT statement assigns the specified data type to all
symbolic names that have no explicit data type and begins with the
specified letter or range of letters. It has no effect on the
default types of intrinsic procedures.
IMPLICIT_NONE
Inhibits the implicit declaration of data types in the program
unit. When it is used, you must declare the data types of all
symbols explicitly. You must not include any other IMPLICIT
statements in the program unit. containing an IMPLICIT NONE
statement. Statement format:
IMPLICIT NONE
NOTE: To receive warnings when variables are used but not
declared, you can specify the /WARNINGS=DECLARATIONS compiler
option instead of IMPLICIT NONE.
INCLUDE
Directs the compiler to stop reading statements from the current
file and read the statements in the included file or module. When
it reaches the end of the included file or module, the compiler
resumes compilation with the next statement after the INCLUDE
statement. Statement format:
INCLUDE 'full-file-name[/[NO]LIST]'
INCLUDE '[text-lib] (module-name)[/[NO]LIST]'
full-file-name Is a character string that specifies the file to be included. The form of the "full-file-name" must be acceptable to the operating system, as described in your user manual.
/[NO]LIST Specifies whether the incorporated code is to appear in the compilation source listing. In the listing, a number precedes each incorporated statement. The number indicates the "include" nesting depth of the code. The default is /NOLIST. /LIST and /NOLIST must be spelled completely.
text-lib Is a character string that specifies the "full-file-name" of the text library to be searched. Its form must be acceptable to the operating system, as described in your user manual. If "text-lib" is omitted, the specified "module-name" must reside in the default Fortran text library SYS$LIBRARY:FORSYSDEF.TLB, or a user-specified default library.
module-name Is the name of the text module, located in a text library, that is to be included. The name of the module must be enclosed in parentheses. It can be up to 31 char- acters long and can contain any alpha- numeric character and the special char- acters dollar sign ($) and underscore (_).
The file or module must contain valid Fortran statements. The file or module cannot start with a continuation line, but it can contain an INCLUDE statement.
The limit on nesting depth is 10.
In the following example, the file COMMON.FOR defines a parameter constant M, and defines arrays X and Y as part of the blank common block.
Main Program File COMMON.FOR File ----------------- --------------- INCLUDE 'COMMON.FOR' PARAMETER (M=100) DIMENSION Z(M) COMMON X(M),Y(M) CALL CUBE DO 5, I=1,M
5 Z(I) = X(I)+SQRT(Y(I)) . . . END
SUBROUTINE CUBE
INCLUDE 'COMMON.FOR'
DO 10, I=1,M
10 X(I) = Y(I)**3
RETURN
END
Input_Output
Transfer I/O statements include READ, WRITE, REWRITE, ACCEPT, TYPE,
and PRINT. Auxiliary I/O statements include OPEN, CLOSE, INQUIRE,
REWIND, BACKSPACE, ENDFILE, DELETE, and UNLOCK.
Transfer I/O statements can be formatted (F), unformatted (U), list-directed (L-D), or namelist (N) as follows:
ACCEPT Sequential -- F, L-D, N DELETE Relative -- U Indexed -- U PRINT Sequential -- F, L-D, N READ Sequential -- F, U, L-D, N Direct Access -- F, U Internal -- F, L-D Indexed -- F, U REWRITE Relative -- F, U Sequential -- F Indexed -- F, U TYPE Sequential -- F, L-D, N WRITE Sequential -- F, U, L-D, N Direct Access -- F, U Internal -- F, L-D Indexed -- F, U
Additional Information on:
INQUIRE ([FILE=fi][,DEFAULTFILE=dfi...],flist) INQUIRE ([UNIT=]u,flist)
fi Is a character expression, numeric scalar memory reference, or numeric array name reference whose value specifies the name of the file to be inquired about.
dfi Is a character expression specifying a default file specification string. Parts of the file specification not specified in FILE are filled in from DEFAULTFILE. Parts of the file specification that are still missing are filled in from your default directory when the program runs.
flist Is a list of property specifiers in which any one specifier appears only once. Information about the individual specifiers is available under the subtopic headings listed at the end of this Help topic.
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. The unit does not have to exist, nor does it need to be connected to a file. If the unit is connected to a file, the inquiry encompasses both the connection and the file.
FILE=fi and UNIT=u can appear anywhere in the property-specifier list; however, if the UNIT keyword is omitted, the unit specifier ("u") must be the first parameter in the list.
When inquiring by file, you can specify DEFAULTFILE=dfi in addition to, or in place of, FILE=fi. If a file is open with both FILE and DEFAULTFILE keywords specified in the OPEN statement, then you can inquire about this file by specifying both the FILE and DEFAULTFILE keywords in the INQUIRE statement.
An INQUIRE statement can be executed before, during, or after the connection of a file to a unit. The values assigned by the statement are those that are current when the INQUIRE statement executes.
You can use INQUIRE to get file characteristics before opening a file. (File characteristics are stored in the file header.)
Additional Information on:
INTRINSIC v[,v]...
v Is the symbolic name of an intrinsic subprogram.
Subprogram names passed as actual arguments must be identified in
INTRINSIC statements. Names of subprograms used as the objects of
CALL statements or function references do not need to be identified
with INTRINSIC statements; these names are recognized as intrinsic
implicitly.
MAP
See STRUCTURE (subheads Unions and Type_declarations).
NAMELIST
Defines a list of variables or array names and associates that list
with a unique group-name, which is used in the namelist I/O
statement.
NAMELIST/grp/nlist[[,]/grp/nlist]...
group-name Is a symbolic name.
nlist Is the list of (no more than 250) variable or array names, separated by commas, to be associated with the preceding group-name.
You cannot include array elements, character substrings, records, and record fields in a namelist, but you can use namelist I/O to assign values to elements of arrays or substrings of character variables that appear in namelists. Dummy arguments can appear in a namelist.
The namelist entities can have any data type and can be explicitly or implicitly typed.
Only the entities specified in the namelist can be read or written in namelist I/O. It is not necessary for the input records in a namelist input statement to define every entity in the associated namelist.
The order of entities in the namelist controls the order in which the values are written in the namelist output. Input of namelist values can be in any order.
A variable or an array name can appear in several namelists.
OPEN
Opens an existing file or creates a new file. If you do not
explicitly open a file before accessing it, the file is created
(for write operations) or opened with default attributes.
OPEN (par[,par]...)
par Is a keyword specification in one of the following forms:
keywd keywd=value
keywd Is a keyword. (See the subtopic headings listed at the end of this Help topic.) value Is a keyword value. (Some keywords do not have keyword values.)
If an OPEN statement is executed for a unit that is already open, and the file specification is different from that of the current open file, the previously opened file is closed and the new file is opened. If the file specification is the same for both files, the new value of the BLANK= specifier is in effect, but the position of the file is unaffected.
Keyword specifications can appear in any order. In most cases, they are optional. Default values apply in their absence. If the logical unit specifier is the first parameter in the list, the UNIT keyword is optional.
You can specify character values at run time by substituting a general character expression for a keyword value in the OPEN statement. The character value can contain trailing spaces but not leading or embedded spaces; for example:
CHARACTER*6 FINAL /' '/ . . . IF (exp) FINAL = 'DELETE' OPEN (UNIT=1, STATUS='NEW', DISP=FINAL)
NOTE: Keyword values that are numeric expressions can be any integer or real expression. The value of the expression is converted to integer data type before it is used in the OPEN statement.
Additional Information on:
OPTIONS option [option...]
option Is one of the following:
/ASSUME=(ALL, [NO]ACCURACY_SENSITIVE, [NO]DUMMY_ALIASES, NONE) /NOASSUME
/BLAS=(ALL, [NO]INLINE, [NO]MAPPED, NONE) /NOBLAS
/CHECK=(ALL, [NO]ALIGNMENT, [NO]ASSERTIONS, [NO]BOUNDS, [NO]OVERFLOW, [NO]UNDERFLOW, NONE) /NOCHECK
/CONVERT=(BIG_ENDIAN, CRAY, IBM, LITTLE_ENDIAN, NATIVE, VAXD, VAXG)
/[NO]EXTEND_SOURCE /[NO]F77 /[NO]G_FLOATING /[NO]I4 /[NO]RECURSIVE
You must place a slash (/) before the option.
The OPTIONS statement must be the first statement in a program unit, preceding the PROGRAM, SUBROUTINE, FUNCTION, and BLOCK DATA statements.
OPTIONS statement options have the same syntax and abbreviations as their similarly-named OpenVMS compiler options.
OPTIONS statement options override compiler options, but only until
the end of the program unit in which they are defined. Thus, an
OPTIONS statement must appear in each program unit in which you
wish to override the compiler options.
PARAMETER
Associates a symbolic name with a constant value. Statement
format:
1. PARAMETER (p=c [,p=c]...)
p Is a symbolic name.
c Is a constant, a compile-time expression, or the symbolic name of a constant.
The following additional rules apply to symbolic names:
- If the symbolic name is used as the length specifier in a CHARACTER declaration, it must be enclosed in parentheses.
- If the symbolic name is used as a numeric item in a FORMAT edit description, it must be enclosed in angle brackets.
- The symbolic name of a constant cannot appear as part of another constant, although it can appear as either the real or imaginary part of a complex constant.
- A symbolic name can be defined only once within the same program unit.
- You can only use a symbolic name defined to be a constant within the program unit containing the defining PARAMETER statement.
The data type of a symbolic name associated with a constant is determined as follows:
- By an explicit type declaration statement preceding the defining PARAMETER statement
- By the same rules for implicit declarations that determine the data type of any other symbolic name
For example, the following PARAMETER statement is interpreted as MU=1 (MU has an integer data type by implication):
PARAMETER (MU=1.23)
If the PARAMETER statement is preceded by an appropriate type declaration or IMPLICIT statement, it could be interpreted as MU=1.23; for example:
REAL*8 MU PARAMETER (MU=1.23)
Once a symbolic name is associated with a constant, it can appear anywhere in a program that any other constant can appear --- except in FORMAT statements (where constants can only be used in variable format expressions) and as the character count for Hollerith constants. For compilation purposes, writing the name is the same as writing the value.
A compile-time expression can contain the following intrinsic subprograms as long as the operands are constants: ABS, CHAR, CMPLX, CONJG, DIM, DPROD, IAND, ICHAR, IEOR, IMAG, IOR, ISHFT, LGE, LGT, LLE, LLT, MIN, MAX, MOD, NINT, and NOT.
2. PARAMETER p=c [,p=c]...
p Is a symbolic name.
c Is a constant, the symbolic name of a constant, or a compile-time constant expression.
This statement is similar to the one described above; they both
assign a symbolic name to a constant. However, this PARAMETER
statement differs from the other one in the following two ways:
its list is not bounded with parentheses; and the form of the
constant, rather than implicit or explicit typing of the symbolic
name, determines the data type of the variable.
PAUSE
The PAUSE statement displays a message on the terminal and
temporarily suspends program execution, so that you can take some
action. Statement format:
PAUSE [disp]
disp Is an optional character constant or a string of up to six digits. (FORTRAN-77 limits digits to five.)
If you do not specify a value for "disp", the system displays the following default message:
FORTRAN PAUSE
The system then displays the system prompt.
If you specify a value for "disp", this value is displayed instead of the default message.
EFFECT OF PAUSE IN INTERACTIVE MODE:
In interactive mode, the program is suspended until you enter one of the following commands:
o CONTINUE - to resume execution at the next executable statement.
o DEBUG - to resume execution under control of the OpenVMS Debugger.
o EXIT - to terminate execution.
Note that any command, other than CONTINUE or DEBUG, terminates execution.
EFFECT OF PAUSE IN BATCH PROCESS MODE:
If a program is a batch process, the program is not suspended. If
you specify a value for "disp", this value is written to the system
output file.
PRINT
Transfers data from internal storage to FOR$PRINT (normally, the
terminal in interactive mode or the batch log in batch mode). The
access mode is sequential.
Additional Information on:
POINTER ((pointer,pointee) [,(pointer,pointee)]...
pointer Is a variable whose value is used as the address of the pointee.
pointee Is a variable, array, array declarator, record, record array, or record array declarator.
The following are rules and behavior for the "pointer" argument:
o Two pointers can have the same value, so pointer aliasing is allowed.
o When used directly, a pointer is treated like an integer variable. On VAX systems, a pointer occupies one numeric storage unit, so it is a 32-bit quantity (INTEGER*4).
o A pointer cannot be pointed to by another pointer; therefore, a pointer cannot also be a pointee.
o A pointer cannot appear in the following statements:
ASSIGN INTRINSIC EXTERNAL PARAMETER
A pointer can appear in a DATA statement with integer literals only.
o Integers can be converted to pointers, so you can point to absolute memory locations.
o A pointer variable cannot be declared to have any other data type.
o A pointer cannot be a function return value.
o You can give values to pointers by using the %LOC built-in function to retrieve addresses. For example:
integer i(10) integer i1 (10) /10*10/ pointer (p,i) p = %loc (i1) i(2) = i(2) + 1
o The value in a pointer is used as the pointee's base address.
The following are rules and behavior for the "pointee" argument:
o A pointee is not allocated any storage. References to a pointee look to the current contents of its associated pointer to find the pointee's base address.
o A pointee array can have fixed, adjustable, or assumed dimensions.
o A pointee cannot appear in the following statements:
AUTOMATIC PARAMETER COMMON SAVE DATA STATIC EQUIVALENCE VOLATILE NAMELIST
o A pointee cannot be a dummy argument.
o A pointee cannot be a function return value.
o A pointee cannot be a record field or an array element.
PROGRAM
Begins a main program. The PROGRAM statement is optional; when
used, it can only be preceded by comment lines or an OPTIONS
statement. Statement format:
PROGRAM nam
nam Is a symbolic name for the program. The name must be unique among all global names in the program.
If no PROGRAM statement begins the program, the program name
defaults to filename$MAIN, where filename is the name of the file
containing the program.
READ
Transfers data from external or internal units to internal storage.
The meanings of the symbolic abbreviations used to represent the parameters in the READ statement syntax are as follows:
extu Is the logical unit or internal file optionally or prefaced by UNIT=. UNIT= is required if unit is intu not the first element in the clist.
fmt Specifies whether formatting is to be used for data editing, and if it is, the format specification or an asterisk (*) to indicate list-directed formatting. The "fmt" is optionally prefaced by FMT=, if "fmt" is the second parameter in the clist and the first parameter is a logical or internal unit specifier without the optional keyword UNIT=.
nml Is the namelist group specification for namelist I/O. Optionally prefaced by NML=. NML= is required if namelist is not the second I/O specifier.
rec Is the cell number of a record to be accessed directly. Optionally prefaced by REC= or by an apostrophe (').
iostat Is the name of a variable to contain the completion status of the I/O operation. Optionally prefaced by IOSTAT=.
err Is the label of a statement to which control is transferred in the event of an error. Optionally prefaced by ERR=.
end Is the label of a statement to which control is transferred in the event of an end-of-file. Optionally prefaced by END=.
iolist Are the names of the variables, arrays, array elements, or character substrings from which or to which data will be transferred. Optionally an implied-DO list.
keyspec Specifies the key of field value of a record to be accessed. Optionally prefaced by KEY=, KEYEQ=, KEYGE=, KEYGT=, KEYNXT, KEYNXTNE, KEYLT, or KEYLE.
keyid Specifies the key field index that is to be searched for the specified key field value. Optionally in- cluded with keyspec and optionally prefaced by KEYID=.
The control-list parameters are "extu" (or "intu"), "fmt", "nml", "rec", "iostat", "err", "end", "keyspec", and "keyid". The I/O list parameter is "iolist".
Additional Information on:
RECORD /str/rnlist[,/str/rnlist...]
str Is the name of a previously declared structure.
rnlist Is a list of one or more variable names, array names, or array declarators, separated by commas. All the records named in this list have the same structure and are allocated separately in memory.
Record variables can be used in COMMON and DIMENSION statements,
but not in DATA or EQUIVALENCE statements.
RETURN
Transfers control from a subprogram to the calling program. You
can only use RETURN in a subprogram unit. Statement format:
RETURN [i]
i Is an optional integer constant or expression (such as 2 or I+J) indicating the position of an alternate return from the subprogram in the actual argument list. The "i" is converted to an integer value if necessary.
The argument "i" is valid only for subroutine subprograms. If no alternate return is specified or the specified alternate return does not exist in the actual argument list, control returns to the statement following the CALL statement.
If the subprogram is a function, control returns to the statement
containing the function reference. If the subprogram is a
subroutine, control returns either to the statement following the
CALL statement, or to the label specified by the alternate return
argument.
REWIND
Repositions a sequential file currently open for sequential or
append access to the beginning of the file. Do not use a REWIND
statement for a file that is open for indexed or direct access.
Allowed only for files on disk or magnetic tape. Statement format:
REWIND ([UNIT=]u[,ERR=s][,IOSTAT=ios]) REWIND u
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
s Is the label of a statement to which control is transferred if an error occurs, prefaced by ERR=.
ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT=.
See also BACKSPACE.
REWRITE
Transfers data from internal storage and writes the data
(translated if formatted; untranslated if unformatted) to the
current record in the following types of files: an indexed,
sequential (only if the current record and new record are the same
length), or relative file.
The current record is the last record accessed by a preceding, successful direct access, indexed, or sequential READ statement.
Formatted REWRITE statement format:
REWRITE ([UNIT=]u,[FMT=]f[,ERR=s][,IOSTAT=ios])[iolist]
Translates the data from binary to character format as specified by FMT.
Unformatted REWRITE statement format:
REWRITE ([UNIT=]u[,ERR=s][,IOSTAT=ios])[iolist]
Does not translate the binary data.
Arguments:
u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
f Is a format specifier.
s Is the label of a statement to which control is transferred if an error condition occurs, prefaced by ERR=.
ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT=.
iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. --------------------------------------------------------------
Formatted REWRITE Statement Behavior and Errors:
The formatted REWRITE statement performs the following operations:
o It retrieves binary values from internal storage.
o It translates those values to character form as specified by FORMAT.
o It writes the translated data to a current (existing) record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.)
The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement.
Errors occur under the following conditions:
o If you attempt to rewrite more than one record in a single REWRITE statement operation
o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with spaces.)
o If the primary key value is changed
In the following example, the REWRITE statement updates the current record contained in the relative organization file connected to logical unit 3 with the values represented by NAME, AGE, and BIRTH.
REWRITE (3,10,ERR=99) NAME, AGE, BIRTH 10 FORMAT (A16,I2,A8)
-------------------------------------------------------
Unformatted REWRITE Statement Behavior and Errors:
The formatted REWRITE statement performs the following operations:
o It retrieves binary values from internal storage.
o It writes the untranslated data to a current (existing) existing record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.)
The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement.
Errors occur under the following conditions:
o If you attempt to rewrite more than one record in a single REWRITE statement operation
o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with zeros.)
o If the primary key value is changed
SAVE
Declares that the values of data elements are to be saved across
invocations of a subprogram. Statement format:
SAVE [a[,a]...]
a Is the symbolic name of a common block (enclosed in slashes), a variable, or an array.
A SAVE statement cannot include a blank common block, names of entities in a common block, procedure names, and names of dummy arguments.
Within a program unit, an entity listed in a SAVE statement does not become undefined upon execution of a RETURN or END statement within that program unit.
Even though a common block can be included in a SAVE statement, individual entities within the common block could become undefined (or redefined) in another program unit.
When a SAVE statement does not explicitly contain a list, it is treated as though all allowable items in the program unit are specified on the list.
NOTE: It is not necessary to use SAVE statements in DEC Fortran programs. The definitions of data entities are retained automatically by default, unless you specify the /RECURSIVE compiler option. (Optimizations can also affect this. See your user manual for more information.) However, the ANSI FORTRAN Standard requires using SAVE statements for programs that depend on such retention for their correct operation. If you want your programs to be portable, you should include SAVE statements where your programs require them.
The omission of such SAVE statements in necessary instances is not
flagged, even when you specify the /STANDARD=(SEMANTIC,SYNTAX)
compiler option, because the compiler does not determine whether
such dependences exist.
Statement_Function
Defines a function consisting of a single expression. The function
must be invoked from the program unit in which it is defined.
Format:
fun([p [,p]...])=e
fun Is the symbolic name for the function. You can establish its type explicitly or implicitly. The value of the expression is returned to the function name when the function is invoked.
p Is an unsubscripted variable name specifying a dummy argument. The arguments must agree in order, number, and type with the actual arguments of the statement invoking the function.
e Is an arithmetic, logical, or character expression. If the expression contains a reference to another statement function, the referenced statement function must precede the statement function containing the reference.
If you use the name of a dummy argument outside the function statement, the name defines another separate data entity.
Declarator information does not apply to a dummy argument except for type. For example, you cannot define a dummy argument as an array or as part of a common block.
If you use the name of a dummy argument outside the function
statement, the name defines another separate data entity.
STOP
Terminates program execution and writes a message to SYS$OUTPUT.
Statement format:
STOP [disp]
disp Is a character constant or a string of up to six digits. (FORTRAN-77 limits digits to five.)
If you specify the optional argument "disp", the STOP statement displays the contents of "disp" at your terminal, terminates program execution, and returns control to the operating system.
If you do not specify a value for "disp", the character constant
FORTRAN STOP is displayed.
STRUCTURE
Indicates the beginning of the record structure declaration and
defines the name of the structure. Declaration format:
STRUCTURE [/str/][fnlist] fdcl [fdcl] ... [fdcl] END STRUCTURE
str Identifies a structure name, which is used in following RECORD statements to refer to the structure. A structure name is enclosed in slashes.
fnlist Identifies field names when used in a substructure declaration.(Only allowed in nested structure declarations.)
fdcl (Also called the declaration body.) Is any declaration or combination of declarations of substructures, unions, or typed data, or PARAMETER statements.
Following RECORD statements use the structure name to refer to the structure. A structure name must be unique among structure names, but structures can share names with variables (scalar or array), record fields, PARAMETER constants, and common blocks.
Structure declarations can be nested (contain one or more other structure declarations). A structure name is required for the structured declaration at the outermost level of nesting, and optional for the other declarations nested in it. However, if you wish to reference a nested structure in a RECORD statement in your program, it must have a name.
Structure, field, and record names are all local to the defining program unit. When records are passed as arguments, the fields must match in type, order, and dimension.
Unlike type declaration statements, structure declarations do not create variables. Structured variables (records) are created when you use a RECORD statement containing the name of a previously declared structure. The RECORD statement can be considered as a kind of type statement. The difference is that aggregate items, not single items, are being defined.
Within a structure declaration, the ordering of both the statements and the field names within the statements is important because this ordering determines the order of the fields in records.
In a structure declaration, each field offset is the sum of the lengths of the previous fields. The length of the structure, therefore, is the sum of the lengths of its fields. The structure is packed; you must explicitly provide any alignment that is needed by including, for example, unnamed fields of the appropriate length.
In the following example, the declaration defines a structure named DATE. This structure contains three scalar fields: DAY (LOGICAL*1), MONTH (LOGICAL*1), and YEAR (INTEGER*2).
STRUCTURE /DATE/ LOGICAL*1 DAY, MONTH INTEGER*2 YEAR END STRUCTURE
Additional Information on:
SUBROUTINE nam[([p[,p]...])]
nam Is a symbolic name for the subroutine. The name must be unique among all global names in the program.
p Is an unsubscripted variable name specifying a dummy argument. An asterisk (*) as a dummy argument specifies that the actual argument is an alternate return argument.
The arguments must agree in order, number, and type with the actual arguments of the statement invoking the subroutine. A dummy argument must not be defined as an array with more elements than the actual argument holds. When control transfers to the subroutine, the values of any actual arguments in the CALL statement are associated with any corresponding dummy arguments in the SUBROUTINE statement. The statements in the subprogram are then executed.
The SUBROUTINE statement must be the first statement of a subroutine, unless an OPTIONS statement is specified.
A subroutine subprogram cannot contain a FUNCTION statement, a BLOCK DATA statement, a PROGRAM statement, or another SUBROUTINE statement.
ENTRY statements are allowed to specify multiple entry points in the subroutine.
The array declarator for a dummy argument can itself contain integer values that are dummy arguments or are references to a common block, providing for adjustable size arrays in subroutines. The upper bound of the array declarator for a dummy argument can be specified as an asterisk, in which case the upper bound of the dummy argument assumes the size of the upper bound of the actual argument. The size in a character string declarator for a dummy argument can be specified as an asterisk in parentheses, in which case the size of the actual argument is passed to the dummy argument.
The values of the actual arguments in the invoking program unit become the values of the dummy arguments in the function. If you modify a dummy argument, the corresponding actual argument in the invoking program unit is also modified; the actual argument must be a variable if it is to be modified.
If the actual argument is a character constant, the dummy argument
can be either character or numeric in type, unless the name of the
subprogram being invoked is a dummy argument in the invoking
program unit. If the actual argument is a Hollerith constant, the
dummy argument must be numeric.
TYPE
Transfers data from internal storage to FOR$TYPE (normally the
terminal). The access mode is sequential.
Additional Information on:
Type declarations must precede all executable statements, can be declared only once, and cannot be used to change the type of a symbolic name that has already been implicitly assumed to be another type.
Type declaration statements can initialize data in the same way as the DATA statement: by having values, bounded by slashes, listed immediately after the symbolic name of the entity.
Additional Information on:
UNLOCK ([UNIT=]u[,ERR=s][,IOSTAT=ios]) UNLOCK u
u An integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier.
s The label of a statement to which control is transferred if an error condition occurs.
ios An integer scalar memory reference that is
defined as a positive integer if an error occurs
and zero if no error occurs.
VOLATILE
Prevents specified variables, arrays, and common blocks from being
optimized during compilation. Statement format:
VOLATILE nlist
nlist Is a list of one or more names of variables, arrays, or common blocks (enclosed in slashes), separated by commas.
Variables that have been equivalenced (either directly or indirectly) are considered volatile if one element in the EQUIVALENCE group is declared volatile.
If array names or common block names are used, the entire array or
common block becomes volatile.
WRITE
Transfers data from internal storage to external or internal units.
The meanings of the symbolic abbreviations used to represent the parameters in the WRITE statement syntax are as follows:
extu Is the logical unit or internal file optionally or prefaced by UNIT=. UNIT= is required if unit is intu not the first element in the clist.
fmt Specifies whether formatting is to be used for data editing, and if it is, the format specification or an asterisk (*) to indicate list-directed formatting. The "fmt" is optionally prefaced by FMT=, if "fmt" is the second parameter in the clist and the first parameter is a logical or internal unit specifier without the optional keyword UNIT=.
nml Is the namelist group specification for namelist I/O. Optionally prefaced by NML=. NML= is required if namelist is not the second I/O specifier.
rec Is the cell number of a record to be accessed directly. Optionally prefaced by REC= or by an apostrophe (').
iostat Is the name of a variable to contain the completion status of the I/O operation. Prefaced by IOSTAT=.
err Is the label of a statement to which control is transferred in the event of an error. Prefaced by ERR=.
end Is the label of a statement to which control is transferred in the event of an end of file. Prefaced by END=.
iolist Are the names of the variables, arrays, array elements, or character substrings from which or to which data will be transferred. Optionally an implied-DO list. .b The control-list parameters are "extu" (or "intu"), "fmt", "nml", "rec", "iostat", "err", and "end". The I/O list parameter is "iolist".
Additional Information on: