You are on page 1of 418

unisys

ClearPath Enterprise Servers

FORTRAN77
Programming Reference Manual
ClearPath MCP 13.1

April 2011 3957 6053003


NO WARRANTIES OF ANY NATURE ARE EXTENDED BY THIS DOCUMENT. Any product or related information
described herein is only furnished pursuant and subject to the terms and conditions of a duly executed agreement to
purchase or lease equipment or to license software. The only warranties made by Unisys, if any, with respect to the
products described in this document are set forth in such agreement. Unisys cannot accept any financial or other
responsibility that may be the result of your use of the information in this document or software material, including
direct, special, or consequential damages.

You should be very careful to ensure that the use of this information and/or software material complies with the
laws, rules, and regulations of the jurisdictions with respect to which it is used.

The information contained herein is subject to change without notice. Revisions may be issued to advise of such
changes and/or additions.

Notice to U.S. Government End Users: This is commercial computer software or hardware documentation developed
at private expense. Use, reproduction, or disclosure by the Government is subject to the terms of Unisys standard
commercial license for the products, and where applicable, the restricted/limited rights provisions of the contract
data rights clauses.

Unisys and ClearPath are registered trademarks of Unisys Corporation in the United States and other countries.
All other brands and products referenced in this document are acknowledged to be the trademarks or registered
trademarks of their respective holders.
Contents
Section 1. FORTRAN77 Terms and Concepts

Purpose .................................................................................................................11
Scope .....................................................................................................................11
Audience ...............................................................................................................11
Prerequisites .......................................................................................................11
How to Use This Reference Manual .............................................................11
Documentation Updates ................................................................................. 12
Whats New? ...................................................................................................... 12
Syntactic Items .................................................................................................. 12
FORTRAN77 Character Set ............................................................................. 13
Basic Terms and Concepts ............................................................................. 14
Statements ..................................................................................... 14
Order of Statements .................................................................... 15

Section 2. Constants, Variables, Arrays, and Substrings

Constants ............................................................................................................ 21
Integer Constants.......................................................................... 22
Real Constants ............................................................................... 22
Double Precision Constants ...................................................... 24
Complex Constants ......................................................................25
Logical Constants ..........................................................................26
Character Constants .....................................................................26
Hollerith Constants ....................................................................... 27
Hexadecimal Constants ...............................................................28
Variables ............................................................................................................ 211
Arrays ................................................................................................................. 212
Array Declarers ............................................................................ 213
Substrings ......................................................................................................... 215

Section 3. Expressions

Operators ............................................................................................................ 31
Arithmetic Expressions .................................................................................. 33
Character Expressions .................................................................................... 34
Relational Expressions .................................................................................... 36
Logical Expressions ......................................................................................... 36

Section 4. Specification Statements

DIMENSION Statement ................................................................................... 41

3957 6053003 iii


Contents

EQUIVALENCE Statement .............................................................................. 42


COMMON Statement ...................................................................................... 44
TYPE Statement ................................................................................................ 45
Initial Value Lists ........................................................................... 47
IMPLICIT Statement ......................................................................................... 48
PARAMETER Statement ................................................................................. 49
EXTERNAL Statement ....................................................................................410
INTRINSIC Statement .....................................................................................410
SAVE Statement .............................................................................................. 411

Section 5. DATA Statement

Implied-DO in a DATA Statement .................................................................55

Section 6. Assignment Statements

Arithmetic Assignment Statement ............................................................... 61


Logical Assignment Statement .....................................................................62
Statement Label Assignment-ASSIGN Statement .................................. 63
Character Assignment .................................................................................... 63

Section 7. Control Statements

GO TO Statements ........................................................................................... 71
Unconditional GO TO .................................................................... 71
Assigned GO TO ............................................................................ 72
Computed GO TO .......................................................................... 72
IF Statements .....................................................................................................73
Arithmetic IF ...................................................................................73
Logical IF ..........................................................................................73
Block IF, ELSE IF, ELSE, END IF Statements .......................... 74
Block IF .................................................................................. 74
ELSE IF Statement ...............................................................75
ELSE Statement ...................................................................76
END IF Statement ................................................................76
DO Statement .................................................................................................... 77
CONTINUE Statement .................................................................................... 710
PAUSE Statement ........................................................................................... 710
STOP Statement .............................................................................................. 711
END Statement ................................................................................................ 712

Section 8. Input/Output Statements

Files .......................................................................................................................82
Units ..................................................................................................................... 83
Data Transfer Input/Output Statements .................................................... 84
Control Information List .............................................................. 84
Unit Specifier ....................................................................... 85
Format Specifier ................................................................. 86
Record Specifier ................................................................. 86

iv 3957 6053003
Contents

Input/Output Status Specifier ..........................................87


Error Specifier ..................................................................... 89
End-Of-File Specifier .......................................................... 89
Subfile Specifier .................................................................810
Urgent Specifier.................................................................810
Input/Output List ......................................................................... 811
I/O Implied-DO List ........................................................... 811
READ, WRITE, PRINT, and PUNCH Statements .................. 812
Auxiliary Input/Output Statements............................................................. 815
OPEN Statement ......................................................................... 815
CLOSE Statement ........................................................................819
CHANGE Statement .................................................................... 821
INQUIRE Statement ................................................................... 822
BACKSPACE Statement ............................................................ 826
ENDFILE Statement ................................................................... 827
REWIND Statement ................................................................... 828
FIND Statement .......................................................................... 829
FILE Statement ............................................................................ 829

Section 9. Format Specifications

FORMAT Statement ......................................................................................... 91


Carriage Control .................................................................................................92
Edit Descriptors ................................................................................................ 93
Apostrophe and Quote Editing ................................................. 94
H Editing.......................................................................................... 94
Positional Editing .......................................................................... 95
T, TL, and TR Editing .......................................................... 95
X Editing ................................................................................ 96
Slash Editing................................................................................... 96
Colon Editing .................................................................................. 96
S, SP, and SS Editing .....................................................................97
P Editing ...........................................................................................97
BN and BZ Editing......................................................................... 98
Numeric Editing ............................................................................ 99
I Editing ................................................................................. 99
J Editing................................................................................ 910
F Editing ............................................................................... 911
E and D Editing ................................................................... 912
G Editing ...............................................................................914
O Editing ........................................................................................ 915
L Editing ......................................................................................... 916
A Editing ......................................................................................... 917
Z Editing .........................................................................................919
K Editing ........................................................................................ 920
$ Editing ........................................................................................ 920
Format Specifications in Arrays and Character Entities ........................ 921
List-Directed Format....................................................................................... 921

3957 6053003 v
Contents

Section 10. Namelist Formatting

Namelist Input .................................................................................................. 102


Namelist Output .............................................................................................. 103

Section 11. Main Program

PROGRAM Statement ..................................................................................... 111

Section 12. Functions and Subroutines

Functions ........................................................................................................... 121


Intrinsic Functions ....................................................................... 122
Statement Functions ................................................................1220
Assignable Functions ............................................................... 1221
Assignable Intrinsic Functions ..................................... 1221
Assignable Statement Functions ................................ 1222
Defined Statement Functions ................................................1223
External Functions.....................................................................1224
Subroutines ..................................................................................................... 1227
SUBROUTINE Statement .........................................................1228
Intrinsic Subroutines .................................................................1229
CALL Statement........................................................................ 1240
ENTRY Statement ..................................................................... 1241
RETURN Statement ................................................................. 1243
Alternate Return ............................................................. 1243
Arguments and Common Blocks ............................................................. 1245

Section 13. Block Data Subprogram

Section 14. Debugging Aids

DEBUG DUMP Statement ............................................................................. 142


DEBUG PROGRAMDUMP Statement ........................................................143
DEBUG MONITOR Statement ......................................................................145
DEBUG <statement> Statement ................................................................. 147
DEBUG START Statement.............................................................................148
DEBUG STOP Statement ...............................................................................148

Section 15. Storage Allocation

Variable............................................................................................................... 152
Integer Variables .......................................................................... 152
Real Variables ............................................................................... 153
Double Precision Variables ....................................................... 153
Complex Variables ...................................................................... 155
Logical Variables .......................................................................... 155
Character Variables ..................................................................... 156
Arrays ................................................................................................................. 156

vi 3957 6053003
Contents

Equivalent Data Items ................................................................ 158


Single Storage Locations ................................................. 158
Multiple Storage Locations ............................................. 159
Array Handling .................................................................... 159
Elements in Common Storage ....................................................................1511

Section 16. Compiler Information

Compiler Files ................................................................................................... 161


Input Files ...................................................................................... 161
Output Files .................................................................................. 162
Compiler File Table.......................................................................................... 163
Input Decks ....................................................................................................... 167
Compile for Syntax .........................................................................................168
Compile for Library .........................................................................................168
Compile and Go ...............................................................................................168
Compile for Library and Go ........................................................................... 169
Compilations Using TASKSTRING ........................................... 169
Compilations Through CANDE ..................................................................... 169
Compiler Generation Option .................................................. 1610
NOAUTOBIND (Reset).................................................... 1610

Section 17. Compiler Control Options

A_SERIES (Set) ................................................................................................. 177


ANSI (Reset) ..................................................................................................... 177
ASCII (Reset) ..................................................................................................... 177
AUTOBIND (Reset) .......................................................................................... 177
BINDER (No Associated States) .................................................................. 179
BINDINFO (Reset) ............................................................................................ 179
CALLBYREFERENCE (Reset) ....................................................................... 1710
CHECK (Reset) .................................................................................................1711
CHECKSUBSTRINGS (Reset) .......................................................................1711
CLEAR (No Associated States) ...................................................................1711
CODE (Reset) ...................................................................................................1711
CODEFILEINIT (Reset)................................................................................... 1712
CONVERT (Reset) .......................................................................................... 1712
DO Loops..................................................................................... 1713
DATA and TYPE ......................................................................... 1713
Conversion Restrictions .......................................................... 1713
COPYBEGIN and COPYEND (No Associated States) ............................ 1714
DBLTOSNGL (Reset) ..................................................................................... 1714
DEBUG (Reset) ............................................................................................... 1714
DEFINEDSTMTFUN (Reset) ......................................................................... 1714
DELETE (Reset) .............................................................................................. 1715
DOUBLE (Reset)............................................................................................. 1715
DOUBLEARRAYS (Reset) ............................................................................ 1715
Libraries and DOUBLEARRAYS ............................................. 1715
DOUBLEARRAYS Ignored ....................................................... 1715
END (No Associated States) ....................................................................... 1718

3957 6053003 vii


Contents

ERRORLIMIT (200 For Non-CANDE Compilations, 10 For


CANDE Compilations) .............................................................................. 1718
ERRORLIST (Reset For Non-CANDE Compilations, Set For
CANDE Compilations) .............................................................................. 1719
EXPRESSIONTOARRAY (Reset) ................................................................. 1719
Use with Libraries ..................................................................... 1719
Use with BINDER.......................................................................1720
Use with DOUBLEARRAYS .....................................................1720
Use with HOLLERITHTOCHARACTER ..................................1720
Miscellaneous Notes ................................................................ 1722
FREE (Reset For Non-CANDE Compilations, Set For CANDE
Compilations) .............................................................................................1723
FREENEW (Reset) ..........................................................................................1723
FREESOURCE (Reset) ...................................................................................1723
FREEZEANDGO (Reset) ................................................................................1724
FULLSEPCOMP (Reset) ................................................................................1724
HEAP (Reset) ..................................................................................................1724
HOLLERITHTOCHARACTER (Reset) .........................................................1725
IDLEN (31) ........................................................................................................1726
IMPLICITNONE (Reset) .................................................................................1726
INCLNEW (Reset) .......................................................................................... 1727
INCLUDE (No Associated States) .............................................................. 1727
IVDEP (Reset) .................................................................................................1729
LIBRARY (Reset) ............................................................................................1729
LINEINFO (Reset For Non-CANDE Compilations, Set For
CANDE Compilations) ..............................................................................1729
LIST (Set For Non-CANDE Compilations, Reset For CANDE
Compilations) ............................................................................................ 1730
LISTDOLLAR (Reset) .................................................................................... 1730
LISTINCL (Set) ................................................................................................. 1731
LISTINITIALCCI (Reset) ................................................................................. 1731
LONG (Reset) .................................................................................................. 1731
LONGLIMIT (4096) ......................................................................................... 1731
MAKEHOST (Reset) ......................................................................................1732
MAP (Reset) ....................................................................................................1732
MERGE (Reset) ...............................................................................................1732
NEW (Reset) ...................................................................................................1733
NEWSEQERR (Reset) ...................................................................................1733
OMIT (Reset) ..................................................................................................1733
OMITDEBUG (Reset) ....................................................................................1733
ONLYANSIINTRINSICS (Reset).................................................................. 1734
OPTIMIZE (Reset) ..........................................................................................1735
OS_ 1100 (Reset) ........................................................................................... 1738
OWN (Reset) ................................................................................................. 1738
OWNARRAYS (Reset) ................................................................................. 1738
PAGE (No Associated States) ................................................................... 1738
SEPARATE (Reset) ....................................................................................... 1739
SEPCOMP (Reset) ........................................................................................ 1740
MAKEHOST ................................................................................ 1740
SEPCOMP ................................................................................... 1740
FULLSEPCOMP ........................................................................... 1741
User Interface ............................................................................ 1741

viii 3957 6053003


Contents

Compiler Files ............................................................................. 1741


CARD .................................................................................. 1741
SOURCE .............................................................................1742
HOST...................................................................................1742
NEWSOURCE....................................................................1742
NEWXREFFILE ..................................................................1742
XREFFILE ............................................................................1742
Sepcomping Examples ............................................................1742
Other Features of Separate Compilation ........................... 1747
Delays in Error Reporting ....................................................... 1750
Sample Compiles....................................................................... 1751
SEQ (Reset) ..................................................................................................... 1751
SEQERR (Reset) .............................................................................................1752
SHARING (DONTCARE) ................................................................................1752
STATISTICS (Reset) .......................................................................................1753
STRINGS = ASCII (Reset) ............................................................................ 1754
SUMMARY (Reset) ...................................................................................... 1754
TADS (Reset) ..................................................................................................1755
TARGET (Default is installation defined) ..................................................1755
TRACE (Reset) ............................................................................................... 1758
User Options (Reset) ................................................................................... 1760
V_GLOBALTEMPS (Set)............................................................................... 1760
V_REPORT ...................................................................................................... 1760
VARIABLETOARRAY (Reset) ..................................................................... 1760
VOID (Reset) ................................................................................................... 1761
WARNFATAL (Reset).................................................................................... 1761
WARNSUPR (Reset) ..................................................................................... 1761
XREF (Reset) ................................................................................................... 1761
XREFFILES (Reset) ......................................................................................... 1761

Section 18. Libraries

BLOCK GLOBALS Subprogram .................................................................... 181


Creating Libraries ............................................................................................ 181
EXPORT Statement ..................................................................... 182
CALL FREEZE Statement ........................................................... 182
SHARING Option ......................................................................... 183
Referencing Libraries .....................................................................................184
Library Attributes ........................................................................184
Library Access: 'BYTITLE', 'BYFUNCTION',
and 'BYINITIATOR' ....................................................... 185
IN LIBRARY Statement .............................................................. 187
IMPORT Statement .....................................................................188
IMPORTed versus IN LIBRARY Subprograms .....................189
FORTRAN77 to ALGOL Mapping ............................................................... 1813

Section 19. Vectorization

Vectorizing Statements ................................................................................. 191


Criteria for Loop Vectorization ................................................. 191
Criteria for Vectorization of Loop Statements .................... 192

3957 6053003 ix
Contents

Dependence Theory ................................................................... 193


Definition of Dependence ......................................................... 193
Data Dependence ............................................................. 193
Control Dependence ........................................................194
Dependence and the Vectorizer..............................................194
Rewriting Loops for Vectorization .............................................................. 197
Breaking an Antidependence ................................................... 197
Separating Vectorizable Statements from Unvectorizable
Statements ................................................................................................ 1910
Subscript Expressions and the Vectorizer ............................................. 1910
Unknown Array Value .............................................................. 1911
Equivalenced Array ................................................................... 1911
Array Reference as a Subscript............................................. 1912
Increment of Zero ..................................................................... 1912
Variable Number of Iterations ................................................ 1913
Special Vectorization Cases ....................................................................... 1913
Sum Reductions ........................................................................ 1913
Minimum, Maximum, and Maximum Absolute
Value Reductions.................................................................. 1914
Using Compiler Control Options to Influence Vectorization .............. 1914
Enable Vectorization ................................................................. 1915
Ignore Potential Aliases ........................................................... 1915
Vector Temporaries .................................................................. 1915
Ignoring Dependencies ............................................................ 1916
Improving Program Performance ............................................................. 1917
Scalar Variables That Are Used Before Defined ............... 1917
Avoid Short Loops .................................................................... 1917
Use Single Precision Variables ............................................... 1918
Order Loops for Optimal Performance ............................... 1918
Vectorization Results in Program Listings .............................................. 1918
Vectorization Result Flags....................................................... 1918
Vectorization Report.................................................................1922
Basic Linear Algebra Subprograms ......................................................... 1925
SET Subroutines ....................................................................... 1925
COPY Subroutines.................................................................... 1926
SCAL Subroutines .................................................................... 1926
VCAL Subroutines .....................................................................1927
ADD Subroutines .......................................................................1927
SUB Subroutines .......................................................................1927
AXPY Subroutines .................................................................... 1928
DOT Functions .......................................................................... 1928
DSDOT Function ....................................................................... 1928
SDSDOT Function ..................................................................... 1929
SUM Functions .......................................................................... 1929
ASUM Functions ....................................................................... 1929
MIN Index Functions ............................................................... 1930
MAX Index Functions .............................................................. 1930
AMAX Index Functions ............................................................ 1931

x 3957 6053003
Contents

Appendix A. Railroad Diagrams

Railroad Components ...................................................................................... A2


<required items> .......................................................................... A2
<optional items> .......................................................................... A2
<loops> ........................................................................................... A2
<bridges> ....................................................................................... A3

Appendix B. Comparison of FORTRAN/FORTRAN77 Compilers


for Unisys A Series Systems

Source Input Format .........................................................................................B1


Lines..................................................................................................B1
Statement Ordering ......................................................................B1
New Statements .............................................................................................. B2
Block IF ... ELSE IF ... ELSE ... END IF Statements ............. B2
INTRINSIC Statement .................................................................. B2
PARAMETER Statement ............................................................. B2
PROGRAM Statement ................................................................. B2
SAVE Statement ........................................................................... B2
Format ................................................................................................................. B2
Run-time Formatting ................................................................... B2
A Editing .......................................................................................... B3
B Editing .......................................................................................... B3
Colon Editing .................................................................................. B3
G Editing .......................................................................................... B3
Integer Editing ............................................................................... B3
L Editing .......................................................................................... B3
Numeric Editing ............................................................................ B3
Positional Editing .......................................................................... B4
S Editing .......................................................................................... B4
Unavailable Edit Descriptors ..................................................... B4
Specification Statements ............................................................................... B4
DIMENSION Statement .............................................................. B4
EQUIVALENCE Statement .......................................................... B4
COMMON Statement .................................................................. B4
Type Statements .............................................................................................. B5
CHARACTER Type-statement ................................................... B5
IMPLICIT Statement ..................................................................... B5
EXTERNAL Statement ................................................................. B5
Control Statements ......................................................................................... B5
Assigned GO TO Statements .................................................... B5
DO Statement ............................................................................... B6
STOP Statement ........................................................................... B6
PAUSE Statement ........................................................................ B6
END Statement ............................................................................. B6
DATA Statement .......................................................................... B6
Subprograms ..................................................................................................... B7
Block Data ...................................................................................... B7
Entry ................................................................................................. B7
Functions ........................................................................................ B7

3957 6053003 xi
Contents

Subroutines .................................................................................... B9
Character Arguments .................................................................. B9
Input/Output ...................................................................................................... B9
Files .................................................................................................. B9
Result Clauses .............................................................................. B9
I/O Statements .............................................................................. B9
Separate Compilation .................................................................................... B10
Binding ............................................................................................................... B11
Libraries ............................................................................................................. B11
Zip ........................................................................................................................ B11
Compiler Control Statements ...................................................................... B11
Compiler Files ................................................................................................... B11
Optimization..................................................................................................... B12
Debugging Aids .............................................................................................. B12

Appendix C. Error Messages

Index ..................................................................................................... 1

xii 3957 6053003


Figures

11. Order of Statements and Comment Lines ................................................................ 16

151. Storage Allocation .......................................................................................................... 151

3957 6053003 xiii


Figures

xiv 3957 6053003


Tables

31. Logical Expressions and Values .................................................................................. 38

61. Arithmetic Conversion and Assignment of Expression Variable .........................62

81. Valid Class Values and Associated Subclasses ....................................................... 88


82. OPEN Statement Specifiers ........................................................................................816
83. CLOSE Statement Specifiers...................................................................................... 820
84. INQUIRE Statement Inquiry Specifiers .................................................................... 824
85. FILE Statement Specifiers ........................................................................................... 830

121. Intrinsic Subroutines ....................................................................................................1229

161. Compiler Files ..................................................................................................................164

181. FORTRAN77 to ALGOL Subprogram Mapping ..................................................... 1813

3957 6053003 xv
Tables

xvi 3957 6053003


Section 1
FORTRAN77 Terms and Concepts

Purpose
This document is a reference manual for the FORTRAN77 programming language used
on the ClearPath Enterprise Servers of computer systems, revised relative to release
level 4.0. It describes the Unisys ClearPath Enterprise Servers implementation of
FORTRAN77, the designation for the American National Standard Programming
Language FORTRAN, ANSI X3.9-1978. It describes both the programming language
accepted by the FORTRAN77 compiler and various options and control statements
used with this compiler.

Note: Throughout this manual, any Unisys extensions to the national standard are
shaded.

Scope
This reference manual addresses all aspects of the FORTRAN77 language, from basic
constructs (constants, variables, operators, and so forth) to the different types of
statements used to build a program. The manual also addresses the more advanced
procedures used in FORTRAN77 including the use of libraries, subprograms, and
compiler options.

Audience
This manual is intended for all levels of programmers using FORTRAN77 as their
programming language.

Prerequisites
Anyone using this manual should have some familiarity with Unisys ClearPath
Enterprise Servers and the CANDE language. A basic understanding of FORTRAN77 is
helpful, but not necessary.

How to Use This Reference Manual


This manual is intended as a reference tool; therefore, it should be used when
clarification of a programming concept is needed. For users without prior knowledge
of FORTRAN77, it would be helpful to read the first several sections of the book to
gain a solid understanding of the basics of the language.

3957 6053003 11
FORTRAN77 Terms and Concepts

Documentation Updates
This document contains all the information that was available at the time of
publication. Changes identified after release of this document are included in problem
list entry (PLE) 18778718. To obtain a copy of the PLE, contact your Unisys
representative or access the current PLE from the Unisys Product Support Web site:

http://www.support.unisys.com/all/ple/18778718

Note: If you are not logged into the Product Support site, you will be asked to do
so.

Whats New?
New or Revised Information Location

Changes to the Input/Output Statements. Section 8:


Units
BACKSPACE Statement
Changes to the default value of the LINEINFO compiler control Section 17:
option. LINEINFO (Reset For Non-CANDE
Compilations, Set For CANDE
Compilations)
Changes to the default value of the BINDINFO compiler control Section 17:
option. BINDINFO (Reset)
Deimplementation of SEPCOMP and MAKEHOST compiler Section 17:
control options. SEPCOMP (Reset)
MAKEHOST (Reset)

Syntactic Items
The basic syntactic items of the FORTRAN77 language are constants, symbolic names,
statement labels, keywords, operators, and special characters. Letters, digits, and
special characters are used to form the syntactic items.

Constants The forms of a constant are described in Section 2.


Symbolic name A symbolic name is a sequence of 1 to 31 characters, or one to the
number of characters specified within the IDLEN compiler control
option (discussed in Section 17), each of which consists of a letter,
a digit, an underscore, or the symbol "$" (the first character must
be a letter or the symbol "$"). When the symbol "$" appears in
column 1, or a blank followed by the symbol "$" appears in columns
1 and 2, the input record is treated as a compiler control image.
Therefore, a symbolic name that begins with the symbol "$" must
not start in column 1 or 2.

12 3957 6053003
FORTRAN77 Terms and Concepts

Statement label A statement label consists of one to five digits, one of which must
be nonzero. A statement label is used to identify a statement.
Keyword A keyword is a specified sequence of letters. (The keywords of the
FORTRAN77 language are described in Sections 4 through 14.)
Whether a particular sequence of characters identifies a keyword
or a symbolic name is inferred from context.

The set of special characters is described in this section. A special character may be
an operator or part of a constant or have some other special meaning. Interpretation is
inferred from context.

FORTRAN77 Character Set


The FORTRAN77 compiler accepts source input coded in EBCDIC characters. The
FORTRAN77 character set consists of 26 letters, 10 digits, and 18 special characters.

A letter is one of the following 26 characters:

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Lowercase letters may also appear in FORTRAN77 source statements. The lowercase
letters are equivalent to uppercase letters, except in character constants, Hollerith
constants, and quoted hexadecimal constants.

A digit is one of the following 10 characters:

0123456789

A special character is one of the following 18 characters.

Blank
= Equals
+ Plus
- Minus
* Asterisk
/ Slash
( Left parenthesis
) Right parenthesis
, Comma
. Decimal Point
$ Currency Symbol
' Apostrophe
: Colon
& Ampersand
% Percent Sign
" Quotation mark
_ Underscore
! Exclamation point

An alphanumeric character is a letter or a digit.

3957 6053003 13
FORTRAN77 Terms and Concepts

Basic Terms and Concepts


Every FORTRAN77 program consists of one or more program units (a main program
and optional subprograms). Each program unit is constructed of a series of
statements. These statements specify the arithmetic operations that are to be
executed, control the order in which program statements are to be performed,
accomplish various program input and output functions, describe program data items,
or provide other program information.

Statements
A statement is written on one or more lines, the first of which is called the initial line;
succeeding lines, if any, are called continuation lines. There is also a line called a
comment line, which is not part of any statement and is intended to provide
documentation.

A statement may contain a trailing comment. A "%" or a "!" indicates that the rest of
the line is a comment. An exception to this is if columns 1 through 5 are blank and line
6 contains a "!", the line is treated as a continuation line.

FORTRAN77 lines conform to the following formats, except when the compiler control
option FREE is set:

1. A comment line is any line that contains a C or an asterisk in column 1 or contains


only blank characters in columns 1 through 72. Comment lines may appear
anywhere in the program unit.
2. An initial line is not a comment line and contains a blank or the digit 0 in column 6.
Columns 1 through 5 may contain a statement label.
3. A continuation line contains any FORTRAN77 character other than a blank, a "%", or
the digit 0 in column 6 and contains only blank characters in columns 1 through 5.
A statement may not have more than 99 continuation lines.
4. Columns 73 through 80 may contain identification or sequencing information.
5. Columns 81 through 90 may contain identification information.
6. A line that contains either a "$" in column 1, a blank in column 1 and a "$" in column
2, or a $ in columns 1 and 2 is a compiler control image. (Refer to "Compiler Control
Options.")
When the compiler control option FREE is set (which is the default value for CANDE),
the following restrictions must be observed (for more information on the FREE option,
refer to Section 17):

1. Continuation card images must contain a minus sign (-) or asterisk (*) as the first
non-blank character in the first six columns.
2. Comments must have a "C" in column one and a minus sign or asterisk in column
2.
3. For statements with labels, the label must appear in the first five columns.

14 3957 6053003
FORTRAN77 Terms and Concepts

4. Each free-form statement may contain 66 characters at most, including blanks and
not including sequence numbers. Any characters beyond the 66th character, but
before column 73, are flagged with a warning and ignored.
5. Continuation card images are shifted to the right until the continuation character "*"
or "-" is in column 6. If this shift causes a card image to extend past column 72, and
if there are blanks between the continuation character and the source, the source
is shifted to the left until either the card image no longer extends past column 72
or until the source begins in column 7.
6. Columns 73 through 80 of the source card image are reserved for the sequence
numbers, as in the case of formatted source input.
7. Compiler control images must have a dollar sign ($) in column 1, a blank in column
1 with a dollar sign in column 2, or a $ in columns 1 and 2.
8. FILE statements must have the string FILEbb in columns 1-6 where b represents a
blank.
An END statement is written only in an initial line. No other statement in a program
unit may have an initial line that appears to be an END statement. Note that a
statement must not contain more than 6600 characters (excluding labels and
continuation characters). Except as part of a logical IF statement, no statement may
begin on a line that contains any part of the previous statement.

Order of Statements
The order of statements in a main program or subprogram is determined by the
following rules:

1. A PROGRAM statement may appear only as the first statement of a main


program.
2. The first statement of a subprogram must be either a FUNCTION, SUBROUTINE,
BLOCK GLOBALS, or BLOCK DATA statement.
3. FORMAT statements may appear anywhere in a program unit; however, BLOCK
GLOBALS subprograms may not contain FORMAT statements.
4. File declaration statements must precede the first FORTRAN77 statement or
appear between subprograms. File declaration statements may also be used in a
BLOCK GLOBALS subprogram before any FORTRAN77 statement.
5. All specification statements must precede all DATA statements, statement
function statements, and executable statements.
6. Within the specification statements IMPLICIT statements must precede all other
specification statements, except PARAMETER statements. Any specification
statement that specifies the type of a symbolic name of a constant must precede
the PARAMETER statement that defines the constant.
7. All statement function statements must precede all executable statements.
8. DATA statements may appear anywhere after specification statements.
9. ENTRY statements may appear anywhere, except between a BLOCK IF statement
and its corresponding END IF statement, or between a DO statement and the
terminal statement of its DO-loop.

3957 6053003 15
FORTRAN77 Terms and Concepts

10. The last line of a program unit must be an END statement. END statements may
not be continued.
11. The BLOCK GLOBALS subprogram must precede the main program, BLOCK DATA
subprograms, FUNCTION subprograms and SUBROUTINE subprograms.
Figure 1-1 is a diagram of the required order of statements and comment lines for a
program unit. Vertical lines delineate varieties of statements that may be interspersed.
For example, FORMAT statements may be interspersed with statement function
statements. Horizontal lines delineate varieties of statements that must not be
interspersed. For example, statement function statements must not be interspersed
among executable statements. Note that an END statement is also an executable
statement and must appear only as the last statement of a program unit.

Note: File statements may appear before any FORTRAN77 statement or between
subprograms. When appearing within a BLOCK GLOBALS subprogram, they must
precede all FORTRAN77 statements within the subprogram.


  
  FILE STATEMENT 
  
 
  
  PROGRAM, FUNCTION, SUBROUTINE, BLOCK GLOBALS, 
  OR BLOCK DATA STATEMENT 
  
 
    
    IMPLICIT 
    STATEMENTS 
   PARAMETER  
   STATEMENTS 
 COMMENT    
 LINES    OTHER SPECIFICATION
  FORMAT   STATEMENTS 
  AND   
  ENTRY 
  STATEMENTS   
    STATEMENT FUNCTION 
    STATEMENTS 
   DATA  
   STATEMENTS 
    
    EXECUTABLE 
    STATEMENTS 
    
   
 
 END STATEMENT 
 
!"

Figure 11. Order of Statements and Comment Lines

16 3957 6053003
Section 2
Constants, Variables, Arrays, and
Substrings

At any given time during the execution of an executable program, the definition status
of each variable, array element, or substring is either defined or undefined.

A defined entity has a value. The value of a defined entity does not change until the
entity becomes undefined or is redefined with a different value.

If a variable, array element, or substring is undefined, it does not have a predictable


value.

Constants
Constants are FORTRAN77 data items and can be of the following types:

Integer

Real

Double Precision

Complex

Logical

Character

Hollerith

Hexadecimal

By definition, the value of a constant never changes.

3957 6053003 21
Constants, Variables, Arrays, and Substrings

Integer Constants
The format for an integer constant is as follows:

 
 
 <digit> 
 
 + 
 
 - 

where the maximum absolute value allowed is 549755813887. The following are
examples of valid integer constants:

0 9999999999
+0 03770
-0 1254
17711 -5 7 (interpreted as -57)

The following are examples of invalid integer constants:

1.0 Decimal point not permitted; interpreted as a real constant


3,000 No commas or other punctuation permitted
1548009000000 Maximum value exceeded

Real Constants
The format for a real constant is as follows:

 <basic real constant> 


 
 <basic real constant>  <real exponent> 
 
 <integer constant>  <real exponent> 

<real exponent>

 E  <integer constant> 


<basic real constant>

 <integer part>  . 


   
 +   .  <fractional part> 
   
 -   <integer part>  .  <fractional part> 

<integer part> and <fractional part>

 
 
 <digit> 

22 3957 6053003
Constants, Variables, Arrays, and Substrings

The maximum absolute value of a real constant that is permitted is approximately:

4.3135914667E68 = ((8**13)-1)*08**63

The smallest nonzero absolute value permitted is approximately:

8.7581154021E-47 = 8**(-51).

Zero is also permitted.

The following are examples of valid real constants:

3.1415926535 2.5E+07 (same as 25000000)


0. 1.023342E+8
0.0 23456789012E-22
2E3 0000000000007.
2.E3 .5 3E-4 2 (interpreted as .53E-42)
2E+3 -253.
.075 -.075
6.02E23 2.9979E08

The following are examples of invalid real constants:

-1597 No decimal point or E portion; interpreted as an integer


constant
6.2E+68 Exceeds maximum size limit
6.2E-48 Smaller than minimum size limit
E22 Exponent part alone not permitted; interpreted as a variable
name
2.7E1.2 Exponent part must be an integer
1E2E3 Only one E portion allowed per constant
2,765,987. No commas or other punctuation, except decimal point,
permitted

The internal machine representation of a real constant is similar to the internal


representation of an integer constant. Thus, real and integer constants are often
interchangeable in programs; however, care should be taken when mixing such
constants in expressions because the types used in an expression affect the type of
the expression.

3957 6053003 23
Constants, Variables, Arrays, and Substrings

Double Precision Constants


The format for a double precision constant is the following:

 <basic double precision constant> 


 
 <basic double precision constant><double precision exponent> 
 
 <basic real constant>  <double precision exponent> 
 
 <integer constant>  <double precision exponent> 

<double precision exponent>

 D  <integer constant> 

A <basic double precision constant> is the same as a <basic real constant>, except
that the number of significant digits must be too large to represent in a real constant.

If the number of significant digits in a double precision constant exceeds 22,


approximately 22 significant digits are retained. The maximum absolute value of a
double precision constant that is permitted is approximately:

1.94882838205028079124469 D+29603 = ((8**26)-1)*08**32754

The smallest nonzero absolute value permitted is approximately:

1.9385458571375858335564 D-29581 = 8**(-32755)

Zero is also permitted.

The following are examples of valid double precision constants:

1234567890.1234567890123 D 29594

1 2D-2 4259 (interpreted as 12D-24259)

6.63D-034

9.80665D+0

The following three double precision constants are equivalent:

3.1415926535897932

3.1415926535897932D0

3.1415926535897932D-0

24 3957 6053003
Constants, Variables, Arrays, and Substrings

The following four double precision constants are equivalent:

1D3

+1D+003

+1.D+3

1.D0003

The following are examples of invalid double precision constants:

3.14159265 No D portion; interpreted as a real constant


2.7 D29604 Exceeds maximum size limit
2.7 D-29585 Smaller than minimum size limit
444 Interpreted as an integer constant
1.234,567,890,123. Commas not permitted
1.3E456 No D in exponent part

Complex Constants
The format for a complex constant is the following:

 (  <real constant>  ,  <real constant>  ) 
   
 <integer constant>   <integer constant> 

The complex constant (m,n) represents the quantity m+ni, where i equals the square
root of -1. The following are examples of valid complex constants with the equivalent
mathematical expressions beside them:

Complex Constant Equivalent Mathematical Expressions


(123,456) 123 + 456i
(3.14159265,1597) 3.14159265 + 1597i
(0,.05) 0 + 0.05i or 0.05i
(100.,100.00) 100 + 100i
( 1E2,0 ) 100 + 0i or 100
(0,-1) -i

3957 6053003 25
Constants, Variables, Arrays, and Substrings

The following are examples of invalid complex constants:

(3, ) Missing imaginary part


(12345.D10,0) Neither part may be a double precision constant
(12.0,72.E68) Imaginary part exceeds size limit for real constants
(3,4,5) Excessive number of parts - more than two

Logical Constants
Two logical constants are provided to represent the logical values "true" and "false".
These two logical constants have the format:

 .TRUE. 


 
 .FALSE. 

The use of these logical constants is restricted to certain types of expressions. The
internal machine representations of these two constants are such that the data words
corresponding to the constant TRUE and the integer constant 1 are identical and the
data corresponding to the constant FALSE and the integer constant 0 are identical.

Character Constants
The format for a character string is as follows:

 
 
  /255\  <EBCDIC character>  
 
   
   
 "  /255\  <EBCDIC character>  " 

The apostrophe or the quotation mark may be used as the string delimiter. If the string
delimiter is the apostrophe, then the apostrophe is interpreted as part of the string
only if two adjacent apostrophes appear in the string in its place. These two
apostrophes are treated as representing one apostrophe character. If the quote is the
string delimiter, then two consecutive quotation marks inside a string are interpreted
as representing a single quotation character; that is, "ZYX""W" is interpreted as
"ZYX"W".

The length of the character constant is the number of characters between delimiting
apostrophes or quotation marks, except that each pair of consecutive delimiters
counts as a single character. Blanks embedded between delimiters are significant.
Note that it is not legal to have a string of length 0.

Each character in the string is in a character position that is numbered consecutively 1,


2, 3, and so on. The number indicates the sequential position of a character in the
string, beginning at the left and proceeding to the right.

26 3957 6053003
Constants, Variables, Arrays, and Substrings

The following are examples of valid character constants:

"ABCDEFG" stored as ABCDEFG

'EFGH' stored as EFGH

'A"BC' equivalent "A""BC" stored as A"BC

'A''BC' equivalent "A'BC" stored as A'BC

Hollerith Constants
The format for a Hollerith string is as follows:

 
 
 <width>  H  /255\  <EBCDIC character> 

Hollerith strings are used in format statements, data statements, and in initial value
lists of type declaration statements. They may also appear as actual arguments to a
subroutine, but not to a function.

If the compiler control option HOLLERITHTOCHARACTER is not set, then when a


Hollerith constant appears in a CALL statement as an actual argument, it is treated as
type integer. The type of the corresponding formal argument must be an integer or
real variable, unless the compiler control option EXPRESSIONTOARRAY is set, in which
case it can be an integer array. Each word of the actual argument is represented
internally as an integer. The upper 16 bits are binary zeros, and the lower 32 bits
contain four characters of the Hollerith string, starting from the left. Fewer than four
Hollerith characters in an actual argument are left-justified within the 32 bits, and the
remaining space on the right is filled with binary zeros.

Refer to Section 5 for the internal representation of Hollerith constants in a data


statement or initial value list.

The following are examples of valid Hollerith constants:

2HbQ

4H"C'.

7Hbb"ABC"

The following are examples of invalid Hollerith constants:

3HbbbAB Character string may not be longer than the integer preceding
the H indicates
-6HABBCDEF String width specification may not be negative
0HA String width specification may not be zero

3957 6053003 27
Constants, Variables, Arrays, and Substrings

Hexadecimal Constants
Another alternate representation of program values is the hexadecimal constant literal
that corresponds to notation in a number system with a radix of 16.

The FORTRAN77 compiler offers two formats in which to specify a hexadecimal


constant. There is a "Z" format and a quote format. The "Z" format for a hexadecimal
constant is as follows:

 
 
 Z  /24\  <hexadecimal digit> 

The quote format for a hexadecimal constant is the following:

 
 
  /24\  <hexadecimal digit>   X 
 
   
   
 "  /24\  <hexadecimal digit>  " 
<hexadecimal digit>

 0 
 
 1 
 
 2 
 
 ... 
 
 A 
 
 B 
 
 C 
 
 D 
 
 E 
 
 F 

The hexadecimal digits 0, 1, ..., 9 are represented by the characters 0, 1, ..., 9


respectively, and the hexadecimal digits equal in value to 10, 11, ..., 15 are represented
by letters A, B, ..., F, respectively.

Hexadecimal constants are used as an alternate way to represent numeric constants.


As an exception, they can also be used in character assignment and initialization.

The "Z" format can only be used for data initialization in DATA and TYPE statements.
The quote format can be used anywhere a numeric constant is allowed (including data
initialization in DATA and TYPE statements.)

28 3957 6053003
Constants, Variables, Arrays, and Substrings

A hexadecimal constant may specify up to two words (96 bits, 24 hex digits) of data.
The exact value that a hexadecimal constant represents depends upon how it is used.

REAL and LOGICAL types imply that a maximum of 12 hexadecimal digits can be
specified to represent a constant. INTEGER types imply that a maximum of eight hex
digits (32 bits) can be specified. The exception to this is using the "Z" format for data
initialization in DATA and TYPE statements. Here, a hexadecimal constant can specify a
maximum of 12 hex digits for INTEGERs.

When an INTEGER, REAL, or LOGICAL type is required and has a length requirement
that is greater than the number of hexadecimal digits specified, the constant is stored
right-justified with leading zeros appended to fill the word. If this type has a length that
is less than the number of hexadecimal digits, the left- most digits are retained and the
remaining digits are truncated. A warning message is given to flag the truncation.

When a DOUBLE PRECISION or COMPLEX type is required and fewer than 12


hexadecimal digits are specified, the first word contains these digits right- justified and
the second word is set to 0. When more than 12 digits are specified, the first word
contains the first 12 digits and the second word contains the remaining digits
right-justified with zero fill as necessary. For example, the double precision in the
hexadecimal constant '123456789ABCDEF'x is stored as
123456789ABC000000000DEF.

When a CHARACTER type is required, the hexadecimal constant represents a


character string. No word oriented justification is done. For example, 'E7E8E9'X
represents the EBCDIC character 'XYZ' with length of 3. The only requirement is that
the number of digits in the hex constant is even (two hex digits = one character). If an
odd number of digits is specified, the right- most digit is truncated and a warning
message is given.

The following rules are used to determine which type a hexadecimal constant
represents:

1. When the constant is used for initialization in DATA and TYPE statements, the
constant assumes the type of the item it is initializing.
Examples Type of Constant
INTEGER I/'89ABC'X/,J/Z1234/,K Both INTEGERs
REAL X
DATA K,X/'FFF'X,'9A1B5C'X/ INTEGER and REAL

1. When the hexadecimal constant is used with a binary operator, the constant
assumes the type of the other operand. Note that this includes the assignment
operator.
Examples Type of Constant
REAL X
DOUBLE PRECISION D
INTEGER I REAL

3957 6053003 29
Constants, Variables, Arrays, and Substrings

Examples Type of Constant


X = X + '1F5D'X REAL
D = '887EF260'X DOUBLE PRECISION
IF (I .LT. 'FF00FF00'X) GO TO 100 INTEGER

1. When a hexadecimal constant is used in a context that requires a specific data


type, the constant assumes this type.
Examples Type of Constant
DIMENSION Z ('A'X) INTEGER
Z (1) = FLOAT ('73AD5CE1'X) INTEGER

1. When a hexadecimal constant is used as an actual argument to a user subprogram


the constant assumes the type INTEGER (specifying a maximum of 32 bits, that is,
8 hex digits).
Examples Type of Constant
CALL SUB ('9445'X) INTEGER

1. When a hexadecimal constant is used in any other context, the constant assumes
the type INTEGER (specifying a maximum of 32 bits, that is, 8 hex digits).
Examples Type of Constant
X = '155'X + 'F32' X INTEGER
IF ('6774'X) 100,200,300 INTEGER

The following are examples of valid hexadecimal constants and their decimal
equivalents:

Hexadecimal Decimal
Constant Equivalent
Z0 0
Z10 16
Z100 256
ZFF 255
'1A'X 26
"203"x 515

210 3957 6053003


Constants, Variables, Arrays, and Substrings

The following are examples of invalid hexadecimal constants:

Invalid Reason
Constant
FFF60 Missing Z or missing quotes and X
ZABCDGF Contains the character G, which is not a hexadecimal digit
Z333.33 033 Contains a decimal point, which is illegal for a hexadecimal
constant
'AB C'X Contains a blank in the hexadecimal string, which is illegal for
the quote format
543DB"X Missing initial quote
'ZF94'X Contains the character Z, which is not a hexadecimal digit
'477B' Missing X after second apostrophe

Variables
A variable is an entity that has a symbolic name and type. The value of the data
represented by a variable may be altered during program execution.

A variable identifies one or more storage locations for purposes of data storage and
retrieval. The contents of these storage locations are accessed by referencing the
associated variable name. Note that the term variable refers to a simple variable and
does not include array elements.

A variable name is an identifier that consists of from 1 to 31 characters or one to the


number of characters specified in the IDLEN compiler control option, each of which is
an alphanumeric character (letter or digit), an underscore, or the symbol "$". A variable
name must begin with either a letter or the symbol "$". When the symbol "$" appears
in column 1, or a blank followed by the symbol "$" appears in columns 1 and 2, the
input record is treated as a compiler control image. Therefore, a variable name that
begins with the symbol "$" must not start in columns 1 or 2. If the variable name is
more than 31 characters long, then only the first 31 characters of this identifier are
retained internally. If the IDLEN compiler control option is specified, then the number
of characters of the identifier that are retained internally is equal to the number
specified with IDLEN. Embedded blanks are ignored. (Refer to Section 17 for
information on IDLEN.)

Variables may be classified into six types:

Integer

Real

Double precision

Complex

3957 6053003 211


Constants, Variables, Arrays, and Substrings

Logical

Character

The value represented by a variable of each of these types may be expressed by a


constant of the same type. The values represented by each variable type are subject
to restrictions of magnitude and significant digits that govern the corresponding type
of constant. A variable is assigned a type according to the initial character of its name,
unless it is declared in a specific TYPE statement or an IMPLICIT statement. If the
initial character is the letter I, J, K, L, M, or N, then the variable is of type integer. If the
initial character is any other letter or the symbol "$", then the variable is of type real.
No such defaults exist for types double precision, complex, logical, or character.
Variables of these types must be declared by appropriate type statements or IMPLICIT
statements.

The following are examples of valid variable names with the type assigned to them
when they are not affected by TYPE or IMPLICIT statements:

AMK599 Type real


X64000 Type real
OF TEN Type real; interpreted as OFTEN
LOOP3 Type integer
REALNUMBER Type real
The following are examples of invalid variable names:

3LOOP Variable name may not begin with a digit character


BE-GIN Characters other than letters, digits, or blanks are not
allowed in a variable name

Arrays
An array is an ordered set of data organized into dimensions. An array is referenced by
an array name that is of the same form as a variable name. A variable name is
designated as an array name by its appearance in an array declarer. All of the elements
of an array are of the same type and this type is indicated by the array name in the
same manner as for variable names.

An array element name identifies one element of the array. An array element name is
an array name qualified by a subscript.

The following is the format of an array element name:

  , 
 
 <array name>  (  /31\  <integer expression>  ) 
 
 <real expression> 

212 3957 6053003


Constants, Variables, Arrays, and Substrings

The number of subscript expressions must be equal to the number of dimensions in


the array declarer for the array. A subscript expression is an integer or real
expression. The truncated value determines which element in the array is identified by
the array element name.

An array name may appear without a subscript in the following cases:

1. The dummy argument list of a subprogram.


2. The actual argument list of a subprogram reference.
3. An I/O list if the array is not an assumed-size dummy array.
4. A COMMON, EQUIVALENCE, DATA, or TYPE statement.
5. A READ, WRITE, PRINT, or PUNCH statement as the format identifier if the array is
not an assumed-size dummy array.
6. A SAVE statement.
7. An I/O statement as a unit identifier for an internal file if the array is not an
assumed-size dummy array and is of type character.
8. DEBUG DUMP and DEBUG MONITOR statements.
9. The dummy argument list of a statement function.

Array Declarers
An array declarer declares the size and number of dimensions of an array.
The format for an array declarer is as follows:

  , 
 
 <array name>  (  /31\  <dimension declarer>  ) 

The number of dimensions in the array is the number of dimension declarers in the
array declarer. The minimum number of dimensions is 1 and the maximum is 31.

The format for a dimension declarer is as follows:

 <upper dimension bound> 


 
 <lower dimension bound>  : 

The lower and upper dimension bounds are integer arithmetic expressions. The value
of a dimension bound may be positive, negative, or zero; however, the value of the
upper dimension bound must be greater than or equal to the value of the lower
dimension bound. If only the upper dimension bound is specified, the value of the
lower dimension bound is assumed to be 1. An array declarer must precede the first
use of that array in an executable statement, DEBUG statement, or DATA statement.

A dimension bound expression may contain only constants, symbolic names of


constants, and variables that are all of type integer or real. If the dimension bound
expression contains a variable, then that variable must appear in every dummy
argument list that contains the array or be in a common block in that subprogram.

3957 6053003 213


Constants, Variables, Arrays, and Substrings

Each array declarer is either a constant array declarer, an adjustable array declarer, or
an assumed-size array declarer. A constant array declarer is an array declarer in which
each of the dimension bounds is a constant. An adjustable array declarer is an array
declarer that contains one or more variables. An assumed-size array declarer is a
constant array declarer or an adjustable array declarer, except that the upper bound of
the last dimension is an asterisk.

Furthermore, each array declarer is either an actual array declarer or a dummy array
declarer. An actual array declarer is one in which the array name is not a dummy
argument. An actual array declarer must be a constant array declarer and is permitted
in DIMENSION statements, COMMON statements, and type statements. A dummy
array declarer is one in which the array name is a dummy argument. A dummy array
declarer may be either a constant array declarer, an adjustable array declarer, or an
assumed-size array declarer. A dummy array declarer is permitted in DIMENSION
statements and TYPE statements, and may appear only in function or subroutine
subprograms.

The size of a dimension is the value d2-d1+1, where d1 and d2 are the dimension
bounds for that dimension. The size of an array is equal to the number of elements in
the array and to the product of the sizes of the dimensions specified by the array
declarer for that array. In the case of an assumed-size dummy array, the size is
determined as follows:

1. If the actual argument corresponding to the dummy array is a non-character array


name, the size of the dummy array is the size of the actual argument array.
2. If the actual argument corresponding to the dummy array name is a non- character
array element name with a subscript value of r in an array of size x, the size of the
dummy array is x + 1 - r.
3. If the actual argument is a character array name, character array element name, or
character array element substring name and begins at character storage unit t of
an array with c character storage units, then the size of the dummy array is
INT((c+1-t)/ln), where ln is the length of an element of the dummy array.
If an assumed-size dummy array has n dimensions, the product of the sizes of the first
n-1 dimensions must be less than or equal to the size of the array, as determined by
one of the immediately preceding rules.

The total size of a character array may not exceed (2**20-1) characters on MCP/AS
processors or (2**28-1)*6 characters on MCP/AS (Extended) processors.

The array size limits are listed as follows:

Array Type MCP/AS (Extended) MCP/AS


Machines Machines
Word types (Integer, Real, or 2**28-1 elements 2**20-1 elements
Logical)
Character type (2**28-1)*6 characters (2**20-1) characters
Double word types (double 2**27-1 elements 2**19-1 elements
precision or complex)

214 3957 6053003


Constants, Variables, Arrays, and Substrings

The following are examples of valid array elements:

AMK 599(6) Interpreted as AMK599(6)


ZAP IT(3) Interpreted as ZAPIT(3) when used where an array
element may appear
P(J5(3)) The subscript is itself an array element
ARRAY2 (1,1,1,1)
A(R*T)
INTT(1+9*ISIN0*IP110)
The following are examples of invalid array elements:

A(A) A subscript must be a valid arithmetic expression; an array name


does not constitute such an expression
3ARRAY(6) An array name must be a variable name

Substrings
A substring is a contiguous portion of character data. It is of type character. A
character substring is identified by a substring name and may be assigned values and
referenced.

The format of a substring name is the following:

 <variable name>  (  : E


   
 <array element name>   <integer expression> 

E ) 
 
 <integer expression> 

For example A(2:4) specifies characters in positions two through four of the character
variable A, and B(4,3) (1:6) specifies characters in positions one through six of the
character array element B(4,3). The values of the left and right integer expressions
must be such that 1 <= left int exp <= right int exp <= length of the character variable
or array element. If the left int exp is omitted, a value of 1 is assumed. If the right is
omitted, a value of length is implied for it. Both expressions may be omitted; for
example, the form v(:) is equivalent to v, and the form a(i,i ...)(:) is equivalent to a(i,i ...).
The length of a character substring is: (right int exp - left int exp + 1).

The integer expression used to define the substring may contain array element
references and function references. Evaluation of a function must not alter the value
of any other expression within the same substring name.

3957 6053003 215


Constants, Variables, Arrays, and Substrings

The following are examples of valid substrings where I and JK are integer variables:

AB(5:6)

CX(5)(2:I)

G(5:)

ZB(:)

GY(:JK*03)

216 3957 6053003


Section 3
Expressions

An expression consists of operands, operators, and parentheses. An operand is a valid


constant, variable, array element, function or intrinsic reference, or expression
enclosed in parentheses. The expression represents the value obtained when the
indicated operations are performed on the indicated values. There are four types of
expressions: arithmetic, character, relational, and logical.

Operators
There are four types of operators that may be used to form FORTRAN77 expressions.
They are arithmetic operators, relational operators, logical operators, and character
operators.

The five arithmetic operators are as follows:

** Exponentiation
- Subtraction or Negation
/ Division
* Multiplication
+ Addition

The precedence among the arithmetic operators that determines the order in which
the operands are to be combined (unless the order is changed by parentheses) is from
highest to lowest as follows:

** Highest
* and / Intermediate
+ and - Lowest

There is only one character operator, concatenation, which is denoted by two adjacent
parallel slashes. Parentheses do not affect the evaluation of character expressions.

// Concatenation

3957 6053003 31
Expressions

The seven relational operators are of equal precedence and are as follows:

.LT. Less than


.LE. Less than or equal to
.EQ. Equal to
.NE. Not equal to
.GT. Greater than
.GE. Greater than or equal to
.IS. 48 or 96 bit equivalent to

The five logical operators are as follows:

.NOT. Logical Negation


.AND. Logical Conjunction
.OR. Logical Inclusive Disjunction
.EQV. Logical Equivalence
.NEQV. Logical Non-equivalence

The precedence among the logical operators that determines the order in which the
operands are to be combined (unless the order is changed by parentheses) is from
highest to lowest as follows:

.NOT. Highest
.AND.
.OR.
.EQV. or .NEQV. Lowest

The precedence among the various types of operators is as follows:

Arithmetic Highest
Character
Relational
Logical Lowest

Operations of equal precedence are performed from left to right, except for
exponentiation, which is carried out from right to left. Parentheses may be used to
override operator precedence in the usual manner. The unary + operator is ignored.
Note that adjacent operators are not permitted.

32 3957 6053003
Expressions

Arithmetic Expressions
An arithmetic expression is used to express a numeric computation. Evaluation of an
arithmetic expression produces a numeric value. An arithmetic expression may
contain only arithmetic operators, symbolic names of arithmetic constants, arithmetic
constants, array elements, variables, arithmetic functions and intrinsic function
references, and grouping parentheses. The format for integer, real, and double
precision expressions is as follows:

  <arithmetic operator> 


 
 <operand> 
 
 + 
 
 - 

<operand>

 <arithmetic constant> 


 
 <constant name> 
 
 <variable name> 
 
 <array element name> 
 
 <function reference> 
 
 ( <arithmetic expression> ) 

The types of operands in an arithmetic expression determine the type of the value
obtained from the evaluation of the expression. The resultant types of arithmetic
operations depend upon the types of the operands and the operator involved.
"DOUBLE" indicates type double precision.

For the operators +, -, *, and /, the result of the operation is of the following type:

Type of Type of Second Operand


First
Operand
Integer Real Double Complex
Integer INTEGER REAL DOUBLE COMPLEX
Real REAL REAL DOUBLE COMP LEX
Double DOUBLE DOUBLE DOUBLE COMPLEX
Complex COMPLEX COMPLEX COMPLEX COMPLEX

3957 6053003 33
Expressions

For exponentiation (**), the type and the interpretation of the expression X1**X2 is as
follows:


 X2  I2  R2  D2  C2 
 X1     
....
 I1 I =I1**I2R =REAL(I1)**R2D =DBLE(I1)**D2C =CMPLEX(REAL(I1),0.)**C2
     
 R1 R =R1**I2R =R1**R2 D =DBLE(R1)**D2C =CMPLX(R1,0.)**C2 
     
 D1 D =D1**I2D =D1**DBLE(R2)D =D1**D2  Prohibited 
     
 C1 C =C1**I2C =C1**CMPLX  Prohibited C =C1**C2 
   (R2,0.)   


Four entries shown previously specify an interpretation to be a complex value raised


to a complex power. In these cases, the value of the expression is the "principal value"
determined by X1**X2 = EXP (X2*LOG(X1)), where EXP and LOG are functions
described in Section 12.

If the value of I2 is negative, the interpretation of 1/(I1**ABS(I2)) is subject to the rules


for integer division. For example, 2**(-3) has the value of 1/(2**03), which is zero.
The following are examples of valid arithmetic expressions:

6
J + 6
XALPHA(8) / A + (ZZ + XALPHA(9)) / ZETA
LBD / (A(1) + A(2))
20 ** FCN1 (XND(1,2) ,12)
-B * A
-(-P)

The following are examples of invalid arithmetic expressions:

B**-A Illegal adjacent operators


Q,R Illegal character
2+A.AND.B Illegal logical operator
(A+B) (C+D) Illegal implied multiplication

Character Expressions
A character expression is used to express a character string. Evaluation of a character
expression produces a result of type character.

A character expression may contain character constants, symbolic names of character


constants, character variables, character array elements, character substrings, and
character functions combined with character operators and parentheses.
Concatenation, denoted by parallel slashes, is the only character operator.

The format for the character expression is the following:

34 3957 6053003
Expressions

  // 
 
 <character constant> 
 
 <constant name> 
 
 <variable name> 
 
 <array element name> 
 
 <substring name> 
 
 <function reference> 
 
 <character expression> 

The result of a concatenation operation (X1 // X2) is a character string whose value is
the value of X1 concatenated on the right with the value of X2 and whose length is the
sum of the lengths of X1 and X2. For example, the value of 'AB' // 'CDE' is the string
ABCDE. Except in a character assignment statement, a character expression must not
involve concatenation of a character operand whose length specification is an asterisk
in parentheses (that is (*)length), unless the operand is the symbolic name of a
constant.

The following is a program segment that contains examples of character expressions


and their values.

CHARACTER*03 C
CHARACTER*04 D, E, F, G
C = ABC
D = DEFG
E = FG // HI
F = C // D
G = AB // D(1:2)
C = C(2:) // Z

The resulting values are:

C = BCZ
D = DEFG
E = FGHI
F = ABCD
G = ABDE

3957 6053003 35
Expressions

Relational Expressions
A relational expression is used to compare the values of two arithmetic expressions
or two character expressions.

The format for a relational expression is the following:

 <arithmetic expression>  <rel op>  <arithmetic expression> 


 
 <character expression>  <rel op>  <character expression> 

The value of an arithmetic expression may not be compared to a character expression.


A relational expression consists of two expressions both either arithmetic or
character, separated by one of the seven relational operators. Evaluation of the
expression produces the logical value of .TRUE. or .FALSE. It is interpreted as logically
true if the values of the operands satisfy the relation specified by the operator, and
false if they do not satisfy the relation. Only .EQ. or .NE. are permitted with complex
operands. The comparison of a double precision value and a complex value is not
permitted.

The relational operator .IS. returns a value of true if the data words referenced on
either side of the operator are bit-by-bit identical. Complex operands may not be used
with this operator. The .IS. operator allows a real, integer, or double precision variable
to be compared to a character string constant. The length of the string must be short
enough to fit into the variable type (maximum of four characters for integers, six for
reals, and twelve for double precision variables).

When the operands of the relational expression are of type character, they are
compared for their relative value in the EBCDIC collating sequence. If the character
operands are of unequal length, the shorter operand is considered to be extended on
the right with blanks to the length of the longer operand.

Examples of relational expressions follow. In these examples A, B, and C are real


variables. D is a double precision variable. C1 and C2 are complex variables, and CA,
CB, and CD are character type variables.

B + A .GT. D
C1 .EQ. C2
CA // CB .GE. CD
CA(2:3) .LT. CB
A * B / 9.2 .LE. C
C1 .NE. A

Logical Expressions
A logical expression represents a rule for computing a value corresponding to .TRUE.
or .FALSE. and consists of any valid combination of logical operands, logical operators,
and parentheses. A logical operand may be a logical constant, symbolic name of a
logical constant, logical variable, logical array element, logical function reference, a
relational expression, or a logical expression in parentheses.

36 3957 6053003
Expressions

The format for a logical expression is as follows:

 <logical operand> 


 
 
  
   
 .AND.  <logical operand> 
 
 .OR. 
 
 .NEQV. 
 
 .EQV. 
<logical operand>

 <logical constant> 


   
 .NOT.   <constant name> 
 
 <variable name> 
 
 <array element name> 
 
 <function reference> 
 
 <relational expression> 
 
 ( <logical expression> ) 

Logical negation is expressed by the operator .NOT., which complements the value of
a logical operand.

The .AND. operator is used to express the logical product of two operands. The
operation A.AND.B yields the value .TRUE. if, and only if, both A and B are .TRUE..
Otherwise the value of A.AND.B is .FALSE.

The .OR. operator is used to express the logical sum of any two logical operands. The
operation A.OR.B yields the value .FALSE. only if both A and B are .FALSE.. Otherwise,
the value of A.OR.B is .TRUE.

The .EQV. operator is used to express the logical equivalence of two logical operands.
The operation yields the value .TRUE. if both A and B are .TRUE. or both A and B are
.FALSE.. Otherwise the value of A.EQV.B is .FALSE..

The .NEQV. operator is the negation of the logical equivalence. The operation
A.NEQV.B yields the value .FALSE. if both A and B are .TRUE. or both A and B are
.FALSE.. Otherwise, the value of A.NEQV.B is .TRUE..

3957 6053003 37
Expressions

Table 31. Logical Expressions and Values

A B .NOT. A A.AND. A.OR.B A.EQV.B A.NEQV.B


B

T T F T T T F
T F F F T F T
F T T F T F T
F F T F F T F

The following are examples of logical expression: A, B, and C are real variables; L1, L2,
and array L3 are logical variables; TRU is the symbolic name of a logical constant; and
EVAL is a logical function.

A + B .GT. C .OR. L2
.NOT. (L1 .OR. L3 (1)) .AND. TRU
EVAL(A) .NEQV. L1
L3(3) .OR. L2 .EQV. L1 .AND. L3(2)

38 3957 6053003
Section 4
Specification Statements

The non-executable specification statements are used to supply compile-time


information about the types, initial values, and storage allocation of variables and
arrays and to allow subprograms to be used as actual arguments.

The specification statements include the following:

1. DIMENSION
2. EQUIVALENCE
3. COMMON
4. TYPE statements - INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL and
CHARACTER
5. IMPLICIT
6. PARAMETER
7. EXTERNAL
8. SAVE
9. INTRINSIC

DIMENSION Statement
The non-executable DIMENSION statement specifies the name and dimensions of an
array.

The format for the DIMENSION statement is as follows:

3957 6053003 41
Specification Statements

  , 
 
 DIMENSION  <array declarer> 

<array declarer>

  , 
 
 <array name>  (  /31\  <dimension declarer>  ) 

<dimension declarer>

%% <bound expression> 


 
* <bound expression>  : ,

<bound expression>

  <arith op> 


 
%%% <integer constant> %
   
0 +  0 <real constant> 
   
* - , 0 <integer constant name> 
 
0 <real constant name> 
 
0 <integer variable name> 
 
0 <real variable name> 
 
* ( <bound expression> ) ,

Each array referenced in a program unit must have its array bounds specified exactly
once in an array declarer in that program unit. Array declarers may appear in
COMMON and TYPE statements in addition to the DIMENSION statement. Refer to
"Array Declarers" in Section 2 for further information.

Examples:
DIMENSION D(2:3), E(2:5,-1:0)
DIMENSION A(10)
DIMENSION B(N,2),C(6)
DIMENSION Q(J)

EQUIVALENCE Statement
An EQUIVALENCE statement is used to specify the sharing of memory locations by
two or more entities in a program unit. If the equivalent entities are of different data
types, the EQUIVALENCE statement does not cause type conversion or imply
mathematical equivalence.

The format for the EQUIVALENCE statement is the following:

42 3957 6053003
Specification Statements

  , 
 
   ,  
   
 EQUIVALENCE  (  <equiv entity>  ,  <equiv entity>  ) 

<equiv entity>

% <variable name> %


 
0 <array name> 
 
0 <array element name> 
 
* <substring name> ,

Names of dummy arguments must not appear in the list. If a variable name is also a
function name, that name must not appear in the list.

Each subscript expression or substring expression in a list must be either an integer


constant expression or a real constant expression.

An entity of type character may be equivalent only with other entities of type
character. The lengths of the equivalent entities are not required to be the same. If an
array element name appears in an EQUIVALENCE statement, the number of subscript
expressions must be the same as the number of dimensions specified in the array
declarer for the array name.

Using an array name unqualified by a subscript in an EQUIVALENCE statement has the


same effect as using an array element name that identifies the first element of the
array.

An EQUIVALENCE statement must not specify that the same storage unit is to occur
more than once in a storage sequence, as shown in the following example:

DIMENSION A(2)
EQUIVALENCE (A(1),B), (A(2),B)

This is prohibited because it specifies the same storage location for A(1) and A(2).

An EQUIVALENCE statement must not specify that consecutive storage units are to
be non-consecutive. For example, the following is prohibited:

REAL A(2)
DOUBLE PRECISION D(2)
EQUIVALENCE (A(1), D(1)), (A(2),D(2))

The following are valid examples of the equivalence statement:

DIMENSION X(5), Z(10)


EQUIVALENCE (X,Z(6),Y)

Y, X(1), and Z(6) all share the same memory location. Z(7) through Z(10) share locations
with X(2) through X(5).

3957 6053003 43
Specification Statements

CHARACTER A*04, B*04, C(2)*03


EQUIVALENCE (A,C(1)), (B,C(2))

The association of A, B, and C can be graphically illustrated as:

01020304050607

0A
 
0C(1)KC(2)
 
0B

COMMON Statement
The non-executable COMMON statement associates variables and arrays with blocks
of storage that may be shared among several program units.

The format for the COMMON statement is the following:

 COMMON %% <nlist> L


 
* / %% / ,
 
* <common block name> ,

L%%
 
  
   
*%% / %% /  <nlist> ,
   
* , , * <common block name> ,

<nlist>
 , 
 
% <variable name> %
 
0 <array name> 
 
* <array declarer> ,

A symbolic name associated with each block of common storage is called a common
block name. Any program unit may access the block of storage associated with this
name by means of a common statement using this name. Common storage
associated with a common block name is called named common. A common block
name is constructed the same as a variable name is constructed. This name may not
be a dummy argument, subroutine function, named block data, external procedure, or
named main program. A common block name is considered as such only in the
context of a COMMON statement. A common block need not be named; common
storage associated with no name is called blank common.

44 3957 6053003
Specification Statements

The following statements are equivalent and define a blank common block:

COMMON//A,B(10)
COMMON A,B(10)

Variables and arrays are assigned contiguous locations in common storage in the order
in which they appear in a COMMON statement. Entire arrays, but not individual array
elements, may be assigned storage locations in common storage.

If a character variable or character array is in a common block, all of the entities in that
common block must be of type character.

If the same common name appears more than once in a program unit, the common
elements associated with a second or subsequent appearance are considered as
extensions to the list of the previous appearances.

The EQUIVALENCE statement may be used to associate elements with a common


block. This association may extend the common block beyond its former terminal
point, thus increasing the size of the common block. Such an association may not
extend a common block backwards to locations preceding its initial point. Two
elements of common storage may not be made equivalent to one another, either
directly or indirectly by an EQUIVALENCE statement.

Variables and array names may not be duplicated in COMMON statements. One
variable or array may not be assigned to more than one block of common storage
within a program unit. Symbolic constants from a PARAMETER statement may not be
included in a COMMON statement.

Program units that specify the same common block have access to the same area.
The associated values are retained even if a RETURN or END statement is executed.

Examples of the COMMON statement:


COMMON/BLOCK1/A,B(10),C//G,HOLD,/BLOCK2/Q(3)
COMMON C
COMMON T1/CMN/T2,T3

TYPE Statement
The TYPE statement is used to override or to confirm implicit typing and may specify
dimension information.

The appearance of the symbolic name of a constant, variable, array, or function in a


type statement specifies the data type for that name for all appearances in the
program unit. Within a program unit, a name must not have its type specified explicitly
more than once.

The following is the format for a TYPE statement:

3957 6053003 45
Specification Statements

 , 
 
 <type> %% <variable list> %%
   
* , , * /<initial value list>/ ,

<type>

% INTEGER %%%


   
0 REAL  * * <length spec> ,
 
0 DOUBLE PRECISION 
 
0 COMPLEX 
 
0 DOUBLE COMPLEX 
 
0 LOGICAL 
 
* CHARACTER ,
<variable list>

 , 
 
% <variable name> %%%
   
0 <array declarer>  * * <length spec> ,
 
0 <array name> 
 
0 <function name> 
 
* <constant name> ,

<length spec>

% (  *  ) %


 
0 <nonzero unsigned integer constant> 
 
* ( <integer constant expression> ) ,

A length immediately following the data type specifier is the length specification for
each entity in the statement not having its own length specification. A length
specification immediately following an entity is the length specification for that entity
only.

For character items, the length specification indicates the number of characters that an
entity contains. Note that for an array the length specified is for each array element.
The total length of a character variable or array may not exceed (2**20-1) characters on
MCP/AS processors or (2**28-1)*6 characters on MCP/AS (Extended) processors. If a
length is not specified for an entity, its length is assumed to be 1. When a length
specification is used with an entity declared in a CHARACTER statement, it must be an
integer constant expression, unless that entity is an external function, a dummy
argument of an external procedure, or an integer constant that has a symbolic name.

46 3957 6053003
Specification Statements

For non-character items, length specifications are allowed for compatibility with other
FORTRAN implementations. These length specifications are ignored unless associated
with items declared REAL*8 and REAL*16, whose types are set to DOUBLE
PRECISION.

If a character dummy argument has a length of (*) declared, the dummy argument
assumes the length of the associated actual argument for each reference to the
subroutine or function. If the associated actual argument is an array name, the length
assumed by the character dummy argument is the length of an array element in the
associated actual argument array.

If a function name, occurring in either a FUNCTION or an ENTRY statement, is declared


with a length specification of (*), and a reference to that function name is executed,
the function assumes the length specified in the referencing program unit.

The length specified for a character function in the program unit that references the
function must be an integer constant expression and must agree with the length
specified in the subprogram that specifies the function. Note that there is always
agreement of length if a length of (*) is specified in the subprogram that specifies the
function.

If a character constant that has a symbolic name has a length of (*) declared, the
constant assumes the length of its corresponding constant expression in a
PARAMETER statement.

The length specified for a character statement function or statement function dummy
argument of type character must be an integer constant expression.

The length specifier of (*) may only be used for character items.

Initial Value Lists


The TYPE statement may be used instead of the DATA statement for variable
initialization. Type statements may contain initial values that are constructed similarly
to that of the initial value list in a DATA statement. If a variable is initialized in this
manner, then its initial value must immediately follow its declaration.

In an initial value list, a comma after a slash is not required.

Examples of type statements:


REAL INT,IL1
INTEGER A1/2/, R2/3/, Z
CHARACTER*05, D, B, C*03
CHARACTER*02 G/HA/, H/HB/, L, M

3957 6053003 47
Specification Statements

IMPLICIT Statement
The IMPLICIT statement allows alteration of the default types that are normally
assigned to variable names.

The format for the IMPLICIT statement is the following:

 , 
 
  ,  
   
 IMPLICIT % <type>  (  <letter> %% ) %
   
 * -  <letter> , 
 
* NONE ,
<type>

% INTEGER %%%


   
0 REAL  * * <length spec> ,
 
0 DOUBLE PRECISION 
 
0 COMPLEX 
 
0 DOUBLE COMPLEX 
 
0 LOGICAL 
 
* CHARACTER ,

An IMPLICIT statement specifies a type for all variables, arrays, symbolic names of
constants, and functions (except intrinsic functions) that begin with any letter that is
specified, either as a single letter or included in a range of letters. In addition, the
symbol "$" can be used, either singly, or within a range of letters. The symbol "$" is
collated after the letter "Z". IMPLICIT statements do not change the type of any
intrinsic functions. An IMPLICIT statement applies only to the program unit that
contains it. Type specification by an IMPLICIT statement may be overridden or
confirmed by the use of a TYPE statement. An explicit type specification in a
FUNCTION statement overrides an IMPLICIT statement for the name of that function
subprogram. Note that the length is also overridden when a particular name appears in
a CHARACTER or CHARACTER FUNCTION statement.

Within the specification statements of a program unit, IMPLICIT statements must


precede all other specification statements, except PARAMETER statements. A
program unit may contain more than one IMPLICIT statement.

48 3957 6053003
Specification Statements

The IMPLICIT NONE statement cancels the default type association for a program unit.
When present, it must appear before any other specification statement in the program
unit, including PARAMETER statements. Use of the IMPLICIT NONE statement
requires that variables, arrays, symbolic names of constants, and functions (except
intrinsic functions) have their type explicitly declared. The appearance of IMPLICIT
NONE with any other form of the IMPLICIT statement within a program unit results in
a syntax error. When set, the IMPLICITNONE compiler control option causes all
program units encountered to be treated as though there was an IMPLICIT NONE
statement in them.

The same letter or the symbol "$" must not appear singly or be included in a range
more than once in all of the IMPLICIT statements in a program unit.

Examples of the IMPLICIT statement:


IMPLICIT REAL (I,L-N), LOGICAL (C,F)
IMPLICIT CHARACTER*03 (Z,X)
IMPLICIT DOUBLE PRECISION (B,D),CHARACTER(L)

PARAMETER Statement
The PARAMETER statement is used to give a constant a symbolic name.

The format of the PARAMETER statement is as follows:

 , 
 
 PARAMETER  (  <constant name>  =  <constant expression>  ) 

If the symbolic name is of type integer, real, double precision, or complex, the
corresponding expression must be an arithmetic constant expression. If the symbolic
name is of type character or logical, the corresponding expression must be a
character constant expression or a logical constant expression, respectively.

The constant is defined with the value of the expression that appears on the right of
the equal sign, in accordance with the rules for assignment statements.

Any symbolic name of a constant that appears in an expression must have been
defined previously in the same or a different PARAMETER statement in the same
program unit. A symbolic name of a constant must not be defined more than once in a
program unit.

If a symbolic name of a constant is not of default implied type, its type must be
specified by a TYPE statement or IMPLICIT statement prior to its first appearance in a
PARAMETER statement. If the length specified for the symbolic name of a constant of
type character is not the default length of 1, its length must be specified in a TYPE
statement or IMPLICIT statement before the first appearance of the symbolic name of
the constant. Its length must not be changed by subsequent statements, including
IMPLICIT statements.

3957 6053003 49
Specification Statements

Once a constant is defined, it may appear in that program unit in any subsequent
statement as a primary in an expression, in a DATA statement, or be included in a
COMMON statement. A symbolic name of a constant must not be part of a format
specification or must not be used to form part of another constant (for example, any
part of a complex constant). A symbolic name in a PARAMETER statement may
identify only the corresponding constant in that program unit.

Examples:
PARAMETER (PVALUE=5.6789)
PARAMETER (RFACT=3.563, R2FACT=2*RFACT, T=.TRUE.)

EXTERNAL Statement
An EXTERNAL statement is used to indicate that a symbolic name represents an
external procedure or dummy procedure and to permit such a name to be used as an
actual argument.

The format for the EXTERNAL statement is as follows:

 , 
 
 EXTERNAL % <subroutine name> %
 
0 <function name> 
 
* <block data subprogram name> ,

A name appearing in an EXTERNAL statement is an external procedure name, dummy


procedure name, or block data subprogram name. If an external procedure or a
dummy procedure name is used as an actual argument in a program unit, it must
appear in an EXTERNAL statement in that program unit. Note that a statement function
name must not appear in an EXTERNAL statement.

If an intrinsic function name appears in an EXTERNAL statement in a program unit, that


name becomes the name of some external procedure, and an intrinsic function of the
same name is not available for reference in the program unit.

The following are examples of valid EXTERNAL statements:

EXTERNAL EQUIV
EXTERNAL SUBA, FCN1

INTRINSIC Statement
An INTRINSIC statement is used to identify a symbolic name as representing an
intrinsic function. It also permits a name that represents a specific intrinsic function to
be used as an actual argument.

The format for the INTRINSIC statement is the following:

410 3957 6053003


Specification Statements

 , 
 
 INTRINSIC  <function name> 

A name appearing in an INTRINSIC statement is an intrinsic function name. If a specific


name of an intrinsic function is used as an actual argument in a program unit, it must
appear in an INTRINSIC statement. The following names of intrinsic functions must not
be used as actual arguments:

Type conversion: INT, IFIX, HFIX, IDINT, FLOAT, SNGL, REAL, DBLE,
DFLOAT, CMPLX, DCMPLX, ICHAR, CHAR
Lexical relationship: LGE, LGT, LLE, LLT
Character UPPERCASE, UPPERC, LOWERCASE, LOWERC,
manipulation: TRIM, ADJUSTL, ADJUSTR, LEN_TRIM, TRMLEN
Choosing the largest or MAX, MAX0, AMAX1, DMAX1, AMAX0, MAX1, MIN,
smallest value: MIN0, AMIN1, DMIN1, AMIN0, MIN1
Bit manipulation: AND, IAND, COMPL, NOT, EQUIV, OR, IOR, EOR,
IEOR, SHFT, ISHFT, BITS, IBITS, BSET, IBSET, BCLR,
SHFTC, ISHFTC, BTEST, ISOL, TIME, CTIME, DATE,
RANDOM, GAMMA, DGAMMA, LGAMA, ALGAMA,
DLGAMA, ERF, DERF, ERFC, DERFC, VALUE, CHARS,
SKIP
The appearance of a generic function name in an INTRINSIC statement does not cause
that name to lose its generic property.

Only one appearance of a symbolic name in all of the INTRINSIC statements of a


program unit is permitted. Note that a name must not appear in both an EXTERNAL
and INTRINSIC statement in a program unit.

Examples:
INTRINSIC TANH
INTRINSIC LOG10, EXP

SAVE Statement
A SAVE statement is used to retain the definition status of an entity after the
execution of a RETURN or END statement in a subprogram. Within a function or
subroutine subprogram, an entity specified by a SAVE statement does not become
undefined as a result of the execution of a RETURN or END statement in the
subprogram. However, such an entity in a common block may become redefined in
another program unit.

The format of a SAVE statement is the following:

3957 6053003 411


Specification Statements

 SAVE %%
 
  ,  
   
*% <variable name> %,
 
0 <array name> 
 
* /  <common block name>  / ,

The execution of a RETURN statement or an END statement within a subprogram


causes all entities within the subprogram to become undefined, except for the
following:

1. Entities specified by SAVE statements.


2. Entities in common or equivalent to an entity in common.
3. Arrays declared with OWNARRAYS set. All entities declared with OWN set.
4. Entities with initial values through type or DATA statements when CONVERT is
set.
Dummy argument names, procedure names, and names of entities in a common block
must not appear in a SAVE statement.

A SAVE statement without a list is treated as though it contained the names of all
allowable items in that program unit.

The appearance of a common block name preceded and followed by a slash in a SAVE
statement has the effect of specifying all of the entities in that common block.

A SAVE statement is optional in a main program and has no effect.

If a local entity that is not in a common block and not specified by a SAVE statement is
in a defined state at the time the RETURN or END statement is executed in a
subprogram, that entity is defined with the same value at the next reference of that
subprogram.

Examples:
SAVE
SAVE /CMBLKA/,AX,ZZ,/CMBLKB/

412 3957 6053003


Section 5
DATA Statement

The DATA statement is used to provide initial values for variables, arrays, array
elements, and substrings. A DATA statement is non-executable and may appear in a
program unit anywhere after the specification statements, if any. All initially defined
entities are defined when an executable program begins execution.

The format of a DATA statement is the following:

3957 6053003 51
DATA Statement

 , 
 
 DATA   <variable list>  /  <initial value list>  /  

<variable list>

 , 
 
  <variable name>  
 
 <array element name> 
 
 <array name> 
 
 <substring name> 
 
 <data implied-DO list> %

<data implied-DO list>

 , 
 
 (   <array element name>   , <DO-variable> = <ae> , <ae> (
 
 <data implied-DO list> %

( ) 
 
 ,<ae> %

<ae>

 <integer constant expression> 


<initial value list>

 , 
 
  <constant>  
   
 <repeat>  *   <constant name> %
 
 <constant name> %

<repeat>
 <nonzero unsigned integer constant> 

Names of dummy arguments and functions must not appear in the list of elements to
be defined. The names of entities in a common block may appear in this list only
within a main program or a block data subprogram.

When the compiler option SEPARATE is set, a program unit may use DATA
statements with common block entities only when BOTH of the following conditions
are met:

1. The program unit is a main program or block data subprogram.


2. The compiler control option CODEFILEINIT is not set.

52 3957 6053003
DATA Statement

If a program unit uses DATA statements with common block elements and binding is
involved, the following cautions should be noted:

1. If a common block is assigned initial values in a given program unit and the
program unit that initializes the common block is replaced by another program
unit, the original data in the common block is lost if CODEFILEINIT was not set
when the common block was first encountered. The program unit that is replacing
the original program unit might or might not itself initialize the common block.
2. If a common block is assigned initial values in one program unit and a DIFFERENT
program unit that also initializes the common block is bound in, the results are
unpredictable. For this reason, it is best to avoid initializing values for the same
common block in more than one program unit.
There is a one-to-one correspondence between the items specified by the variable list
and the constants specified by the initial value list, that is, the first item of variable list
corresponds to the first item of the initial value list, and so forth. The entity is initially
defined by this correspondence.

In the event that the number of items in the constants list is not equal to the number
of items in the variable list, the one-to-one correspondence holds true until the end of
the shorter of the lists. If the constants list contains more items than the variable list,
then the extra constants are ignored. If the variable list is the longer of the two lists,
then the variables are matched up with their respective constants and the remaining
variables for which there are no constants are initialized to a null value. For numeric
types, this null value is a zero, logical variables are initialized to .FALSE., and character
variables that have no corresponding constant are initialized to hex 00 (null) for their
entire length.

Correspondence between the entities in the variable list and those in the initial value
list is restricted to the following:

1. If the variable entity is of type integer, real, or double precision, the corresponding
value constant must be of type integer, real, double precision, hexadecimal,
character, or Hollerith.
2. If the variable entity is of type complex, the corresponding value constant must be
of type integer, real, double precision, complex, hexadecimal, character, or
Hollerith.
3. If the variable entity is of type logical, the corresponding value constant must be
of type logical, hexadecimal, or Hollerith.
4. If the variable entity is of type character, the corresponding value constant must
be of type character, hexadecimal, or Hollerith. If the constant is of type
hexadecimal, it must fill the character variable, array element, or substring exactly.
A non-character entity becomes defined with a hexadecimal value according to the
rules for input as if it were done with Z format.

Strings may be stored in any type of variable, not just those of type CHARACTER. This
storage includes both quoted strings and Hollerith data. This storage is allowed in
DATA statements, as well as in the initial value lists of type declaration statements.

3957 6053003 53
DATA Statement

Items of type INTEGER can hold a maximum of four characters. The value is stored in
the [31:32] bit field. Bit field [47:16] contains zeros, eliminating any possibility of integer
overflow. REAL and LOGICAL values can hold a maximum of six characters, while
COMPLEX and DOUBLE PRECISION items can hold a maximum of twelve characters.

Strings that initialize a variable or array element and that exceed the length of the
element are truncated from the right. Strings that are smaller than their corresponding
DATA elements are left-justified and filled with blanks. For word variables only, when a
long string (greater than one element) initializes an array name, the entire string is
transferred to the array beginning with the starting element until the end of the string,
or the end of the array is encountered (refer to Section 15 for more information). If the
string ends before the entire array is filled, the last initialized element has its value left-
justified and filled on the right with blanks. The remaining elements of the array are
filled with the next values in the data list.

Examples:
INTEGER I,J,K
REAL A,B,C(3),D(2)
DATA I,J,K /"A","ABCD","ABCDEF"/
DATA A,B /"ABCD", "ABCDEF"/
DATA C,D /"ABCDEFGHIJKL", "MNOPQRST", "ABC", "DEF"/

The values if printed out in the Z12 format:

I = 0000C1404040
J = 0000C1C2C3C4
K = 0000C1C2C3C4 (EF Is TRUNCATED)
A = C1C2C3C44040
B = C1C2C3C4C5C6
C(1) = C1C2C3C4C5C6
C(2) = C7C8C9D1D2D3
C(3) = D4D5D6D7D8D9 (ST IS TRUNCATED)
D(1) = C1C2C3404040
D(2) = C4C5C6404040

If necessary, the initial value is converted to the type of the variable entity according
to the rules for input. Table 5-2 describes the conversion performed on a constant in
the variable list when it defined the initial value of a variable entity.

Constant Type Integer Real Double Complex Logical Character


Precision

INTEGER n real dble cmplx i i


REAL int n dble cmplx i i
DOUBLE int real n cmplx i i
PRECISION
COMPLEX i i n n i i
LOGICAL i i i i n i

54 3957 6053003
DATA Statement

Constant Type Integer Real Double Complex Logical Character


Precision

CHARACTER n n n n n n
HEXADECIM n n n n n n
AL
HOLLERITH n n n n n n

Legend
n No conversion except as previously noted for strings, hexadecimal constants, or
Hollerith
int Truncate to integer if magnitude does not exceed maximum integer size, integer
overflow error given otherwise
real Convert to real number
dble Convert to double precision value
cmplx Convert to real and supply zero imaginary part
i Invalid combination resulting in syntax error
If a single element is defined more than once in a DATA statement, it is assigned the
most recent value associated with it. If two entities are related and both are initially
defined in a DATA statement, then the result is undefined. Subscript expressions for
array elements must be integer constant expressions, except for implied-DO
variables; substring expressions must be integer constant expressions.

Implied-DO in a DATA Statement


The range of an implied-DO list is the list of items preceding the implied-DO variable.
An iteration count and the values of the implied-DO variable are established in M1, M2,
and M3 exactly as for a DO-loop, except that the iteration count must be positive.
When an implied-DO list appears in a DATA statement, the list items are specified
once for each iteration of the implied- DO list with the appropriate substitution of
values for any occurrence of the implied-DO variable. The appearance of an
implied-DO variable name in a DATA statement does not affect the definition status of
a variable of the same name in the same program unit.

Each subscript expression in the item list must be an integer constant expression,
except that the expression may contain implied-DO variables of implied-DO lists that
have the subscript expression within their ranges.

If the length of a character entity in the item list is greater than the length of its
corresponding character constant, the additional right-most characters in the entity are
initially defined with blank characters. If the length is less than the length of its
corresponding character constant, the additional right- most characters in the constant
are ignored. Note that each character constant initially defines exactly one variable,
array element, or substring.

3957 6053003 55
DATA Statement

The following program excerpt:

LOGICAL L1, L2
CHARACTER ACHAR*06, BCHAR*06,CCHAR*02
DIMENSION A(6)
COMPLEX ZCMP
DATA L1,L2 /2 * .TRUE./, ACHAR, BCHAR, CCHAR /3 * 123/
DATA INT, (A(I) ,i=4,6) /3.6, 2*05.2, 2.2/, ZCMP /(2.9,1.1)/

causes the following assignments:

L1=.TRUE.
L2=.TRUE.
ACHAR=123
BCHAR=123
CCHAR=12
INT=3
A(4)=5.2
A(5)=5.2
A(6)=2.2
ZCMP=(2.9,1.1)

56 3957 6053003
Section 6
Assignment Statements

The executable assignment statements allow an arithmetic, logical or character


expression, or a statement label to be assigned to a variable.

Arithmetic Assignment Statement


The arithmetic assignment statement permits real, double precision, complex, and
integer type variables or array elements to be assigned a value.

The format of an arithmetic assignment statement is as follows:

 <variable name>  =  <arithmetic expression> 


   
 <array element name>   <character expression> 

When an arithmetic expression is assigned to an arithmetic item, the arithmetic


expression is evaluated, and the value obtained is placed into the variable or array
element on the left of the equal sign.

When a character expression is assigned to an arithmetic item, the expression is


evaluated and the bit pattern represented by the resultant character string is assigned
to the item. Items of type INTEGER can hold a maximum of four characters. The value
is stored in the [31:32] bit field, and the bit field [47:16] contains zeros. REAL items can
hold a maximum of six characters while COMPLEX and DOUBLE PRECISION items can
hold a maximum of twelve characters.

When a character expression evaluates to a string with a length that exceeds that of
the element assigned, the string is truncated from the right. When the length of the
string is less than that of the element, the string is stored left-justified and filled on the
right with blank characters. If the element assigned is of type DOUBLE PRECISION or
COMPLEX and the string is less than or equal to six characters, these characters are
stored right-justified in the first word and the second word is zero. If the number of
characters assigned to a DOUBLE PRECISION or COMPLEX is greater than six and less
than twelve, the right-justification extends across two words. For example, DBLP =
'123456789' results in the DOUBLE PRECISION variable DBLP being assigned
Z000000F1F2F3F4F5F6F7F8F9 (hexadecimal representation assuming EBCDIC
characters).

3957 6053003 61
Assignment Statements

In general, the variable and the arithmetic expression need not be of the same type. If
the types are different, the expression is first evaluated and then converted to the
type of the variable. This conversion proceeds according to the rules indicated in Table
6-1.

Table 61. Arithmetic Conversion and


Assignment of Expression Variable

Type of variable Value Assigned

Integer INT(exp)
Real REAL(exp)
Double Precision DBLE(exp)
Complex CMPLX(exp)
Character CHARS(exp)

The functions in the "Value Assigned" column of the previous table are generic
functions as described in Section 12.

The following are arithmetic assignment statements:

D = E(3) - 2.5
F(2)= FCN(2,3) + 3.5*I

Logical Assignment Statement


The logical assignment statement is used to assign a value to a logical variable or array
element.

The format of a logical assignment statement is as follows:

 <variable name>  =  <logical expression> 


   
 <array element name>   <character expression> 

When a logical expression is assigned to a logical item, the logical expression is


evaluated and the resultant logical value is assigned to the variable or array element to
the left of the equal sign.

When a character expression is assigned to a logical item, the expression is evaluated


and the bit pattern represented by the resultant character string is assigned to the
item. Logical items can hold a maximum of six characters. When a character
expression evaluates to a string with a length greater than six, the string is truncated
from the right. When the length of the string is less than six, the string is stored
left-justified and filled on the right with blank characters.

62 3957 6053003
Assignment Statements

The following are examples of logical assignment statements where L1, L2, and L3 are
logical variables and A, B, and C are real variables:

L1 = L1 .AND. L2
L3 = A .GT. B .OR. B .LT. C
L2 = .TRUE.

Statement Label Assignment-ASSIGN Statement


The ASSIGN statement is used in conjunction with the assigned GO TO statement.

The format of the ASSIGN statement is as follows:

 ASSIGN  <label>  TO  <variable name> 

Executing the ASSIGN statement assigns a statement label to a variable. The label
must be that of an executable statement or a format statement that appears in the
same program unit as the ASSIGN statement. Executing the ASSIGN statement is the
only way to define a variable with a statement label value. The variable, once defined,
may be referenced in an assigned GO TO statement or as a format identifier in an
input/output statement. Until it has been reassigned with an arithmetic value, an
assigned variable must not be referenced in any other manner. It may be redefined
with a statement label or an arithmetic value at any time.

Examples of the ASSIGN statement:


ASSIGN 99 TO LA
GO TO LA, (1,2,99)

ASSIGN 10 TO FRMT
WRITE (5,FRMT)I
10 FORMAT (I3)

Character Assignment
The character assignment statement assigns a value to a character variable or
character substring.

The format of the character assignment statement is the following:

 <variable name>  =  <character expression> 


   
; <array element name>  ; <arithmetic expression> 
   
 <substring name>   <logical expression> 

When a character expression is assigned to a character item, the character expression


is evaluated, and the resultant value is assigned to the character variable, character
array element, or substring that is located to the left of the equal sign. None of the
character positions defined in the variable or substring may be referenced in the
expression and if they are, the result is undefined. If the variable and expression are of
different lengths, then the following rules are applied.

3957 6053003 63
Assignment Statements

If the length of the entity defined is greater than the length of the expression, the
entity is assigned the value of the expression and is left- justified. The remainder of
the entity is filled with blank characters. If the length of the variable is less than the
length of the expression, the expression is truncated from the right before it is
assigned to the variable.

The following are examples of character assignment statements for the declaration:
CHARACTER C1(5)*05, C2*02, C3*08

C3 = C1(1) // C2 // X
C1(1)(2:3) = A // C2
C2 = C3(1:2)

In a character assignment statement, when an arithmetic or logical expression


appears on the right of an equal sign, conceptually, the compiler creates a character
string that contains the exact bit pattern of the word or words representing the
arithmetic or logical expression. For reals and logicals, the length of the resulting
character string is six. For double precision and complex, the length is twelve
characters. For integers, the length is four characters, which are extracted from bits 31
through 0. This type conversion, from arithmetic/logical to character, produces the
same result as if the CHARS intrinsic function was used. That is,

CHARACTER *6 C CHARACTER *6 C
REAL X and REAL X
C = X C = CHARS (X)

are equivalent.

Note that the "created string" has the exact bit pattern as the arithmetic/logical item. It
is not a string representing the digits of the item's value. For example,

INTEGER I
CHARACTER *4 C
I= 193 ! I contains 0000000000C1 (in hex)
C = I ! C contains 000000C1 (in hex) that came from Is bits
! 31 through 0. This is ???A (in EBCDIC) where ?
! is the EBCDIC NULL character (00 hex value).
! Note that C does not contain 0193 (in EBCDIC).

In actuality, the compiler does not create a true physical character string for the
expression. The expression is evaluated and the bits from the resulting value are
transferred into the character item (which appears on the left side of the equal sign).
This transfer continues until the character item is filled. Blanks are padded on the end
if the value transferred is not large enough to fill the character item.

64 3957 6053003
Assignment Statements

Examples
REAL X
INTEGER I
DOUBLE NRECISION D
CHARACTER C4*4, C6*6, C10*10, C12*12
X = D1D2D3D4D5D6X ! X now contains D1D2D3D4D5D6 (in hex)
C6 = X ! C6 now contains JKLMNO (in EBCDIC)
C4 = X ! C4 now contains JKLM (in EBCDIC)
I = C1C2C3C4X ! I now contains 0000C1C2C3C4 (in hex)
C4 = I ! C4 now contains ABCD (in EBCDIC)
C6 = I ! C6 now contains ABCD (in EBCDIC)
D = STUVWX123456 ! D now has E2E3E4E5E6E7F1F2F3F4F5F6 (in hex)
C6 = D ! C6 now contains STUVWX (in EBCDIC)
C10 = D ! C10 now contains STUVWX1234 (in EBCDIC)
C12 = D ! C12 now contains STUVWX123456 (in EBCDIC)

3957 6053003 65
Assignment Statements

66 3957 6053003
Section 7
Control Statements

The executable control statements are used to alter the normal flow of program
execution. These statements may transfer control to another part of the program,
terminate or suspend execution, or control iterative processes.

The control statements consist of the following:

Unconditional GO TO
Assigned GO TO
Computed GO TO
Arithmetic IF
Logical IF
Block IF, ELSE IF, ELSE, END IF
DO
CONTINUE
PAUSE
STOP
END
CALL
RETURN

GO TO Statements
The executable GO TO statements transfer control from one point of an executing
program to another point in the same program unit.

Unconditional GO TO
The format for an unconditional GO TO statement is the following:

 GO TO  <label> 

For example, the statement GO TO 23 causes control to be transferred to the


statement whose label is 23.

3957 6053003 71
Control Statements

Assigned GO TO
The format for an Assigned GO TO statement is as follows:

 GO TO  <variable name> 


 
  ,  
   
 (  <label>  ) 
 
 , 

Executing this statement transfers control to the statement whose label was last
assigned to the variable by an ASSIGN statement in the same program unit as the
assigned GO TO statement. If the parentheses list is present, the statement label
assigned to the variable must be one of the statements in the list.

Examples:
ASSIGN 9 TO IJK
GO TO IJK, (9,1,2)

Control is transferred to the statement labeled 9.

ASSIGN 2 TO KI
GO TO KI

Control is transferred to the statement labeled 2.

Computed GO TO
The format for a computed GO TO statement is the following:

 , 
 
 GO TO  (  <label>  )  <integer expression> 
 
 , 

Executing this statement transfers control to a statement whose label appears in the
parentheses list or to the next executable statement following the GO TO statement.
How control is transferred depends on the value of the expression following the list.
The expression is evaluated and is used to select one of the labels in the list. If the
expression has the value n, control passes to the nth label in the list. If there are fewer
than n labels in the list or if n is less than or equal to zero, control passes on to the
next executable statement following the GO TO statement.

An example of a computed GO TO statement is the following:

GO TO (11,25,3,9,11,17), J+1

72 3957 6053003
Control Statements

At execution time, the value of J+1 is computed. If J+1=4, then control passes to the
statement labeled 9, the fourth label in the list. If J+1 is one or five in this example,
control passes to the statement labeled 11. If J+1 is less than one or greater than six,
control passes to the next executable statement after the GO TO statement.

IF Statements
Arithmetic IF
The arithmetic IF statement is a three-way branch.

The format for the arithmetic IF is as follows:

 IF  (  <arithmetic expression>  )  <label>  ,  <label>  , 4

4 <label> 

The same statement label may appear more than once in the IF statement. Execution
of the arithmetic IF statement causes the arithmetic expression within the
parentheses to be evaluated. Control is transferred to the statement bearing the first,
second, or third label, depending on whether the value of the expression is less than
zero, zero, or greater than zero, respectively.

Examples of arithmetic IF statements:


IF (I-J) 5,10,15

If I-J is negative, control is transferred to the statement labeled 5; if zero, to the


statement labeled 10; or if positive, to the statement labeled 15.

IF (J*05-B+2) 3,2,3

In this example, control passes to the statement labeled 2 only if the expression
within the parentheses is zero. Otherwise, control passes to the statement labeled 3.

Logical IF
The logical IF statement conditionally executes a statement.

The format of the logical IF statement is the following:

 IF  (  <logical expression>  )  <executable statement> 

Execution of the logical IF causes evaluation of the logical expression within


parentheses. If the logical expression is true, then the statement following the logical
expression is executed. If the logical expression is false, then the statement following
the logical expression is ignored and control passes on to the next executable
statement following the IF statement. The statement following the logical IF may not
be a DO, block IF, ELSE IF, ELSE, END IF, END, a DEBUG statement, or another logical IF
statement.

3957 6053003 73
Control Statements

Examples of logical IF statements:


IF (A.EQ.B) G=G+1

If A equals B, then G is incremented by one; otherwise, G remains unchanged. In any


event, control then passes on to the next statement.

IF (L1) GO TO 97

If L1 is true, then control passes to the statement labeled 97. If L1 is false, then control
passes on to the next statement.

IF (A.LE.97) IF (B) 12,12,13

If A is less than or equal to 97, then the arithmetic IF is executed, and control passes
on to statement number 12 or 13, depending on the value of B. If A is greater than 97,
control passes on to the next statement.

Block IF, ELSE IF, ELSE, END IF Statements


These statements facilitate the conditional execution of a statement or group of
statements.

Block IF
The block IF statement is used with the END IF statement and optionally the ELSE IF or
ELSE statements to control execution sequence. The block IF may have associated an
ELSE or an ELSE IF statement. Nevertheless, it must have a corresponding END IF
statement.

The format of the block IF statement is as follows:

 IF  (  <logical expression>  )  THEN 

The IF level of a statement is determined by the following calculation:

IF level = X1-X2

where X1 is the number of block IF statements from the beginning of the program unit
up to and including this statement, and X2 is the number of END IF statements in the
program unit up to, but not including, this statement.

Every statement must have an IF level greater than or equal to zero. Each block IF,
ELSE, ELSE IF, and END IF must have an IF level greater than zero.

74 3957 6053003
Control Statements

All the statements that appear following the block IF statement up to, but not
including the next END IF, ELSE, or ELSE IF that has the same IF level as the block IF
are called the IF block. An IF block may be empty. Execution of the block IF statement
causes evaluation of the logical expression contained in the statement. If the value of
the expression is true, normal execution sequence continues to the statements within
the IF block. If the IF block is empty, control is transferred to the next END IF
statement with the same IF level as the block IF statement. When the value of the
expression is false, control is transferred to the next ELSE IF, ELSE, or END IF
statement that has the same IF level as the block IF statement.

Transfer of control into an IF block from outside the IF block is not permitted. If
execution of the last statement in the IF block does not result in a transfer of control,
control is transferred to the next END IF statement that has the same IF level as the
block IF statement that precedes this IF block.

Block IF statements may be nested within IF blocks, ELSE blocks, or ELSE IF blocks.
The entire series of statements from the block IF through the END IF must be
contained within the block.

ELSE IF Statement
This statement is used optionally as the else part associated with a block IF statement.
It must have corresponding block IF and END IF statements and may optionally have
an else part of either an ELSE statement or another ELSE IF statement.

The format of the ELSE IF statement is as follows:

 ELSE IF  (  <logical expression>  )  THEN 

All of the statements appearing after the ELSE IF statement up to, but not including,
the next ELSE, ELSE IF, or END IF that has the same IF level as the ELSE IF are called
the ELSE IF block.

Execution of the ELSE IF statement causes evaluation of the logical expression in this
statement. If this value is true, execution continues to the first statement of the ELSE
IF block. If the value is true and the ELSE IF block is empty, control is passed to the
next END IF that has the same IF level as the ELSE IF statement. If the value of the
expression in the ELSE IF statement is false, control is transferred to the next ELSE IF,
ELSE, or END IF that has the same IF level as the ELSE IF statement.

If no statement within the ELSE IF block causes a transfer of control outside of the
ELSE IF block, control is transferred to the next END IF statement that has the same IF
level as the ELSE IF statement that precedes this ELSE IF block.

Transfer of control into an ELSE IF block is not permitted.

3957 6053003 75
Control Statements

ELSE Statement
This statement is used in conjunction with the block IF or ELSE IF statements.

The format of the ELSE statement is the following:

 ELSE 

All the statements following the ELSE statement up to, but not including the next END
IF statement with the same IF level as the ELSE statement are called an ELSE-block.
An END IF statement of the same IF level as the ELSE statement must appear before
the appearance of an ELSE IF or ELSE statement of the same IF level.

The ELSE statement functions like a CONTINUE statement; however, control may not
be transferred to an ELSE statement or into an ELSE block.

END IF Statement
The END IF statement functions like a CONTINUE statement. For each block IF
statement there must be a corresponding END IF statement in the same program unit.
The corresponding END IF statement is the next END IF statement that has the same
IF level as the block IF statement.

The format for the END IF statement is as follows:

 END IF 

The following examples of the block IF, ELSE IF, ELSE, and END IF statements are in
order of increasing complexity.

J=0
I=0
IF ( L1 ) THEN
I=1
J=2
END IF

After the preceding statements have been executed, if L1 is true, I=1 and J=2. If L1 is
false, I=0, and J=0.

IF ( L2 ) THEN
I=1
ELSE
I=2
END IF

In the preceding example, if L2 is true I is set equal to one. If L2 is false I is set equal
to two.

76 3957 6053003
Control Statements

X=0.0
Y=1.0
Z=5.0
IF (X .EQ. 0.0) THEN
Y=3.3
ELSE IF (Z .GT. 0.0) THEN
Y=2.1
END IF

After the preceding statements have been executed, X=0.0,Y=3.3, and Z=5.0.

DO Statement
The executable DO statement is a control statement that allows a series of
statements to be executed repeatedly while the value of a control variable is varied
between specified limits. The group of statements is referred to as a DO-loop.

The format for the DO statement is the following:

 DO  <label>  <variable name>  = 4


 
 , 

4 <arithmetic expression>  ,  <arithmetic expression> 4

4
 
 ,  <arithmetic expression> 

The DO-variable and arithmetic expressions must be of type integer, real, or double
precision.

The execution statement that follows the DO statement within the same program unit
and contains the label <label> is called the terminal statement of the DO-loop. The
three arithmetic expressions are referred to as the initial, terminal, and incremental
arguments, respectively. If the incremental argument is omitted, its value is assumed
to be one.

The DO statement causes repeated execution of the statements in its range. The
range of a DO statement consists of all the executable statements following the DO
statement up to and including the terminal statement specified in the DO statement.

The terminal statement of a DO-loop must not be an unconditional GO TO, assigned


GO TO, arithmetic IF, block IF, ELSE IF, ELSE, END IF, RETURN, END, or DO statement.

Any number of DO statements may be nested one within another with the following
restriction: if a DO statement occurs in the range of another DO, the range of the
former must be completely contained within the range of the latter. Both may,
however, specify the same statement as the terminal statement in their ranges.

3957 6053003 77
Control Statements

If a DO statement appears within an IF-block, ELSE IF-block, or ELSE-block, the range


of that DO-loop must be contained entirely within that IF-block, ELSE IF- block, or
ELSE-block, respectively. Also, if a block IF statement appears within the range of a
DO-loop, the corresponding END IF statement must appear within the range of that
DO-loop.

Transfer of control into the range of a DO-loop produces unreliable results. Changing
the value of the DO variable within a DO-loop has unspecified results. A DO-loop is
either inactive or active. A DO-loop is initially inactive and becomes active only upon
execution of the DO statement. Once active it becomes inactive when any of the
following occur:

1. Its iteration count is found to be equal to zero.


2. A RETURN, STOP, or END is executed within its range.
3. Control is transferred to a statement outside of the DO-loop range.
When a DO-loop becomes inactive the DO-variable retains its last value. Execution of
a DO-loop causes the following processing phases to take place:

1. Loop Initialization Processing


The initial terminal and incremental arguments of the DO-loop are established by
evaluating the respective expressions in the DO statement. The DO-variable is
assigned the value of the initial argument, and the iteration count is established.
The iteration count is calculated by the following expression where M1, M2, and
M3 are the initial, terminal, and incremental parameters:
MAX (INT((M2-M1+M3)/M3),0)

The iteration count is zero if (M1 > M2 and M3 > 0) or if (M1 < M2 and M3 < 0).
2. Loop Control Processing
This processing determines if further execution of the range should take place.
The iteration count is tested. If the iteration count is greater than zero, the range
of the loop is executed. If the iteration count is zero, the DO-loop becomes
inactive and the range of the DO is not executed. Execution continues with the
first executable statement following the terminal statement of the DO statement.
If some of the DO-loops sharing the terminal statement are active, execution
continues with the incrementation processing.
3. Execution of the Range
The statements within the range of the DO-loop are executed until the terminal
statement is reached. Incrementation processing follows. The DO-variable of the
DO statement may not be assigned a new value while the DO-loop is active.
4. Terminal Statement Execution
Execution of the terminal statement occurs as a result of the normal execution
sequence or as a result of transfer of control. Unless execution of the terminal
statement results in a transfer of control, execution then continues with
incrementation processing.

78 3957 6053003
Control Statements

5. Incrementation Processing
Loop incrementation for the active DO-loop whose DO statement was most
recently executed consists of two steps: The DO-variable is incremented by the
value of the incremental argument and the iteration count is decremented by one.
Following these two steps, execution continues with loop control processing of
the DO-loop whose iteration count was decremented.
It should be noted that because the iteration count test is done before executing the
range of the DO-loop the range of the DO-loop may not be executed at all.

Examples of DO-loops:
N=0
DO 101 I=1,10
J=I
DO 100 K=1,5
L=K
100 N=N+1
101 CONTINUE

After execution of these statements and at the execution of the CONTINUE


statement, I=11, J=10, K=6, L=5, and N=50.

N=0
DO 201 I=1,10
J=I
DO 200 K=5,1
L=K
200 N=N+1
201 CONTINUE

After execution of these statements and at the execution of the CONTINUE


statement, I=11, J=10, K=5, and N=0. L is not defined by these statements. Note that
the inner DO-loop is never executed.

In the following example Z is calculated as the sum of the cosines of -5.4, - 5.3, -5.2,
and -5.1:

Z=0
DO 10 X=-5.4,-5.05,.1
10 Z = COS(X) + Z

The following example initiates every other element of the arrays A and B, A(1)
through A(9) and B(1,1) through B(9,9):

IJ=10
DO 5 I = 1, IJ, 2
A(I)= 5.
DO 5 J = 1, IJ, 2
5 B(I,J)= 5.

3957 6053003 79
Control Statements

CONTINUE Statement
The executable CONTINUE statement produces no action. It is frequently used as the
terminal statement of a DO-loop.

The format for the CONTINUE statement is the following:

 CONTINUE 

Example:
.
.
.
DO 1 I=2,10,2
A(I)=I/M
IF (A(I)) 3,1,1
1 CONTINUE
M=-M
3 CONTINUE
.
.
.

In this example, the CONTINUE statement labeled 1 is used as the final statement of a
DO-loop and the CONTINUE statement labeled 3 is used as a transfer point for an
arithmetic IF statement. The use of the first CONTINUE allows the DO-loop to be
clearly delimited. The second CONTINUE statement allows transfer to an arbitrary
point in the program, the location of which may be changed by merely changing the
location of the CONTINUE statement.

PAUSE Statement
The executable PAUSE statement allows an executing program to be suspended
indefinitely.

The format for the PAUSE statement is as follows:

 PAUSE 


 
 <character constant> 
 
  
   
 /5\  <digit> 

Executing the PAUSE statement unconditionally suspends the program being


executed, pending operator action. In addition to suspending the program, executing
this statement causes the optional digits or character constant following the PAUSE to
be displayed at the terminal.

710 3957 6053003


Control Statements

The program may be resumed at the first executable statement following the PAUSE
statement by a system input message from the terminal of the form:

 <mix number>  OK 

Alternately, the task may be discontinued at this point by a system input message of
the form:

 <mix number>  DS 

If the program is run with CANDE, the ?OK and ?DS control commands may be used
for the system input commands listed previously.

Examples:
PAUSE
PAUSE 2
PAUSE BEFORE PUNCHING
PAUSE "BEFORE PUNCHING"

STOP Statement
The executable STOP statement allows termination of an executing program.

The format for the STOP statement is the following:

 STOP 


 
 <character constant> 
 
  
   
 /5\  <digit> 

The execution of the STOP statement causes termination of the program. In addition,
the optional digits or character constant following the STOP to be displayed at the
terminal.

Examples:
STOP
STOP 6
STOP "PHASE 1"

3957 6053003 711


Control Statements

END Statement
The END statement indicates the end of a program unit. When it is executed in a
function or subroutine subprogram, it has the effect of a RETURN statement. When it
is executed in a main program, it terminates the execution of the program.

The format of an END statement is the following:

 END 

The END statement must not be continued and must be an initial line. No other
statement may have an initial line that appears to be an END. The END statement must
be the last line of every program unit.

712 3957 6053003


Section 8
Input/Output Statements

Input statements provide a method for transferring data from peripheral hardware
devices (such as disk pack, magnetic tapes, and remote terminals) to internal storage
or from an internal file (type CHARACTER data) to internal storage. This process is
called reading.

Output statements provide the means of transferring data from internal storage to
external media or from internal storage to an internal file. This process is referred to
as writing. Some input/output (I/O) statements allow for editing of the data at the time
of the transfer.

In addition to the statements that transfer data, there are auxiliary I/O statements that
permit the positioning of peripheral devices and allow for the properties of the
external media to be specified or interrogated.

The following are data transfer I/O statements:

READ
WRITE
PRINT
PUNCH

The following are auxiliary I/O statements:

OPEN
CLOSE
INQUIRE
BACKSPACE
ENDFILE
REWIND
FIND
FILE
CHANGE

3957 6053003 81
Input/Output Statements

FORTRAN77 also allows the BNA (Burroughs Network Architecture) interface, PORT
files, to be used in formatted and list-directed I/O. Using unformatted I/O is not
permitted. The value PORT and all of the additional attributes and values for PORT and
SUBFILE interfacing are now recognized for the KIND attribute. For a detailed
description of PORT files and BNA, see the ClearPath Enterprise Servers
Input/Output Subsystem Programming Reference Manual.

Files
A FORTRAN77 program has access to a file by means of input/output statements.
Records may contain a sequence of values or a sequence of characters. A record that
is transferred with a formatted input/output statement is called a formatted record. It
is composed of a sequence of characters. A record that is transferred unformatted,
without editing specification, is called an unformatted record. An unformatted record
is a sequence of values in their internal machine representation. The values are
transferred from internal storage unchanged.

In addition to formatted and unformatted data records, there is an ENDFILE record. An


ENDFILE record is written by an ENDFILE statement. It may occur only as the last
record of a file and it does not have a length property.

The N records contained in a file are logically numbered in order from 1 through N;
record 1 immediately follows the initial point of the file, while record N immediately
precedes the endfile mark terminating the file.

There are two kinds of files, external and internal. External files are used to transfer
data to and from peripheral devices. Internal files provide a means of transferring data
from internal storage to internal storage.

An internal file has the following properties:

1. The file is a character variable, character array element, character array, or


character substring.
2. A record of an internal file is a character variable, character array element, or
character substring.
3. If the file is a character variable, character array element, or character substring, it
consists of a single record whose length is the same as the length of the variable,
array element, or substring respectively. If the file is a character array, it is treated
as a sequence of character array elements. Each array element is a record of the
file. The ordering of the records of the file is the same as the ordering of the array
elements in the array. Every record of the file has the same length, which is the
length of an array element in the array.
4. If the number of characters written in a record is less than the length of the
record, the remaining portion of the record is filled with blanks.
5. A variable, array element, or substring that is a record of an internal file may also
be used in a different context in the same FORTRAN77 program, for example, in a
character assignment statement.
6. An internal file is always positioned at the beginning of the first record prior to
data transfer.

82 3957 6053003
Input/Output Statements

At any given time, there is a set of files that are said to exist for a FORTRAN77
program. A file may be present on a system, yet not exist for a FORTRAN77 program
at a particular time. For example, security reasons may prevent a file from existing for
a given program. A file may exist and contain no records; an example of this is a newly
created file into which records have not been written. Creating a file causes a file to
exist that did not previously exist. Deleting a file terminates the existence of the file.
All input/output statements may refer to files that exist. INQUIRE, OPEN, CLOSE,
WRITE, PRINT, ENDFILE, and PUNCH statements may also refer to files that do not
exist.

FORTRAN77 provides two methods of accessing the data records of an external file:
sequential and direct (commonly called random). When a file is accessed sequentially,
the records are processed in sequence from the first record in the file through the
last. The direct access method allows for the access of records of a file in any order.
The records are accessed by means of their record numbers relative to their position
in the file. Note that internal files must be accessed sequentially only.

Units
A unit is a means of referring to a file. All unit numbers explicitly appearing in FILE
statements or in input/output statements (except INQUIRE) are said to exist for a
program. Unit numbers 5, 6, and 7 also always exist for a program regardless of being
referenced explicitly. In order to process an external file it is necessary that a file be
connected to a input/output unit. Unit numbers 5, 6, and 7 and unit numbers appearing
in FILE statements are preconnected.

A unit that is referenced somewhere in the program via a nonconstant expression


must be referenced explicitly somewhere else in the program. This explicit reference
may occur either in a FILE statement or an input/output statement.

All input and output statements may refer to units that exist. The INQUIRE and CLOSE
statements may also refer to units that do not exist.

Each unit identifier has a default device type associated with it. If a FORTRAN77
compilation is initiated through the Command and Edit Language (CANDE), units 5 and
6 are assigned a KIND of REMOTE. Otherwise, unit 5 is assigned a KIND of READER
and Unit 6 assigned a KIND of PRINTER. All other units are assigned a KIND of DISK by
default, including unit 7, which has historically been associated with punch card output
devices.

Note: Punch card output devices are no longer supported on ClearPath Enterprise
Servers.

A unit must not be connected to more than one file at the same time, and a file must
not be connected to more than one unit at the same time. However, means are
provided to change the status of a unit and to connect a unit to a different file. After a
unit and a file have been disconnected by the execution of a CLOSE statement, a unit
may be connected again within the same executable program to the same file or a
different file.

3957 6053003 83
Input/Output Statements

Each file is recognized by the system by two names: the internal name and the
external name or the value of the TITLE attribute of the file. (Refer to the ClearPath
Enterprise Servers Input/Output Subsystem Programming Reference Manual for
more information.)

The form of an internal file name is the following:

 FILE  <unit identifier> 

Where the unit identifier is greater than or equal to 0, less than or equal to 99, and
contains no leading zeros.

The internal file names corresponding to the units 6 and 99 are FILE6 and FILE99,
respectively.

The TITLE of a file consists of one to fourteen identifiers separated by slashes (/); each
identifier is one to seventeen characters long. When the TITLE of a program file is
unspecified, a default TITLE is assigned to the file that is identical to the internal file
name.

Data Transfer Input/Output Statements


The basic components of data transfer I/O statements are the control information list
and the input/output list.

Control Information List


The control information list may contain at most one of each of the following items,
separated by commas:

[UNIT =] u
[FMT=]f
[REC=]r
IOSTAT=i
ERR=s
END=s
SUBFILE=i
URGENT=l

The following are restrictions on the items in the control information list:

1. The list must contain exactly one unit specifier.


2. If the list contains a record specifier, it must not contain an end-of-file specifier, a
format specifier with a format identifier of asterisk, or a Subfile specifier.
3. A WRITE statement must not have an end of file specifier in its list.

84 3957 6053003
Input/Output Statements

4. If the unit specifier specifies an internal file, the list must contain a format
identifier other than an asterisk and must not contain a record specifier or a Subfile
specifier.
5. If the unit specifier was an asterisk, then a format specifier must be present, and
the record specifier must not be present.
6. If the Subfile specifier is present, then a format specifier must be present and
must not be an asterisk.
7. If the urgent specifier is present, then a format specifier must be present and
must not be an asterisk.
8. The urgent specifier is only valid with sequential formatted output statements to a
TCP subport.
The following paragraphs detail information on control list items. Examples may be
found following "READ, WRITE, PRINT, and PUNCH Statements".

Unit Specifier
The unit specifier designates the external unit to be used for the input/output
statement in which it appears.

The format of a unit specifier is the following:

 <unit identifier> 


 
 UNIT = 

If the optional characters UNIT= are omitted from the unit specifier, the unit specifier
must be the first item in a list of specifiers of an input/output statement. The unit
identifier can be either an internal file identifier or an external unit identifier. An internal
file identifier is used to refer to an internal file. It can be the name of a character
variable, character array, character array element, or character substring.

An external unit identifier is used to refer to an external file. It may be one of the
following:

1. An integer expression whose value is greater than or equal to zero and less than
or equal to 99. If the expression is not an integer constant, then, upon execution, it
is evaluated and rounded to the nearest integer.
2. (In READ or WRITE statements only) an asterisk, identifying unit 5 or 6, which are
preconnected for formatted sequential read or write, respectively.
In auxiliary input/output statements the asterisk form may not be used.

The external unit identified by a value is the same external unit in all program units of
the executable program, as shown in the following example:

SUBROUTINE A
READ (6) X
.
.

3957 6053003 85
Input/Output Statements

SUBROUTINE B
N=6
REWIND N

The value 6 used in both program units identifies the same external unit.

The following example is for an internal file identifier:

SUBROUTINE SUB
CHARACTER *14 CHAR
WRITE(CHAR,10) X
10 FORMAT(1X,F13.8)
.
.

Format Specifier
The format specifier designates the format to be used for the I/O statement in which
it appears.

The format of a format specifier is as follows:

 <format identifier> 


 
 FMT = 

A format identifier identifies a format. It must be one of the following:

1. The statement label of a FORMAT statement that appears in the same program
unit as the format identifier.
2. An integer variable name that has been assigned the statement label of a FORMAT
statement that appears in the same program unit as the format identifier.
3. An array name.
4. Any character expression, except a character expression involving concatenation
of an operand whose length specification is an asterisk in parentheses unless the
operand is the symbolic name of a constant. Note that a character constant is
permitted.
5. An asterisk, specifying list-directed formatting.
If the optional characters FMT= are omitted from the format specifier, the format
specifier must be the second item in the control information list and the first item
must be the unit specifier without the optional characters UNIT=.

Record Specifier
The record specifier is used to specify the number of the record that is to be read or
written with the I/O statement in which it appears.

The format of a record specifier is the following:

86 3957 6053003
Input/Output Statements

 <integer expression> 


 
 REC = 

If the optional characters REC= are omitted from the record specifier, the unit specifier
must appear without the optional characters UNIT=, and the unit specifier and record
specifier must be combined in the form:
ur
to form one list item, which must be the first item in the control information list.

The record number must have a value greater than or equal to 1 and less than or equal
to the number of records in the file for which the I/O is to be done.

Input/Output Status Specifier


The I/O status specifier provides information regarding the result of the I/O operation.

The format of the input/output specifier is the following:

 IOSTAT =  <integer variable name> 


 
 <integer array element name> 

Executing an input/output statement containing this specifier causes the specifier to


become defined:

1. With a zero value if neither an error condition nor an end-of-file condition is


encountered.
2. With a positive integer value if an error condition is encountered. IOSTAT is
interpreted by determining the class and subclass of the integer value where:
class = INT(IOSTAT/1000)*1000
subclass = MOD(IOSTAT,1000)

Class designates a general error condition and subclass a refinement of that general
error condition. The value of subclass only has meaning within a particular class. If
a class has no associated subclass (that is, MOD(IOSTAT,1000) .EQ. 0), then there
is no additional information available concerning the nature of the error. Table 8-1
shows valid class values and their associated subclasses.
3. With a negative integer value if an end-of-file condition is encountered and no
error condition is encountered.
If an I/O error or end-of-file condition occurs and no error or end-of- file specifier is
present, the presence of an I/O status specifier prevents termination of the program.
Execution continues with the next executable statement.

3957 6053003 87
Input/Output Statements

Table 81. Valid Class Values and Associated


Subclasses

Class Subclass Description

1000
I/O Status
00 Unknown error
10 Security error
30 Parity error
50 Bad subfile index
60 Broadcast write error
110 Break on datacomm output
120 I/O timeout
140 Data error
150 Record length error
2000 Open error
00 Unknown error
40 File already open
50 Bad subfile index
60 Open all error
70 Unsupported function
80 Unsupported protocol type
90 Protocol error
100 Lack of resources
110 File does not exist
120 Genealogy mismatch
130 Serial number mismatch
160 Pack not mounted
180 Unreachable host value
200 Host not in host group
210 Unauthorized for application group
220 BNA IPC unavailable
230 Bad attributes for open
240 Unavailable function
250 Unsupported INTMODE
260 Networking not supported

88 3957 6053003
Input/Output Statements

Table 81. Valid Class Values and Associated


Subclasses

Class Subclass Description

270 Disconnected during open


3000 Close error
00 Unknown error
40 File already closed
60 Close all error
50 Bad subfile index
100 Record count error
110 Block count error
120 Data lost

Error Specifier
The error specifier provides the ability to alter the execution sequence when an error
condition occurs during the execution of and I/O statement.

The format of an error specifier is as follows:

 ERR =  <label> 

If an I/O statement contains an error specifier and the processor encounters an error
condition during execution of the statement, execution of the I/O statement
terminates; if the I/O statement contains an I/O status specifier, the I/O specifier
becomes defined with a value corresponding to the error condition, and execution
continues with the statement label.

End-Of-File Specifier
The end-of-file specifier provides the ability to alter the execution sequence when an
end-of-file condition is encountered during an I/O statement.

The format of an end-of-file specifier is the following:

 END =  <label> 

If the end-of-file specifier appears in a READ statement, then control passes


automatically to the <label> when an end-of-file condition occurs in the absence of an
error condition. An end-of-file condition occurs when any of the following actions are
attempted by a READ or WRITE statement:

3957 6053003 89
Input/Output Statements

Statement Type of File Action Causing End-of-File Condition


READ CARD Attempting to read a card with an invalid
character in column 1.
READ TAPE Attempting to read an endfile record.
READ DISK Attempting to read a record beyond the last
record of a file.
WRITE DISK Attempting to write beyond the end of the
designated area of the disk file.
WRITE LINE PRINTER Attempting to write a record at end-of-page.
The PAGESIZE file attribute must be assigned
an appropriate value on a FILE system control
card, a file statement, or an OPEN statement.

If the conditions occur and the end-of-file specifier is missing, then execution of the
program is terminated unless an IOSTAT specifier is present.

Subfile Specifier
A program can, by specifying a subfile index, perform a read or write to a particular
subfile. FORTRAN77 currently allows subfiles to be specified for formatted I/O only.

The format of a subfile specifier is the following:

SUBFILE = <integer expression>

The subfile index specifies the subfile to be used for the read or write operation. If the
subfile index is omitted and MAXSUBFILES is equal to one, the I/O is performed on the
only subfile of the file. If a subfile index less than zero or greater than MAXSUBFILES is
specified, or no subfile index is specified and MAXSUBFILES is greater than 1, then the
program is terminated with an error. If a subfile index of zero is specified on a read, a
non-selective read is performed. The non-selective read permits reading of the next
message from any subfile. If a subfile of zero is specified for a write, the message is
broadcast to all open subfiles.

Urgent Specifier
If urgent is specified and its accompanying logical expression evaluates to true, then
the data is sent with urgent notification. The urgent specifier is only valid when
performing sequential formatted output to an external file. Any other usage causes a
syntax error. The urgent specifier is intended for TCP subports only and any other
usage has no effect on the execution of the program.

The format for the urgent specifier is as follows:

URGENT = <logical expression>

810 3957 6053003


Input/Output Statements

Input/Output List
The I/O list specifies the data entities to which or from which data is to be transferred.

An I/O list is a list of I/O list items and implied-DO lists. An input list item may be a
variable name, an array element name, an array name, or a character substring name.

An output list item may be a variable name, an array element name, an array name, a
character substring name or an expression. However, a character expression involving
concatenation of an operand whose length specification is an asterisk in parentheses
is not permitted unless the operand is the symbolic name of a constant.

Note that a constant, an expression involving operators or function references, or an


expression enclosed in parentheses may appear as an output list item, but must not
appear as an input list item.

I/O Implied-DO List


The format for an I/O implied-DO list is the following:

 (  <io list> , <DO variable> = <ae> , <ae>  ) 


 
 ,<ae> 
<io list>

? @ , A
 
B <expression> B
 
C <array name> 
 
 <io implied DO list> 

<ae>

 <integer constant expression> 

The range of an implied-DO list is the <io list>. Note that the list may contain
implied-DO lists. The iteration count and the values of the DO- variable are established
from <ae> statements exactly as for a DO-loop. In an input statement, the
DO-variable must not appear as an input list item.

Transfer of data to and from list elements occurs in the order in which they are named
in the I/O list, from left to right. Items named in an implied-DO I/O list are referenced
repeatedly until the implied- DO is satisfied. The appearance in an I/O list of an array
element specifies only that array element, while the appearance of an array name
specifies every element declared for the array in that program unit. These array
elements are transferred in the order in which they are stored internally.

3957 6053003 811


Input/Output Statements

The following are examples of I/O lists that may be used for input or output:

A,B(3)
XARRAY, XARRAY (2,4)
(A(J) , B , J , C(J,J) , J = 1,10,2)
(IPLOT , COUNT = 1,60)
(X, (Y(I,J), I=1,10), Z, J=1,2)
XARRAY(3), XARRAY, (XARRAY(EL), EL = 1,20)
RESULT
(A(I), I=1,20) , (J(I), I=1,5)
(((Z(I,J,K), K=1,10), J=1,10),I=1,10),A,G

The following are examples of I/O lists that may be used for output only:

1+COS(N) , X(1+N), G
A .OR. B
A, (J,GX(J), B, J=3,4),10,X
PARTA // PARTZ

READ, WRITE, PRINT, and PUNCH Statements


The READ statement is a data transfer input statement. The WRITE, PRINT, and
PUNCH are data transfer output statements.

The formats for the data transfer I/O statements are:

 READ  <format identifier> 


    
C WRITE   <io list>  
  
C PRINT  
  
C PUNCH  
 
C READ  ( <control information list> ) 
   
 WRITE   <io list> 

<control information list>

?@ , A
 
B /1\  <unit identifier> B
    
 C <combined expr>   , <format identifier> 
  
  UNIT =  <unit identifier> 
 
C /1\  FMT =  <format identifier> 
 
C /1\  REC =  <integer expression> 
  
  END =  <label> 
 
C /1\  ERR =  <label> 
 

812 3957 6053003


Input/Output Statements

C /1\  IOSTAT =  <integer variable name> 


  
  <integer array element name> 
 
C /1\  SUBFILE =  <integer expression> 
 
 /1\  URGENT =  <logical expression> 

<combined expression>

 <unit identifier> <integer expression> 

<io list>

?@ , A
 
B <expression> B
 
C <array name> 
 
 <io implied-DO list> 
<io implied-DO list>

 (  <io list> , <DO-variable> = <ae> , <ae>  ) 


 
 ,<ae> 
<format identifier>

 <label> 


 
C <variable name> 
 
C <array name> 
 
C <character expression> 
 
 * 

<unit identifier>

 <integer expression> 


 
C <variable name> 
 
C <array name> 
 
C <array element name> 
 
C <substring name> 
 
 * 

<ae>

 <integer constant expression> 

A data transfer statement that contains a control information list must include a unit
specifier that identifies an external unit or an internal file.

3957 6053003 813


Input/Output Statements

Data transfer statements that do not contain a control information list specify units 5,
6, and 7 by default, depending on which statement is used. For example, the READ
statement specifies unit 5. The WRITE statement and the PRINT statement specify
unit 6, and the PUNCH statement specifies unit 7.

A data transfer statement that does not contain a format specifier indicates that
unformatted I/O is to be performed. Unformatted output always results in whole
words. A character string with a length that is not an integral number of words is
padded with nulls to a word boundary in the output record. Unformatted I/O may not
be used with any file for which FILETYPE=6 and UNITS=CHARACTERS are specified.

The following are examples of the READ, WRITE, PRINT, and PUNCH statements. In
these examples 10, 95, and 99 are statement labels; 99 is used as the statement label
for error specifiers; 10 is the label on a format statement; and 95 is used as the
statement label for end-of-file specifiers. The 9 appearing in the following examples is
a unit specifier and the 3 is a record specifier.

READ (9,10,END=95)A
READ (ERR=99,UNIT=9,REC=3,FMT=10)A,B
WRITE (9)A,B
WRITE (93,10,ERR=99)A
WRITE (UNIT=9,FMT= (5X,I6,I9))A,B
PRINT 10
PUNCH 10, A, B

The following is an example of a read from the default unit 5.

READ(*,10,ERR=99)A

The following are two examples of list-directed write statements to the default unit 6.

WRITE(*,*)A,B
WRITE(IOSTAT=RESULT,UNIT=*,FMT=*)A,B

The following are examples of data transfer I/O statements from an internal file (type
character data) to internal storage (READ), and from internal storage (WRITE) to an
internal file.

DIMENSION IARY (10)


CHARACTER CRD*80
READ(CRD,FMT=10)(IARY(I),I=1,4)
10 FORMAT (2I6,56X,2I6)

In the preceding example the first twelve characters and the last twelve characters of
the variable CRD are transferred as four integer values into the four elements of the
array IARY. One record is read.

DIMENSION A(6)
CHARACTER X(6)*7
WRITE(X,FMT=15)A
15 FORMAT(I5)

814 3957 6053003


Input/Output Statements

In the preceding example six internal file records are written. The six elements of
array A are transferred into the six elements of array X. Each of the five character
values is left-justified in each element and the remaining two characters of each
element are blanks.

Auxiliary Input/Output Statements


OPEN Statement
An OPEN statement may be used to:

1. Connect an existing file to a unit.


2. Create a file that is pre-defined as connected to a unit.
3. Create a file and connect it to a unit.
4. Change certain attributes of the connection between a file and a unit.
The format of an OPEN statement is as follows:

?@ , A
 
 OPEN  ( B /1*\  <unit identifier> B ) 
   
  UNIT =  
 
C <file attribute specifier> 
 
C /1\  ERR =  <label> 
 
C /1\  FILE =  <character expression> 
 
C /1\  STATUS =  <character expression> 
 
C /1\  ACCESS =  <character expression> 
 
 /1\  FORM =  <character expression> 
 
C /1\  RECL =  <integer expression> 
 
C /1\  BLANK =  <character expression> 
 
C /1\  IOSTAT =  <integer variable name> 
  
  <integer array element name> 
 
C /1\  TITLE =  <character expression> 
 
C /1\  DISP =  <character expression> 
 
C /1\  SUBFILE =  <integer expression> 
 
C /1\  OPENTYPE =  <character expression> 
 
 /1\  MAXRECSIZE =  <integer expression> 

<file attribute specifier>

3957 6053003 815


Input/Output Statements

 <file attribute>  = Q


 
 (  <integer expression>  ) 

Q <attribute value> 

The list in the OPEN statement must contain a unit specifier and may contain at most
one of each of the specifiers ERR, FILE or TITLE, STATUS or DISP, ACCESS, FORM,
RECL or MAXRECSIZE, BLANK, IOSTAT, SUBFILE, and OPENTYPE. If a file is to be
connected for direct access, the RECL specifier must be used. In addition to the
specifiers explicitly named here, any legal file attribute as defined in the ClearPath
Enterprise Servers I/O Subsystem Programming Reference Manual may appear in the
OPEN statement.

The integer expression for a file attribute allows the attributes of a certain subfile to
become set. If a subfile index of zero is specified, the attribute assignment applies to
all subfiles in the file. If MAXSUBFILES is equal to one, the subfile index may be
omitted and the attribute assignment applied to the only subfile.

Table 82. OPEN Statement Specifiers

Specifier Description

fa=v Is a file attribute specifier. fa is a file attribute as


defined in the ClearPath Enterprise Servers I/O
Subsystem Programming Reference Manual. v is an
expression whose type and value are valid for the
associated file attribute. If v is an attribute mnemonic, it
must appear in quotation marks. If fa is a Boolean
(logical) attribute, and v is a logical constant, then v
must appear as .TRUE. or .FALSE.
[UNIT =] u Is an external UNIT specifier. This specifier is defined in
the control information list.
ERR=s Is an error specifier. This specifier is defined in the
control information list.
IOSTAT=i Is an I/O status specifier. This specifier is defined in the
control information list.
FILE=n n is a character expression whose value is the external
name of the file that is connected to the specified unit.
The character expression must be terminated with a
period.
TITLE=n TITLE is synonymous with FILE.
STATUS=sta sta is a character expression whose value, when trailing
blanks are removed, may be any one of the following
(UNKNOWN is the default):
OLD The referenced file is expected to exist. The
DEPENDENTSPECS is set to TRUE causing the format of
the records and the structure of the logical file to be
determined by the structure of the permanent file.

816 3957 6053003


Input/Output Statements

Table 82. OPEN Statement Specifiers

Specifier Description

NEW A new file is created.


SCRATCH A temporary file is created. This file exists only for the
execution of the program, or until a CLOSE statement is
executed.
EXTEND The referenced file is expected to exist. The
DEPENDENTSPECS attribute is set to TRUE, causing the
format of the records and the structure of the logical
file to be determined by the structure of the permanent
file. In addition, the file is positioned at the end. This
value is used to add records to the end of the file.
UNKNOWN This specification is the same as SCRATCH.
DISP=sta DISP is synonymous with STATUS.
ACCESS=acc acc is a character expression whose value, when
trailing blanks are removed, may be the following (if this
specifier is omitted, sequential access is assumed):
SEQUENTIAL File accessed sequentially.
DIRECT File accessed directly.
FORM=fm fm is a character expression whose value, when trailing
blanks are removed, may be the following (if this
specifier is omitted, UNFORMATTED is assumed if the
file has been connected for direct access and
FORMATTED is assumed if the file has been connected
for sequential access):
'FORMATTED' I/O formatted
'UNFORMATT I/O unformatted
ED'
RECL=l l is a positive integer expression. It specifies the length
of the file records. If the file is being connected for
direct access formatted I/O, the length is the number of
characters. If the file is being connected for direct
access unformatted I/O or sequential access I/O, the
length is measured in words unless the ANSI option is
set, in which case the length is measured in characters.
MAXRECSIZE=l MAXRECSIZE is synonymous with RECL.
BLANK=bl bl is a character expression whose value, when trailing
blanks are removed, may be the following (if this
specifier is omitted, a value of NULL is assumed):
'NULL' All blank characters in numeric formatted input fields on
the specified unit are ignored, except that a data field
of all blanks has a value of zero.
'ZERO' All blanks other than leading blanks are treated as zero.

3957 6053003 817


Input/Output Statements

Table 82. OPEN Statement Specifiers

Specifier Description

SUBFILE=i Specifies the subfile to be opened. i is an integer


expression whose value is the subfile index. If the
subfile index is zero, all subfiles with a file state of
closed are opened. If the subfile index is greater than
zero, and not greater than MAXSUBFILES, then only the
specified subfile is opened. If no subfile index is
specified and MAXSUBFILES is greater than one, an
error occurs. If no subfile index is specified and
MAXSUBFILES is equal to one, then the only subfile is
opened.
OPENTYPE=c c is a character expression whose value, when trailing
blanks are removed, may be any of the following:
'WAIT' Indicates that the subfile is offered for matching and
the program is suspended until a matching subfile is
found. WAIT is the default value.
'AVAILABLE' When used with files whose KIND is equal to PORT,
causes the subfile to be matched to a subfile that has
already been offered. If a match is found, the subfile is
opened. If no match is found, an error is returned and
the subfile is not left offered for subsequent matching.
When AVAILABLE is used with files whose KIND is not
equal to PORT, an attempt is made to open the file and
if the file cannot be opened, an error is returned and
the program continues execution.
'OFFER' Indicates that a subfile is offered for matching, but no
control is returned to the user without waiting for a
match to occur, and the open continues to be offered
until a match is found.

If a unit is connected to a file that exists, execution of an OPEN statement for that unit
is permitted. If the FILE specifier is not included in the OPEN statement, the unit
remains connected to the same file.

If the file specified in an OPEN statement does not exist, but is the same as the one to
which the input/output unit is preconnected, then the actions specified by the OPEN
statement are performed.

If the file to be connected to the unit is not the same as the one to which the unit is
connected, the effect is as if a CLOSE statement without a STATUS specifier had been
executed, followed by the OPEN statement.

If the file to be connected to the input/output unit is the same as the one to which the
unit is already connected, only the BLANK specifier may have a value different from
the one currently in effect. The position of the file is unaffected.

818 3957 6053003


Input/Output Statements

Execution of the OPEN statement causes the new specifier values to become
effective. Sequential files are repositioned to the beginning-of-file. If the file is
connected to a unit, execution of an OPEN statement for the same file and a different
unit is not permitted.

If a file is preconnected via a FILE statement and there is no explicit OPEN on that file,
specifiers that do not appear in the FILE statement have the same default values as if
the file had been connected via an OPEN statement.

With the exception of the AVAILABLE value for the OPENTYPE specifier, the SUBFILE
and OPENTYPE specifiers are ignored if used in an OPEN statement for a file with
KIND not equal to PORT.

Examples of the OPEN statement follow. ACSTYP is a character variable.

OPEN (UNIT=8, FILE=A/B., STATUS=OLD)


OPEN (3, STATUS=NEW, ACCESS=ACSTYP, RECL=185)
OPEN (5, BLANK=ZERO)

CLOSE Statement
The CLOSE statement is used to terminate the connection of a file to a unit.

The formats for the CLOSE statement are:

 CLOSE Q


Q <unit identifier> A
 
 ?@ , A 
   
 ( B /1*\  <unit identifier> B ) B
   
  UNIT =  
 
C /1\  ERR =  <label> 
 
C /1\  STATUS =  <character expression> 
 
C /1\  IOSTAT =  <integer variable name 
  
  <integer array element name> 
 
C /1\  DISP =  <character expression> 
 
 /1\  SUBFILE =  <integer expression> 

The list in the CLOSE statement must contain a unit specifier and may contain at most
one of each of the other specifiers.

3957 6053003 819


Input/Output Statements

Table 83. CLOSE Statement Specifiers

Specifier Description

[UNIT = ] u is an external UNIT specifier. A description of this specifier is


in the control information list definition.
ERR=s is an error specifier. A description of this specifier is in the
control information list definition.
IOSTAT=i is an I/O status specifier. A description of this specifier is in
the control information list definition.
STATUS=s is a status specifier whose value, when trailing blanks are
ta removed, may be the following. It determines the disposition
of the file that is connected to the specified unit.
'KEEP' If KEEP is specified for a file that exists, it continues to exist
after execution of the CLOSE statement.
'DELETE' If DELETE is specified, the file will not exist after execution of
the CLOSE statement.
'CRUNCH' If CRUNCH is specified, the file is closed, saved, and any
unused disk space after the end-of-file indicator is returned
to the system.
If this specifier is omitted, KEEP is assumed unless a status
specifier of SCRATCH has been previously defined, in which
case DELETE is assumed.
DISP=sta DISP is synonymous with STATUS.
SUBFILE=i specifies the subfile to be closed. If the subfile index
specified is zero, all opened subfiles are closed. If the subfile
index is greater than zero, but not greater than
MAXSUBFILES, only the specified subfile is closed. If a subfile
index is not specified and MAXSUBFILES is greater than one,
an error is returned. If a subfile index is not specified and
MAXSUBFILES is equal to one, the only subfile is closed.

Execution of a CLOSE statement need not occur in the same program unit as the
execution of an OPEN statement for that input/output unit. Execution of a CLOSE
statement for a unit that is not connected to any file is permitted and is ignored.

After a unit has been disconnected from a file by a CLOSE statement, it may be
connected again within the same FORTRAN77 program, either to the same file or to a
different file, and the file, if it still exists, may be connected again, either to the same
unit or to a different unit. At the end of execution of a FORTRAN77 program, all
existing connections between units and files are closed. The effect is the same as if a
CLOSE statement without a STATUS specifier were executed on each connected unit.

The SUBFILE specifier is ignored if the file used in the CLOSE statement has KIND not
equal to PORT.

820 3957 6053003


Input/Output Statements

Following are examples of the CLOSE statement: CHR is a character variable and IOST
is an integer variable.

CLOSE(UNIT=8,STATUS=KEEP,IOSTAT=IOST)
CLOSE(3,STATUS=DELETE,ERR=100)
CLOSE(UNIT=9,STATUS=CHR)

CHANGE Statement
The CHANGE statement is an auxiliary I/O statement that modifies the attributes of a
file or library. For libraries, the CHANGE statement may be used only before the library
is accessed.

The CHANGE statement format is the following:

?@ , A
 
 CHANGE  ( B /1*\  <unit identifier> B ) 
     
   UNIT =U   
   
 C <file clist>  
   
  <file attribute specifier>  
 
 <library id>  , <library clist> 

<file clist>
 /1\  IOSTAT=  <integer variable> 
 
C /1\  ERR=  <statement label> 
 
C /1\  FILE=  <character expression> 
 
C /1\  STATUS=  <character expression> 
 
 /1\  BLANK=  <character expression> 

<file attribute specifier>

 <file attribute>  = Q


 
 (  <integer expression>  ) 

Q <attribute value> 


<library id>

 <identifier> 

<library clist>
 /1\  TITLE=  <character variable> 
   
C /1\  LIBPARAMETER=   <character constant> 
 
 /1\  FUNCTIONNAME= 

3957 6053003 821


Input/Output Statements

The value of the integer expression for the file attribute specifies the subfile to be
used in the attribute assignment. If MAXSUBFILES is equal to one, the subfile index
may be omitted, and the attribute assignment applied to the only subfile. If a subfile
index of zero is specified, the assignment applies to all subfiles in the file.

Examples:
CHANGE (LIBID,TITLE=ABC)
CHANGE (7,MAXRECSIZE(2)=200)
CHANGE (UNIT=7,BLANK=NULL)

INQUIRE Statement
An INQUIRE statement may be used to determine the properties of a particular file or
a file connected to a particular I/O unit. All value assignments are done according to
the rules for assignment statements.

The INQUIRE statement may be executed before, during, or after a file is connected to
a unit. Current values of properties at the time the statement is executed are
returned.

There are two ways to specify the file to be queried: by FILE or by UNIT. If the user
specifies by FILE, the name or title of the file is used and the UNIT specifier may not
appear. If the user specifies by UNIT, the unit number is used and a FILE specifier may
not appear.

The format of the INQUIRE statement is as follows:

822 3957 6053003


Input/Output Statements

 INQUIRE  ( Q

?@ , A
 
QB /1*\  <unit identifier> B ) 
    
 C UNIT =   
   
  FILE =  <character expression>  
 
C <file attribute specifier> 
 
C /1\  ERR =  <label> 
 
C /1\  IOSTAT =  <integer variable name> 
   
C /1\  NUMBER =   <integer array element name> 
  
C /1\  RECL =  
  
C /1\  NEXTREC =  
 
C /1\  EXIST =  <logical variable name> 
   
C /1\  OPENED =   <logical array element name> 
  
C /1\  NAMED =  
 
C /1\  NAME =  <character variable name> 
   
C /1\  ACCESS =   <character array element name> 
 
C /1\  SEQUENTIAL = 
 
C /1\  DIRECT = 
 
C /1\  FORM = 
 
C /1\  FORMATTED = 
 
C /1\  UNFORMATTED = 
 
 /1\  BLANK = 

The FILE specifier has the same format as for the OPEN statement. The named file is
the file whose properties are being examined. It need not exist or be connected to a
unit.

The UNIT specifier has the same format as for the control information list. The UNIT
specified need not exist or be connected to a file. If it exists and is connected to a file,
the inquiry is being made about the properties of that file. (Exception: The EXIST
attribute refers to the unit itself, not to the connected file.) If the unit does not exist,
both EXIST and OPENED return false and other results are undefined.

3957 6053003 823


Input/Output Statements

<file attribute specifier>

 <file attribute>  = Q


 
 (  <integer expression>  ) 

Q <array element> 


 
 <variable> 

The integer expression for a file attribute specifies the subfile to be used when
accessing the attribute value. If MAXSUBFILES is equal to one, the subfile index may
be omitted, and the attribute access applied to the only subfile. If a subfile index of
zero is specified for attribute access, an attribute error occurs.

Table 84. INQUIRE Statement Inquiry Specifiers

Specifier Description

fa = v Is a file attribute specifier (Refer to the ClearPath Enterprise


Servers I/O Subsystem Programming Reference Manual.) v is a
variable or array element whose type corresponds to the type of
that attribute. Execution of an INQUIRE statement containing a file
attribute specifier causes the specified variable or array element to
be assigned the value of the associated attribute.
IOSTAT=i Is an I/O status specifier. A description of this specifier is in the
control information list definition.
ERR=s Is an error specifier. A description of this specifier is in the control
information list definition.
EXIST=ex ex is a logical variable or logical array element. Execution of the
INQUIRE statement for a file causes the variable ex to be assigned
the value true if the file exists; otherwise, ex is set to false.
Execution of the INQUIRE statement for a unit causes ex to be
assigned the value true if the specified unit exists; otherwise, ex is
set to false.
OPENED=op op is a logical variable or logical array element. Execution of the
INQUIRE statement for a file causes the variable op to be set to
true if the file is connected to a unit; otherwise, op is set to false.
Execution of the INQUIRE statement for a unit causes op to be set
to true if the specified unit is connected to a file; otherwise, op is
set to false.
NUMBER=n n is an integer variable or integer array element. If there is a unit
currently connected to the file, n is assigned the value of the
external unit identifier. If there is no unit connected, n is assigned
the value 999.
NAMED=nd nd is a logical variable or logical array element. It is always set to
true.
NAME=fn fn is a character variable or character array element. fn is assigned
the value of the file name.

824 3957 6053003


Input/Output Statements

Table 84. INQUIRE Statement Inquiry Specifiers

Specifier Description

ACCESS=acc acc is a character variable or character array element. acc is


assigned SEQUENTIAL or DIRECT according to the type of access
for which the file is connected. If the file is not connected to a unit,
acc is assigned the value "UNDEFINED."
SEQUENTIAL=seq seq is a character variable or character array element that is always
assigned the value YES.
DIRECT=dir dir is a character variable or character array element that is always
assigned the value YES.
FORM=fm fm is a character variable or character array element. If the file is
connected to a unit, fm is assigned FORMATTED or
UNFORMATTED, according to the type of access for which the file
is connected. If the file is not connected to a unit, fm is assigned
the value "UNDEFINED."
FORMATTED=fmt fmt is a character variable or character array element that is always
assigned the value YES.
UNFORMATTED=u unf is a character variable or character array element that is always
nf assigned the value YES.
RECL=rcl rcl is a integer variable or integer array element that is assigned the
value of the record length of the file connected for direct access. If
the file is being connected for direct access formatted I/O, the
length is the number of characters. If the file is being connected for
direct access unformatted I/O or sequential access I/O, the length
is measured in words unless the ANSI option is set, in which case
the length is measured in characters.
NEXTREC=nr nr is a integer variable or array element that is assigned the value
n+1, where n is the record number of the last record read or
written on the file connected for direct access. If the file is
connected, but no records have been read or written since the
connection, nr is assigned the value 1. If the file is not connected
for direct access, or if the position of the file is indeterminate
because of a previous error condition, nr becomes undefined.
BLANK=blnk blnk is a character variable or array element that is assigned a value
depending on the blank control in effect. The value 'NULL' is
assigned if null blank control is in effect for the file connected for
formatted input/output, and the value 'ZERO' is assigned if zero
blank control is in effect for the file connected for formatted
input/output. If there is no connection, or if the connection is not
for formatted input/output, blnk becomes undefined.

When an INQUIRE statement for a file is executed the inquiry specifiers NAMED,
NAME, SEQUENTIAL, DIRECT, FORMATTED, and UNFORMATTED become defined if
the file exists. Note that NUMBER becomes defined only if OPENED is true. Also,
ACCESS, FORM, RECL, NEXTREC, and BLANK become defined only if OPENED is true.

3957 6053003 825


Input/Output Statements

When an INQUIRE statement for a unit is executed, the inquiry specifiers NUMBER,
NAMED, NAME, ACCESS, SEQUENTIAL, DIRECT, FORM, FORMATTED,
UNFORMATTED, RECL, NEXTREC, and BLANK are assigned a value only if EXIST is true
and OPENED is true.

EXIST and OPENED always become defined unless an error condition occurs.

The following are examples of the INQUIRE statement. In the examples CHR1 and
CHR2 are character variables, NO and NXRC are integer variables and L1 and L2 are
logical variables.

INQUIRE (FILE=A/B., EXIST=L1, OPENED=L2, NUMBER=NO)


INQUIRE (UNIT=9, NAMED=L1, NAME=CHR1, NEXTREC=NXRC)
INQUIRE (6, BLANK=CHR1, FORM=CHR2)

BACKSPACE Statement
The executable BACKSPACE statement is an auxiliary I/O statement that allows a file
to be repositioned.

The format for the BACKSPACE statement is the following:

 BACKSPACE Q


Q <unit identifier> 
 
 ?@ , A 
   
 ( B /1*\  <unit identifier> B ) 
   
  UNIT =  
 
C /1\  ERR =  <label> 
 
 /1\  IOSTAT =  <integer variable name> 
 
 <integer array element name> 

Execution of a BACKSPACE statement causes the file connected to the specified unit
to be positioned before the preceding record. If there is no preceding record, the
position of the file is not changed. Note that if the preceding record is an endfile
record, the file becomes positioned before the endfile record.

Execution of a BACKSPACE statement containing an I/O status specifier causes the


integer variable name or integer array element name to become defined with a zero
value if no error condition exists, or with a positive value corresponding to an error
condition if one does exist.

The external unit specified by a BACKSPACE statement must be connected for


sequential access.

Backspacing over records written using list-directed formatting is prohibited.

The BACKSPACE statement might not reference line printer or remote files.

826 3957 6053003


Input/Output Statements

The following are examples of the BACKSPACE statement.

BACKSPACE 10
BACKSPACE(UNIT = 8, IOSTAT=IORSLT, ERR = 89)
BACKSPACE(9, ERR = 99)

ENDFILE Statement
The executable ENDFILE statement is an auxiliary I/O statement that writes an endfile
record for tapes, or updates the LASTRECORD attribute to the current file position for
disk files.

The format for the ENDFILE statement is the following:

 ENDFILE Q


Q <unit identifier> 
 
 ?@ , A 
   
 ( B /1*\  <unit identifier> B ) 
   
  UNIT =  
 
C /1\  ERR =  <label> 
 
 /1\  IOSTAT =  <integer variable name> 
 
 <integer array element name> 

Executing an ENDFILE statement for a tape file has the following actions: When an
ENDFILE statement follows an output statement, an endfile record is written as the
next record of the file. The file is then positioned after the endfile record. When an
ENDFILE statement follows an input statement, the tape is positioned at the start of
the next file on the tape. When an ENDFILE statement follows a REWIND statement or
another ENDFILE statement designating the same file, the ENDFILE statement is
ignored.

Executing an ENDFILE statement for a disk or pack file sets the LASTRECORD attribute
to the current record. An ENDFILE statement may be executed only if all of the
following are true:

1. The program has write ownership of the file (MYUSE = 'IO' or MYUSE = 'OUTPUT').
2. PROTECTION is not equal to 'PROTECTED'.
3. DUPLICATED and CRUNCHED are .FALSE.
4. No other logical file is currently assigned to the physical file.
No space is allocated or deallocated by use of the ENDFILE statement.

Only those records before the endfile record are considered to have been written;
only those records may be read during subsequent access of the file.

3957 6053003 827


Input/Output Statements

After execution of an ENDFILE statement, a BACKSPACE or REWIND statement must


be used to reposition the file prior to execution of any data transfer input/output
statement.

Execution of an ENDFILE statement for a file that is declared by a FILE statement, but
is not yet used (does not exist), creates the file.

Execution of an ENDFILE statement containing an I/O status specifier causes the


<integer variable> or <integer array element> to become defined with a zero value, if
no error condition occurs, or to be defined with a positive value corresponding to an
error condition if one does occur.

The following are examples of the ENDFILE statement:

ENDFILE (UNIT = 3)
ENDFILE 6
ENDFILE (4, ERR=49, IOSTAT=IORSLT)

REWIND Statement
The executable REWIND statement is an auxiliary I/O statement that allows a file to be
repositioned.

The format for the REWIND statement is as follows:

 REWIND Q


Q <unit identifier> 
 
 ?@ , A 
   
 ( B /1*\  <unit identifier> B ) 
   
  UNIT =  
 
C /1\  ERR =  <label> 
 
 /1\  IOSTAT =  <integer variable name> 
 
 <integer array element name> 

Executing a REWIND statement positions the specified file at its initial point. Note that
if the file is already positioned at its initial point, execution of this statement has no
effect on the position of the file.

Executing a REWIND statement for a file that is connected, but does not exist is
permitted, but has no effect.

Executing a REWIND statement containing an I/O status specifier causes it to become


defined with a zero value if no error condition exists, or with a positive value
corresponding to an error condition if one does exist.

828 3957 6053003


Input/Output Statements

The following are examples of the REWIND statement.

REWIND (UNIT = 9)
REWIND 9
REWIND (3, ERR=39, IOSTAT=IORSLT)

FIND Statement
The FIND statement is used to position a direct access file at a specified record.

The format of the FIND statement is the following:

 FIND  (  <findlist>  ) 


<findlist>

 <unit identifier>  ,  REC = <integer expression> 


  
C UNIT =  
 
C REC =  <integer expression>  ,  UNIT =  <unit identifier> 
 
 <unit identifier>   <integer expression> 

Executing a FIND statement positions the designated file before the specified record.

The following examples all position unit 5 to record number 7.

FIND (5, REC=7)


FIND (UNIT=5, REC=7)
FIND (REC=7, UNIT=5)
FIND (57)

FILE Statement
A FILE statement declares a unit and assigns values to certain specifiers and to file
attributes for the unit. The word FILE must appear in columns 1 through 4 of the file
declaration. A minimum of two blanks must follow the word FILE so that the unit
identifier begins in at least column 7.

The format of a FILE declaration is as follows:

3957 6053003 829


Input/Output Statements

 FILE  <unit identifier>  (  <file list>  ) 

<file list>

?@ , A
 
B <file attribute specifier> B
 
C /1\ FILE = <character expression> 
 
C /1\ STATUS = <character expression> 
 
C /1\ ACCESS = <character expression> 
 
C /1\ FORM = <character expression> 
 
C /1\ RECL = <integer expression> 
 
 /1\ BLANK = <character expression> 

<file attribute specifier>


 <file attribute>  = <attribute value> 

The file attribute in a file attribute specifier may be any legal file attribute as defined in
the ClearPath Enterprise Servers I/O Subsystem Programming Reference Manual. A
full description of FILE, STATUS, ACCESS, FORM, RECL, and BLANK specifiers can be
found with the OPEN statement. In the FILE statement the expressions used for these
specifiers are restricted to logical constant expressions, character constant
expressions, integer constant expressions, or whatever is the appropriate constant
expression for the specifier.

Table 85. FILE Statement Specifiers

Specifier Description

fa = v is a file attribute specifier. The definition of this specifier is with the


OPEN statement definition.
FILE = n is a file name specifier. The definition of this specifier is with the OPEN
statement definition.
STATUS = sta is a STATUS specifier. The definition of this specifier is with the OPEN
statement definition, except that the value EXTEND is not valid in a FILE
statement.
ACCESS =acc is an ACCESS specifier. The definition of this specifier is with the OPEN
statement definition.
FORM = fm is a FORM specifier. The definition of this specifier is with the OPEN
statement definition.
RECL =l is a RECL specifier. The definition of this specifier is with the open
statement definition.
BLANK = bl is a BLANK specifier. The definition of this specifier is with the OPEN
statement definition.

830 3957 6053003


Input/Output Statements

FILE statements may be used either at the very beginning of a program or between
program units. They may also appear as the first statements in a BLOCK GLOBALS
subprogram. Except for BLOCK GLOBALS subprograms, file statements may not
appear within any program unit, including the main program. Thus, they must be used:

1. Before any other statements in the overall program.


2. Just after a BLOCK GLOBALS statement.
3. Just after an END statement.

A given file statement applies to the entire program unless the compiler option
SEPARATE is set. If SEPARATE is true, the file statement applies only to all program
units appearing after it. If a file number corresponding to the unit identifier in a given
file statement has been referenced earlier in the program as a compile time constant
unit identifier, an error message is issued. The error occurs because the first use of
such a file number constitutes an implicit declaration of the file. It is, however, legal to
specify a file unit identifier with a NONCONSTANT expression at a program location
before the file statement that declares that file. In such a case, if SEPARATE is not set,
the unit is associated at run time with the explicitly declared file, regardless of the fact
that the file's declaration comes below its use.

Also note that when a non-constant file unit identifier is used in the program, files 5, 6,
and 7 become implicitly defined if they have not already been used or declared. These
files may not be redefined with a file statement later in the source code.

The following are some examples of the FILE statement.

FILE 3(FILE="WRS/1.",STATUS="OLD",KIND="DISK",RECL=30, ACCESS="DIRECT")


FILE 4(KIND="REMOTE", MYUSE="IO")
FILE 6(KIND="PETAPE",MAXRECSIZE=45,BLOCKSIZE=45,BLANK="ZERO")

3957 6053003 831


Input/Output Statements

832 3957 6053003


Section 9
Format Specifications

Format specifications are used in conjunction with formatted input/output statements


to provide information that directs the editing between the internal representation of
data and the character strings of a record or a sequence of records in a file.

A format may be specified explicitly or it may be specified implicitly as a list-directed


format (by supplying an asterisk). A format is specified explicitly in a FORMAT
statement or as the value stored in an array or a character expression.

FORMAT Statement
The form of a FORMAT statement is the following:

 <label>  FORMAT  <format specification> 

<format specification>

 (  ) 


 
  , ! 
   
"# <format specifier> #$

The forms of the format specifiers are:

[r]ed
ned
[r]fs

where:

ed is a repeatable edit descriptor


ned is a non repeatable edit descriptor
fs is a non-empty format specification
r is a nonzero unsigned, integer constant called a repeat specification

The comma used to separate the items of the format specification may be omitted
before or after a slash, before or after a colon edit descriptor, or between a P edit
descriptor and an immediately following F, E, D, or G edit descriptor.

3957 6053003 91
Format Specifications

Format control is initiated at the beginning of a formatted I/O statement. Each action
of format control depends jointly on the next edit descriptor of the current format
specification and the next item in the I/O list, if one exists.

If an input/output list specifies at least one list item, at least one repeatable edit
descriptor must exist in the format specification. Note that an empty format
specification of the form ( ) may be used only if no list items are specified. In this case,
one input record is skipped or one blank line is written. Except for an edit descriptor
preceded by a repeat specification, r ed, or a format specification preceded by a
repeat specification, r(flist), a format specification is interpreted from left to right. A
format specification or edit descriptor preceded by a repeat specification r is
processed as a list of r format specifications or edit descriptors. Note that an omitted
repeat specification is treated in the same manner as a repeat specification whose
value is 1.

For each repeatable edit descriptor interpreted in a format specification, there


corresponds one item specified by the I/O list. (A list item of type complex requires
the interpretation of two F, E, D, or G edit descriptors.) For each P, X, T, TL, TR, S, SP,
SS, H, BN, BZ, slash, colon, quote, or apostrophe edit descriptor, there is no
corresponding item specified by the input/output list, and format control
communicates information directly with the record.

Whenever format control encounters a repeatable edit descriptor in a format


specification, it determines whether there is a corresponding item specified by the
input/output list. If there is such an item, it transmits appropriately edited information
between the item and the record, and then format control proceeds. If there is no
corresponding item, format control terminates.

If format control encounters the right-most parenthesis of a complete format


specification and another list item is not specified, format control terminates.
However, if another list item is specified, the file is positioned at the beginning of the
next record and format control then reverts to the beginning of the format
specification terminated by the last preceding right parenthesis. If there is no such
preceding right parenthesis, format control reverts to the first left parenthesis of the
format specification. If such reversion occurs, the reused portion of the format
specification must contain at least one repeatable edit descriptor. If format control
reverts to a parenthesis that is preceded by a repeat specification, the repeat
specification is reused. Reversion of format control, in itself, has no effect on the scale
factor, the S, SP, or SS edit descriptor sign control, or the BN or BZ edit descriptor
blank control.

Carriage Control
Any record that is to be output to a line printer or remote file must contain a
prescribed carriage control character in its first character position. This character is not
output, but is interpreted as follows:

92 3957 6053003
Format Specifications

blank Single space


0 Double space
1 Page eject
+ No line feed
Digit 2-9 Advance to channel n
$ Suppress carriage control at end of line (used for prompting)
Any other character in the first character position is ignored, and single spacing is
assumed.

All carriage spacing indicated by the carriage control character is performed prior to
output of the line.

Edit Descriptors
Edit descriptors are used to specify the form of a record and to direct the editing
between the characters in a record and the external representation of data.

An edit descriptor is either a repeatable descriptor or a non-repeatable edit descriptor.

The repeatable edit descriptors are:

I Integer Editing
J Integer Editing
F Real/Double Precision, Complex Editing
E Real/Double Precision, Complex Editing
D Real/Double Precision, Complex Editing
G Real/Double Precision, Integer, Logical, Complex Editing
O Octal Editing
L Logical Editing
A Character Editing
Z Hexadecimal Editing

The non-repeatable edit descriptors are:

Quote

Apostrophe

Hollerith

T, TL, TR Positional Editing

X Positional Editing

3957 6053003 93
Format Specifications

/ Current Record Termination

Colon Format Termination

S, SP, SS Optional Plus Characters

P Scale Factor

BN, BZ Blank Editing

K Optional Commas

$ Optional $

In the following description, a field is a part of a record that is read on input or written
on output when format control processes an I, J, E, F, D, G, O, L, A, H, apostrophe, or
quote edit descriptor. The field width is the size in characters of the field.

Apostrophe and Quote Editing


The apostrophe and quote edit descriptors function in exactly the same way; they
have the form of a character constant.

On output, the characters (including blanks) enclosed between the delimiters


(apostrophe or quote) are written to the output media. The number of characters
between the delimiters must be greater than zero and less than or equal to 255.

The apostrophe and quote edit descriptors are not allowed on input.

The following are examples of apostrophe and quote editing on output:

Specification External String


'ABCD' ABCD
'ISN''T' ISN'T
"GHIJK" GHIJK
'QUOTE CHARACTER " ' QUOTE CHARACTER "

H Editing
The form of the H edit descriptor is the following:

nHh1h2h3...hn

where:

h is a valid EBCDIC character


n is an unsigned, nonzero integer

94 3957 6053003
Format Specifications

On output, the H edit descriptor causes character information to be written from the n
characters (including blanks) following the H of the edit descriptor.

The H edit descriptor is not allowed on input.

Note that if an H edit descriptor occurs within a character constant and includes an
apostrophe, the apostrophe must be represented by two consecutive apostrophes,
which are counted as one character in specifying the number of characters of the H
edit descriptor.

The following are examples of H editing on output:

Specification External String


5HX ABC X ABC
1H5 5
3H'B' 'B'

Positional Editing
The T, TL, TR, and X edit descriptors specify the position at which the next character
will be transferred to or from the record. These descriptors do not cause characters to
be transmitted. If characters are transmitted to positions at or after the position
specified by these edit descriptors, positions skipped remain unchanged. On output,
characters already filled may be replaced using positional editing. If a positional edit
descriptor specifies a position beyond the end of the current record, no error occurs;
however, if data transfer is attempted to or from such a position, a record overflow
error occurs.

T, TL, and TR Editing


The form for the T, TL, TR edit descriptors is the following:

Tc
TLc
TRc

where c is an unsigned, nonzero integer constant.

The Tc edit descriptor indicates that the transmission of the next character to or from
a record is to occur at the cth character position. Note that for printed output the first
print position is used for carriage control; therefore, character position c is actually
print position c-1.

The TLc edit descriptor indicates that the transmission of the next character to or from
the record is to occur at the character position c characters backward from the current
position. However, if the current position is less than or equal to position c, the TLc
edit descriptor indicates that the transmission of the next character to or from the
record is to occur at position 1 of the current record.

3957 6053003 95
Format Specifications

The TRc edit descriptor indicates that the transmission of the next character to or
from the record is to occur at the character position c characters forward from the
current position.

X Editing
The form for the X edit descriptor is as follows:

[n]X

where n is an unsigned, nonzero integer constant.

If n is omitted, 1 is implied. The X edit descriptor indicates that the transmission of the
next character to or from a record is to occur at the position n characters forward
from the current position.

Example (for T, TL, TR and X editing):


CHARACTER*6 A,B,C
READ (5,10) A,B,C
10 FORMAT (2X, TR5, A6, T4, A6, TL3, A6)
WRITE (6,20) A,B,C
20 FORMAT (3(2X,A6))
END

Input: ABCDEFGHIJKLMN
Output: HIJKLM DEFGHI GHIJKL

Slash Editing
The slash edit descriptor indicates the end of data transfer on the current record.

On input from a file connected for sequential access, the remaining portion of the
current record is skipped and the file is positioned at the beginning of the next record.
This record becomes the current record. Note that an entire record may be skipped on
input. For a file connected for direct access, the record number is increased by one,
and the file is positioned at the beginning of the record that has that record number.
This record becomes the current record.

On output, if the file is an internal file or a file connected for direct access, the record
is filled with blank characters. On output to a file connected for sequential access, a
new record is created and becomes the last and current record of the file. Note also
that a record of all blank characters may be written on output.

Colon Editing
The colon edit descriptor terminates format control if there are no more items in the
input/output list. It has no effect if there are more items in the list.

96 3957 6053003
Format Specifications

S, SP, and SS Editing


The S, SP, and SS edit descriptors may be used to control optional plus characters in
numeric output fields. At the beginning of execution of a formatted output statement,
standard numeric output fields do not include a plus sign. If the SP edit descriptor is
encountered in a format specification, the optional plus is generated in any position
that normally contains an optional plus. If an SS edit descriptor is encountered, then
the optional plus is not generated in each subsequent position that normally contains
an optional plus. If an S edit descriptor is encountered, the standard option of not
producing a plus sign is again established.

These descriptors affect only I, J, E, F, D, and G editing on output. They have no effect
during the execution of an input statement.

Example (for slash, colon, S, SP, and SS editing):


X=34.5
Y=+56.0
Z=-78.9
WRITE (6,1) X,Y,Z,X,Y,Z
WRITE (6,2) X,Y,Z
1 FORMAT (SP,3(2X,F7.2),/,S,3(2X,F7.2))
2 FORMAT (SS,3(2X,F7.2):,"THIS SHOULDNT BE PRINTED")
END

The execution of the preceding example produces the following output:

+34.50 +56.00 -78.9


34.50 56.00 -78.9
34.50 56.00 -78.9

P Editing
The P edit descriptor specifies a scale factor to be used for scaling numbers that are
input and output using F, E, D, and G edit descriptors.

The format of the P edit descriptor is as follows:

kP

where

k is an optionally signed integer constant called the scale factor.

The value of the scale factor is zero at the beginning of execution of each I/O
statement. Once encountered, a scale factor applies to all subsequently interpreted F,
E, D, and G edit descriptors until another scale factor is encountered.

3957 6053003 97
Format Specifications

The scale factor affects editing in the following manner:

1. On input, with F, E, D, and G editing, the scale factor has no effect if there is an
exponent part in the input field.
2. On input, with E, D, G and F editing, the effect of the scale factor is as follows:
external quantity=internal value*(10**k)
3. On output, with E and D editing, the scale factor does not affect the external
value. It affects the positioning of the decimal point in the output field. The real
constant part of the output value is multiplied by 10**k and the exponent is
reduced by k.
4. On output, with G editing, the scale factor is suspended if F editing is to be used.
If E editing is to be used, the scale factor has the same effect as it does with E
editing.
5. On output F editing the effect of the scale factor is as follows:
external quantity=internal value*(10**k)
The following are examples of the scale factor usage:

Edit Descriptor Internal Value Input/Output Field


column 1234567890
s
INPUT 2PF5.1 12.345 12345
2PE5.1 12000. 1.2E4
2PG10.2 .1234 1234
-PF6.2 123.4 1234
OUTPUT 2PF10.2 1.234 123.40
-2PF10.2 1.234 0.01
1PE10.2 1.234 1.23E+00
-1PE10.2 1.234 .01D+02

BN and BZ Editing
The BN and BZ edit descriptors may be used to specify the interpretation of blanks,
other than leading blanks, in numeric input fields. At the beginning of execution of
each formatted input statement, such blank characters are interpreted as zeros or are
ignored, depending on the value of the BLANK= specifier currently in effect for the
unit. The BN and BZ edit descriptors override the BLANK file attribute. If a BN edit
descriptor is encountered in a format specification, all such blank characters in
succeeding numeric input fields are ignored. The effect of ignoring blanks is to treat
the input field as if blanks had been removed, the remaining portion of the field
right-justified, and the blanks replaced as leading blanks. However, a field of all blanks
has the value zero. If a BZ edit descriptor is encountered in a format specification, all
such blank characters in succeeding numeric input fields are treated as zeros.

98 3957 6053003
Format Specifications

The BN and BZ edit descriptors affect only I, F, E, D, and G editing during execution of
an input statement. They have no effect during execution of an output statement.

Numeric Editing
The I, J, F, E, D, and G edit descriptors are used to specify input/output of integer,
real, double precision, and complex data. The following general rules apply:

1. On input, leading blanks are not significant. The interpretation of blanks, other than
leading blanks, is determined by a combination of any BLANK= specifier and any
BN or BZ blank control that is currently in effect for the unit. Plus signs may be
omitted. A field of all blanks is considered to be zero.
2. On input, with F, E, D, and G editing, a decimal point appearing in the input field
overrides the portion of an edit descriptor that specifies the decimal point location.
3. On output, positive or zero internal values may be prefixed with a plus sign, as
controlled by the S, SP, and SS edit descriptors. The representation of a negative
internal value in the field is prefixed with a minus sign.
4. On output, the representation of numeric data is right-justified in the field. If the
number of characters produced by the editing is smaller than the field width,
leading blanks are inserted in the field.
5. On output, if the number of characters produced exceeds the field width or if an
exponent exceeds its specified length using the Ew.dEe or Gw.dEe edit descriptor,
asterisks are placed in the entire field width.
Complex data, because it consists of a pair of real values, requires two successive F,
E, D, or G edit descriptors. The first of the edit descriptors specifies the real part; the
second specifies the imaginary part. The two edit descriptors may be different. Note
that non-repeatable edit descriptors may appear between the two successive F, E, D,
or G edit descriptors.

I Editing
The I edit descriptor is used for editing integer data.

The forms for the I edit descriptors are:

Iw
Iw.m

where:

w is a nonzero, unsigned, integer constant denoting field width


m is an unsigned integer constant denoting the minimum number of
digits required on output.

On input, an Iw.m edit descriptor is treated identically to an Iw edit descriptor. In the


input field, the character string must be in the form of an optionally signed integer
constant, except for the interpretation of blanks.

3957 6053003 99
Format Specifications

The output field for the Iw edit descriptor consists of zero or more leading blanks
followed by a minus if the value of the internal data is negative, or an optional plus,
followed by the magnitude of the internal value in the form of an unsigned integer
constant without leading zeros. Note that an integer constant always consists of at
least one digit. I format allows floating-point data for output, but not for input. It
rounds a floating-point number before printing.

The output field for the Iw.m edit descriptor is the same as for the Iw edit descriptor,
except that the unsigned integer constant consists of at least m digits and, if
necessary, has leading zeros. The value of m must not exceed the value of w. If m is
zero and the value of the internal data is zero, the output field consists of only blank
characters, regardless of the sign control in effect.

The following are examples of the I edit descriptors:

List Type Edit Internal Input/Output Field


Descriptor Value
column 12345678
s 9
OUTPUT Integer I6 1259839 ******
Integer I3 2 2
Integer I9.3 11 011
Integer I5 -23 -23
Real I3 +78.2 78
Real I6 -567 -567
INPUT Integer I4 123 123
Integer I2 -1 -1
Integer I5 21000 21000
Real* I7 27 27
* Assuming that the value of the BLANK= specifier for this file is NULL. Note that is
is the default.

J Editing
The J edit descriptor is specified for editing integer data. The form for the J edit
descriptor is the following:

Jw

where

w is a nonzero, unsigned, integer constant denoting field width.

On input, the J edit descriptor behaves exactly like the Iw format specification.

910 3957 6053003


Format Specifications

On output, the Jw format specification writes the value of the corresponding I/O list
element to be printed as an integer constant in the minimum field necessary to
contain the value without exceeding the field width w. The plus sign is not printed for
non-negative quantities. If the value to be printed requires more than w characters, w
asterisks are output. Floating-point values are rounded to an integer value before
being output.

Examples

Edit Internal Output Field


Descripto Value
r
columns 12345678901234
5
J5 +23 23
J5 -23 -23
J3 +233 233
J3 -233 ***
J3 0 0
J3 3.6 4

F Editing
The F edit descriptor is specified for editing integer, real, double precision, and
complex data.

The form for the F edit descriptor is the following:

Fw.d

where

w is a nonzero, unsigned, integer constant denoting field width, and


d is the number of digits in the fractional part.

On input, the input field should consist of an optional sign, followed by a string of
digits optionally containing a decimal point. If the decimal point is omitted, the
right-most d digits of the string, with leading zeros assumed if necessary, are
interpreted as the fractional part of the value represented. The basic form may be
followed by an exponent of one of the following forms:

1. Signed integer constant.


2. E followed by zero or more blanks, followed by an optionally signed integer
constant.
3. D followed by zero or more blanks, followed by an optionally signed integer
constant.

3957 6053003 911


Format Specifications

An exponent containing a D is processed in the same manner as an exponent


containing an E.

On output, the field consists of blanks, if necessary, followed by a minus if the internal
value is negative, or an optional plus, followed by a string of digits that contains a
decimal point and represents the magnitude of the internal value, as modified by the
established scale factor and rounded to d fractional digits. Leading zeros are not
permitted, except for an optional zero immediately to the left of the decimal point if
the magnitude of the value in the output field is less than one. The optional zero must
appear if there would otherwise be no digits in the output field.

Examples

List Type Edit Internal Input/Output Field


Descripto Value
r
columns 12345678
9
OUTPUT Real F7.3 36.7929 36.793
Real F9.3 36.7934 36.793
Real F6.3 -.0316 -0.032
Real F4.2 579.645 ****
Real F6.2 579.645 579.65
Integer F9.4 -100 -100.0000
INPUT Real F8.4 3672.5931 36725931
Real F10.2 3.672593 3.672593
Real F11.1 -367259. -367259.
Real F9.3 -367200. -3672.E2
Real F8.4 .3672 3.672E-1
Real F7.2 -34.56 -3456
Integer F6.3 +42 42.14

E and D Editing
The E and D edit descriptors are specified for editing integer, real, double precision,
and complex type data.

The form for D and E edit descriptors is as follows:

Ew.d
Ew.dEe
Dw.d

912 3957 6053003


Format Specifications

where:

w is a nonzero, unsigned, integer constant denoting field width


d is an unsigned integer constant denoting the fractional part
e is a nonzero, unsigned, integer constant denoting the number of digits in
the exponent part. The e has no effect on input.

On input, the field should consist of an optional sign followed by a string of digits
optionally containing a decimal point and exponent. If the decimal point is omitted, a
decimal point is implied d places to the left of the E or D denoting the exponent, or if
there is no exponent, d places from the right edge of the input field.

The form of the output field for a scale factor of zero is as follows:

[+ or -] [0] . x1x2...xd exp

where

+ signifies a plus sign


- signifies a minus sign
x1x2...xd are the d most significant digits after rounding
exp is a decimal exponent of one of the following forms:
Edit Descriptor Absolute Value Form of Exponent
of Exponent
Ew.d exp < = 99 Esz1z2
99 < exp < = 999 sz1z2z3
Ew.dEe exp < = (10**e)-1 Esz1z2...ze
Dw.d exp < = 99 Dsz1z2
99< exp < = 999 sz1z2z3

where

z is a digit
s is the required sign of the exponent

A plus sign must be used if the exponent value is zero. The forms Ew.d and Dw.d
must not be used if exp > 999.

The scale factor k controls the decimal normalization. If -d < k < 0, the
output field contains exactly |k| leading zeros and d - |k| significant digits
after the decimal point. If 0 < k < d + 2, the output field contains exactly
k significant digits to the left of the decimal point and d - k + 1 significant
digits to the right of the decimal point. Other values of k are not
permitted.

3957 6053003 913


Format Specifications

Examples of E and D edit descriptors:


Edit Internal Value Input/Output Field
Descripto
r
column 12345678901234567
s 89
INPUT E11.4 2.5046 25046
E11.4 -.0025046 -25046E-3
E9.3 2.77 2.77
D18.3 413679.7 413679.7
D8.1 -305.E35 -305D36
OUTPUT E13.5 36.7929 0.36793E+02
E10.5 -36.7929 **********
E11.5 -36.7929 -.36793E+02

G Editing
The G edit descriptor may be used with list items of type integer, logical, real,
complex, and double precision.

The format for the G edit descriptor is the following:

Gw.d
Gw.dEe

where

w is a nonzero, unsigned, integer constant denoting field width


d is an unsigned integer constant denoting the fractional part
e is a nonzero, unsigned, integer constant denoting the number of digits in
the exponent part. The e has no effect on input.

When the Gw.d edit descriptor is used with a list item of type integer, the data is
edited with an Iw edit descriptor.

When the Gw.d edit descriptor is used with a list item of type logical, the data is
edited with an Lw edit descriptor.

G input editing of real and double precision list items is the same as for F editing of
these list items.

914 3957 6053003


Format Specifications

For output, the method of representation depends on the magnitude of the data being
edited. If v is the absolute value of the list item, then for v<.1 or v>10**d, E editing is
used. Otherwise, for k = 0, 1, 2,...d, if 10 **(d-k- 1)<v<10**(d-k), then the format
F(w-n).k,nX is used. In the preceding format n is 4 for Gw.d editing, and n is e+2 for
Gw.dEe. editing.

A scale factor affects the G format only if E editing is used.

The following are examples of the G format:

List Type Edit Internal Input/Output Field


Descripto Value
r
column 1234567890
s 1
INPUT logical G5.2 .TRUE. .T
real G10.3 5.679 5.679
integer G10.5 325672 325672
real G10.3 360 3.6E2
OUTPUT real G10.2 95 95.
real G10.2 .9 .90
real G10.2 300 0.30E+03
real G10.2E3 .35 .35
integer G10.9 1362 1362

O Editing
The O edit descriptor is used with I/O list items of any type, except character. On
input, the list item becomes defined with an octal value. On output, the list item is
output as a string of octal digits.

The form for the O edit descriptor is the following:

Ow

where

w is a nonzero, unsigned, integer constant denoting field width.

3957 6053003 915


Format Specifications

The input field is interpreted as w octal digits. Leading, trailing, and embedded blanks
are interpreted as zeros. A minus sign (-) causes bit 46 of the storage word allocated
to the variable to be complemented. If the list item is less than 16 octal digits long, it is
stored right-justified with zero fill in the storage word. If the list element is double
precision, and the input data is more than 16 digits, the first 16 digits are stored with
zero fill in the second word. If the field width on input is greater than the 16 or 32
digits that can be stored in a single or double precision word respectively, the
right-most 16 or 32 digits are taken from the field.

On output, if the field width specified is greater than 16 (32 for double precision), the
16 (or 32) digits are output right-justified within the field. If the field width is less than
the internal representation, the right-most octal digits are transferred to fill the field
width.

Examples:

List Edit Internal Value Input/Output Field


Item De-
Typ scrip-
e tor
column 12345678901234
s 56
INPUT S O2 O00000000000000 16
16
S O16 O177777777777777 1777777777777777
7
S O3 O200000000000001 -16
6
OUTPUT S O5 O000567770123444 34444
4
S O16 O000567770123444 0005677701234444
4
S O2 9 11

L Editing
The L edit descriptor is specified to edit logical type data.

The form for the L edit descriptor is as follows:

Lw

where

w is a nonzero, unsigned integer constant denoting field width.

916 3957 6053003


Format Specifications

On input, the list item is defined with a logical value. The field should consist of
optional blanks, optionally followed by a decimal point, followed by a T for true or F for
false. The T or F may be followed by additional characters in the field. Note that the
logical constants .TRUE. and .FALSE. are acceptable input forms.

On output, the field consists of w - 1 blanks followed by a T or F, as the value of the


internal data is true or false, respectively.

Examples of L editing:
Edit Descriptor Internal Input/Output Field
Value
columns 123
INPUT L1 .TRUE. T
L3 .FALSE. .F
OUTPUT L1 .FALSE. F
L3 .FALSE. F
L2 .TRUE. T

A Editing
The A edit descriptor is used with input/output list items of type character or Hollerith.
On input, the list item becomes defined with character data. On output, the list item
must be defined with character data.

The form for A editing is the following:

A[w]

where

w is an optional nonzero, unsigned integer constant denoting field width.

If the field width is not specified with the edit descriptor, the number of characters in
the field is equal to the length of the character data. Input and output list items for
which a field width is unspecified must be of type character.

Integer data may contain a maximum of four Hollerith characters, logical and real data
may contain a maximum of six characters, and double precision data may contain up
to twelve characters. The Hollerith data is stored left-justified in the word, padded
with blanks on the right if necessary. When Hollerith data is stored in an integer, only
the lower 32 bits are used, with the high order 16 bits filled with zeros.

On input, the A edit descriptor transfers w characters from the input device to the
corresponding list element. Let <len> be the length of the character list item. If the
field width <w> is greater than or equal to <len>, the right- most <len> characters are
read. If <w> is less than <len>, <w> characters are stored left-justified with <len>-
<w> trailing blanks in the list item.

3957 6053003 917


Format Specifications

On output, the A edit descriptor transfers <w> characters from the list item to the
output device. Again, let <len> be the length of the list item. If the field width <w> is
greater than <len>, the output field has <w>- <len> blanks followed by <len>
characters. If <w> is less than or equal to <len>, the output field contains the
left-most <w> characters of the list item.

The following are character examples:

Character Edit Descriptor Internal Input/Output


Item Length Value Field
column 12345
s 6
INPUT 5 A3 ABC ABC
3 A3 ABC ABC
2 A3 BC ABC
OUTPUT 6 A3 ABCDEF ABC
2 A6 AB AB
5 A5 ABCDE ABCDE

The following are Hollerith examples:

Integer Item Edit Internal Input/Output Field


Length Descriptor Value
columns 123456
INPUT 4 A6 00CDEF ABCDEF
4 A4 00ABCD ABCD
OUTPUT 4 A6 00ABCD ABCD
4 A4 00ABCD ABCD
Real Item Edit Internal Input/Output Field
Length Descriptor Value
columns 123456
INPUT 6 A6 ABCDEF ABCDEF
6 A8 CDEFGH ABCDEFG
HI
OUTPUT 6 A4 ABCDEF ABCD
6 A8 ABCDEF ABCDEF

918 3957 6053003


Format Specifications

Example using Hollerith:


INTEGER I
READ (5, 10) I
10 FORMAT (1X,A4)
WRITE (6,20) I,I
20 FORMAT (1X,Z12,1X,A4)

Input: ABCD
Output: 0000C1C2C3C4 ABCD

Z Editing
The Z edit descriptor is used with I/O list items of any type. On input, the list item
becomes defined with a hexadecimal value. On output, the list item is output as a
string of hexadecimal digits.

The form for the Z edit descriptor is the following:

Zw

where

w is a nonzero, unsigned, integer constant denoting field width.

The input field is interpreted as w hexadecimal digits. Leading, trailing, and embedded
blanks are interpreted as zeros. If the list element is single precision and the input data
is less than 12 hexadecimal digits long, it is stored right-justified with zero fill in the
storage word. If the list element is double precision, and the input data is 12 or fewer
digits, it is stored right-justified with zero fill in the first word, and zeros are stored in
the second word. If the input data is more than 12 digits, the first 12 digits are stored
into the first word and the remaining digits are stored right-justified with zero fill in the
second word. If the field width on input is greater than the 12 or 24 digits that can be
stored in a single or double precision word respectively, the right-most 12 or 24 digits
are taken from the field. A minus sign causes bit 46 to be complemented.

On output, if the field width specified is greater than 12 (24 for double precision) the 12
(or 24) digits are output right-justified with blank fill within the field. If the field width is
less than the internal representation, the right-most hexadecimal digits are transferred
to fill the field width.

Example:
FILE 6(KIND=REMOTE, MYUSE=IO)
READ (6,FMT=(Z6))A
WRITE (6,FMT=(1X,Z10))A
END

Input: CDE4
Output: 0000CDE400

3957 6053003 919


Format Specifications

Examples

List Edit Internal Value Input/Output Field


Item De-
Type scrip-
tor
column 12345678901234
s 5
INPUT S Z2 Z00000000006F 6F
S Z12 Z1234567890AB 1234567890ABCDE
D Z15 Z1234567890AB 1234567890ABCDE
000000000CDE
OUTPUT S Z5 Z0000567890AB 890AB
S Z12 Z1234567890AB 1234567890AB
S Z15 Z1234567890AB 1234567890AB

K Editing
The K edit descriptor causes commas to be inserted between digit triples to the left
of the decimal point.

Examples:

Edit Descriptor Internal Value Input/Output Field


column 12345678901234
s 5
KI10 -1234567 -1,234,567
KF15.5 1234567.11111 1,234,567.11111

$ Editing
The $ edit descriptor causes the character $ to be inserted immediately to the left of
an edited item.

Examples:

Edit Internal Input/Output Field


Descriptor Value
columns 123456789012345
$F10.2 17.347 $17.35
K$I15 -1234567 $- 1,234,567

920 3957 6053003


Format Specifications

Format Specifications in Arrays and Character


Entities
If the format identifier in a formatted input/output statement is an array name or
character expression, the left-most character positions of the specified entity must be
in a defined state with character data that constitute a format specification when the
statement is executed.

A character format specification must be of the form described previously. Note that
the form begins with a left parenthesis and ends with a right parenthesis. Character
data may follow the right parenthesis that ends the format specification and blank
characters may precede the format specification with no effect on the format
specification.

If the format identifier is an array name, the length of the format specification may
exceed the length of the first element of the array; an array format specification is
considered to be a concatenation of all the elements of the array in the order given by
array element ordering.

If a character array element name is specified as a format identifier, the length of the
format specification must not exceed the length of the array element.

The following are examples of format specified as values of character arrays,


character variables, or other character expressions:

CHARACTER FMT1*20
DATA FMT1/(I2,F10.5,5X,I3)/
WRITE (6,FMT=FMT1)I,X,J
WRITE (6,FMT=(F5.1))Z
WRITE (6,FMT=(//FMT1(2:9)//)) I,X

List-Directed Format
The use of list-directed format (or free format) with an input/output statement allows
I/O to be performed with editing, but without requiring the user to specify a format
specification explicitly.

List-directed formatting is invoked with an asterisk, which is a format specifier.

The characters in one or more list-directed records constitute a sequence of values


and value separators. The end of a record has the same effect as a blank character,
unless it is within a character constant. Any sequence of two or more consecutive
blanks is treated as a single blank unless it is within a character constant.

Each value is either a constant, a null value, or one of the following forms:

r*c
r*

where r is an unsigned, nonzero, integer constant.

3957 6053003 921


Format Specifications

The r*c form is equivalent to r successive appearances of the constant c, and the r*
form is equivalent to r successive null values. Neither of these forms may contain
embedded blanks, except where permitted within the constant c.

A value separator is one of the following:

1. A comma optionally preceded by one or more contiguous blanks and optionally


followed by one or more contiguous blanks.
2. A slash optionally preceded by one or more contiguous blanks and optionally
followed by one or more contiguous blanks.
3. One or more contiguous blanks between two constants or following the last
constant.
Input forms acceptable to format specifications for a given type are acceptable for
list-directed formatting, except as noted. The form of the input value must be
acceptable for the type of the input list item. Blanks are never used as zeros, and
embedded blanks are not permitted in constants, except within character constants
and complex constants as specified in subsequent paragraphs. Note that the end of a
record has the effect of a blank, except when it appears within a character constant.

When the corresponding input list item is of type real or double precision, the input
form is that of a numeric input field. A numeric input field is a field suitable for F
editing, one which is assumed to have no fractional digits unless a decimal point
appears within the field.

When the corresponding list item is of type complex, the input form consists of a left
parenthesis followed by an ordered pair of numeric input fields separated by a comma
and followed by a right parenthesis. The first numeric input field is the real part of the
complex constant and the second is the imaginary part. Each of the numeric input
fields may be preceded or followed by blanks. The end of a record may occur
between the real part and the comma or between the comma and the imaginary part.

When the corresponding list item is of type logical, the input form must not include
either slashes or commas among the optional characters permitted for L editing.

When the corresponding list item is of type character, the input form consists of a
valid character constant enclosed in quotation marks or apostrophes. The character
constants may be continued from the end of one record to the beginning of the next
record and may be continued on as many records as needed. If the length of the list
item and the length of the constant are not equal, the list item is assigned the value of
the constant as though the constant were assigned the list item in a character
assignment statement.

922 3957 6053003


Format Specifications

A null value may be specified by having no characters between successive value


separators, no characters preceding the first value separator in the first record read by
each execution of a list-directed input statement, or the r* form. A null value has no
effect on the definition status of the corresponding input list item. If the input list item
is defined, it retains its previous value; if it is undefined, it remains undefined. A null
value may not be used as either the real or imaginary part of a complex constant, but a
single null value may represent an entire complex constant. Note that the end of a
record following any other separator, with or without separating blanks, does not
specify a null value.

A slash encountered in the data value list during execution of a list-directed input
statement causes termination of execution of that input statement after assignment
of the previous value. If there are additional items in the input list, they are assigned
null values.

On output, each value is edited into the appropriate format. With the exception of
character constants, the values are separated by two blanks.

New records begin as necessary, but, except for complex constants and character
constants, the end of a record does not occur within a constant, and blanks do not
occur within a constant.

Logical output constants are T for the value true and F for the value false.

Integer output constants are produced with the effect of an I edit descriptor.

Real and double precision constants are produced with the effect of either an F edit
descriptor or an E edit descriptor, depending on the magnitude of the value.

Complex constants are enclosed in parentheses, with a comma separating the real
and imaginary parts. The end of a record may occur between the comma and the
imaginary part only if the entire constant is as long as, or longer than, an entire record.

Character constants produced are not delimited by apostrophes or quotation marks


and are not preceded or followed by a comma or blanks.

Each output record begins with a blank character to provide carriage control when the
record is printed.

The following is an example of list-directed formatting on input:

LOGICAL LG(5)
CHARACTER CHAR1*04, CHAR2*02, CHAR3*03
DOUBLE PRECISION DBLE
COMPLEX CMPLX
READ(5,FMT=*)X,Y,DBLE,LG,CMPLX,CHAR1,INT1,INT2,CHAR2,CHAR3,Z

Input data for the preceding READ statement is as follows:

5.9, 6.3E10, 367.D23, 2*.TRUE., , 2*.F, (1.1,1.1)


ABC, 22, 22, ABCD, AB /

3957 6053003 923


Format Specifications

The following assignments take place as a result of the preceding READ statement
with the indicated data:

X = 5.9
Y = 6.3E10
DBLE = 367.D23
LG(1) = .TRUE.
LG(2) = .TRUE.
LG(4) = .FALSE.
LG(5) = .FALSE.

CMPLX = (1.1,1.1)
CHAR1 = ABC A value of ABC
CHAR2 = AB
CHAR3 = AB
INT1 = 22
INT2 = 22

The values of Z and LG(3) do not change.

The following is an example of list-directed formatting on output:

WRITE (6,*)X, INT1, LG(1), LG(5), CHAR1, CHAR1

The following is the output produced by the preceding WRITE statement assuming the
values of the variables were assigned by the preceding list- directed READ statement.

5.9 22 T FABCABC

924 3957 6053003


Section 10
Namelist Formatting

Note: This entire section is a Unisys extension to the national standard.

The non-executable NAMELIST statement associates a list of simple variables and


arrays with a unique symbolic name called a namelist name. This namelist name may
be used only as the format designator in a READ, WRITE, PRINT, or PUNCH statement.

The format for the NAMELIST statement is as follows:

  , 
 
   
   
 NAMELIST  /  <namelist name>  /  <variable name> 
 
! <array name> #

A namelist name is constructed in the same manner as a variable name. A namelist


name may be used only as a format designator and must be declared as such by a
NAMELIST statement appearing in the program unit in which it is used. The I/O
statement using the namelist name may not contain an I/O list. The namelist name
may not be a dummy argument and the elements of a namelist list may not be dummy
arguments. This name may be used for no other purpose.

The NAMELIST statement follows any declarations referencing the elements of the
namelist list.

A particular simple variable or array may be associated with more than one namelist
name. For example, if A, B, and C are array names, the NAMELIST statement:

NAMELIST/NMLST1/A,G/NMLST2/A,B,A2/LIST/C,XR,S,T

The preceding statement associates the array A and the simple variable G with the
namelist name NMLST1; associates the arrays A and B, and the simple variable A2 with
the namelist name NMLST2; and associates the array C and the simple variables XR, S,
and T with the namelist name LIST.

Values may be input to internal storage locations from peripheral storage by formatted
READ statements using namelist names as format designators. When such a READ
statement is executed, the referenced file is accessed repeatedly, beginning at its
present position, until an appropriate namelist input record is found or an end-of-file
condition occurs.

3957 6053003 101


Namelist Formatting

Namelist Input
Namelist input records must have the following format:

1. A namelist record consists of one or more physical records.


2. The first character of each physical record is blank, and the second character of
the first physical record must be an ampersand (&). The namelist name must
immediately follow the & and contain no embedded blanks. This name is followed
by at least one blank, which is followed by the list of value assignments.
3. Each namelist record contains a list of value assignments, separated by commas.
A value assignment is either a simple variable followed by an equal sign (=) and a
constant, or an array name or array element name followed by an equal sign that is
followed by one or more constants separated by commas, with or without
repeated specifications.
No embedded blanks may appear in the names or the constants. Each variable and
array referenced in this list must have been associated with the namelist name in a
NAMELIST statement.
4. The constants may be integer, real, double precision, complex, logical, or character
constants. If the constant is logical, the forms T and F may also be used for .TRUE.
and .FALSE., respectively. No embedded blanks may appear in the variable names,
array names, array element names, or in the arithmetic or logical constants.
Character constants must be enclosed in quotation marks or apostrophes. Any
number of blanks may appear between the variable name, array name, or array
element name and the equal sign; between the equal sign and the constant or list
of values; between a value and the preceding comma in a list of values; between a
value assignment and the preceding comma; and between an &END and the
preceding comma.
5. The end of a record in the data group may occur only between the namelist name
and a value assignment; between a value assignment and the preceding comma in
the list of value assignments; between the equal sign and the constant or list of
values; between a value and the preceding comma in a list of values; or between
the &END and the preceding value assignment, comma, or namelist name.
6. If assignment is being made to an array name, up to as many values as there are
elements in the array may appear in the value list. If assignment is being made to
an array element, up to as many values as there are succeeding elements in the
array may appear in the value list. Values are assigned to the elements of the array
in the order in which they are stored internally, beginning with the indicated
element.
7. A variable or array whose name appears in the list of value assignments in the
data group for a namelist name must be named in the namelist list for that name.
It is not necessary for all of the variables and arrays named in the namelist list to
have their names appear in the list of value assignments in the data group for the
associated namelist name. The order of the names in the namelist list is not
significant. A name that is associated with an element appearing in a namelist list
may not be substituted for that name in the value assignment list in the data
group.

102 3957 6053003


Namelist Formatting

8. The namelist record must be terminated by "&END". The remaining characters of


the physical record on which this item appears are ignored.
After the physical records bearing a namelist record are read, the file is positioned at
the next record in the file.

Data items associated with the namelist name that do not have values assigned to
them in the namelist record retain their present values.

Assignment to the indicated variable or array occurs as follows:

1. For the following form, the constant is assigned to the variable.


<variable name> = <constant>

2. For the following form, each constant in the list of values is assigned to an
element of the array. The elements of the array are assigned in the order specified
by the element ordering beginning with the first element.
<array name> = <list of values>

3. For the following form, each constant in the list of values is assigned to an
element of the array. The elements of the array are assigned in the order specified
by the array element ordering beginning with the element specified in the value
assignment. Conversion is applied in the same manner as for arithmetic, logical,
and character assignment statements.
<array element name> = <list of values>

A variable named in the namelist list for a specific namelist name, but whose name
does not appear in a value assignment in the data group for the namelist name, retains
its current value if defined or else remains undefined. Any element of an array named
in the namelist list for a name that is not assigned a value in a value assignment in the
data group for the namelist name retains its current value if defined or else remains
undefined.

Namelist Output
When a WRITE, PRINT, or PUNCH statement specifying namelist formatting is
executed, the output, except for variables or arrays of type character, is written to the
file in a form that can be read by a READ statement specifying the same namelist
name as a format identifier. The values of all of the variables and arrays whose names
appear in the namelist list for the specified namelist are written. The values of integer,
real, double precision, complex, logical, and character variables or arrays are written as
integer, real, double precision, complex, logical, and character constants, respectively.
Fields for the data are made large enough to contain all significant digits.

1. The value of a variable is written in the form


<variable name> = <constant>

3957 6053003 103


Namelist Formatting

2. The values of an array are written in the following form, where the list of
constants contains one constant for each element in the array, written in the order
specified by the array element ordering:
<array name> = <list of constants>

Data of type character is written without being delimited by apostrophes or quotation


marks. It is therefore not possible to read character constants with namelist
formatting when the record being read was created with namelist formatting.

The following example uses NAMELISTs:

02000 REAL A(3), B


04000 DOUBLE PRECISION D
06000 LOGICAL L
08000 CHARACTER*07 CHAR
10000 NAMELIST /NLIST/ A, L, D, B
12000 NAMELIST /NLIST2/ A, CHAR
14000 A(1) = 25.5
16000 A(2) = 1
18000 A(3) = 100.1
20000 L = .TRUE.
22000 D = 1.5D10
24000 B = 1.5E02
26000 CHAR = EXAMPLE
28000 WRITE (5,NLIST)
30000 WRITE (5,NLIST2)
32000 END

The output is as follows:

&NLIST
A =
25.500000000, 1.0000000000, 100.10000000, L = .TRUE., D =
0.15000000000000000000000D+00011, B = 150.00000000,&END
&NLIST2
A =
25.500000000, 1.0000000000, 100.10000000, CHAR =
EXAMPLE,&END

104 3957 6053003


Section 11
Main Program

Every FORTRAN77 program must have one main program. Execution of a program
begins with the first executable statement in this program unit. Compiling a program
that does not contain a main program results in a warning message. The code file
resulting from the compilation of a source without a main program can be used as a
host file into which a main program can be separately compiled, provided that the
option MAKEHOST is SET, or bound, provided that BINDINFO is set. Also, cross
reference files can be created for a program unit that is missing a main program.

A main program is a program unit that does not have a FUNCTION, BLOCK GLOBALS,
SUBROUTINE, or BLOCK DATA statement as its first statement. It may have a
PROGRAM statement as its first statement. A main program may not contain RETURN
or ENTRY statements. The appearance of a SAVE statement in this program unit has
no effect, except to cause any variable and arrays associated with the SAVE
statement to be part of the global environment.

PROGRAM Statement
The PROGRAM statement is used to assign a symbolic name to a main program.

The format of a PROGRAM statement is as follows:

 PROGRAM  <program name> 

This is an optional statement, but when it is used, it must be the first statement of the
program unit.

The symbolic name assigned to the main program is global to the executable program.
Therefore, care must be taken that the name selected is not the same as that of an
external procedure, block data subprogram, common block, or local name in the main
program.

3957 6053003 111


Main Program

112 3957 6053003


Section 12
Functions and Subroutines

Functions and subroutines, collectively called procedures, consist of four types:


external subroutines, external functions, statement functions, and intrinsic
procedures.

Intrinsic functions, statement functions, and external functions are referred to


collectively as functions.

External functions and subroutines are referred to collectively as external procedures.


These external procedures are defined in program units called subprograms: function
subprograms and subroutine subprograms.

Functions
Functions are procedures that are usually referenced in expressions and supply a
value to the expression. The value supplied is the value of the function.

There are three types of functions:

Intrinsic functions
Statement functions
External functions
A function reference is used to reference an intrinsic function, statement function, or
external function. Some intrinsic functions and statement functions can also be used
on the left side of an assignment statement instead of as an expression. Refer to
"Assignable Functions" in this section for more information.

The format of a function reference is the following:

 <function name>  (  ) 


| |
|   ,  |
| | | |
 <expression> 
| |
 <array name> 
| |
 <procedure name> 

3957 6053003 121


Functions and Subroutines

The type of the result of a statement function or external function reference is the
same as the type of the function name. The type is specified in the same manner as
for variables and arrays. The type of the result of an intrinsic function is specified in
Table 12-1.

Intrinsic Functions
Intrinsic functions are function subprograms that are known to the compiler and need
not be supplied in the program. These functions are identified by two types of names:
specific names and generic names. An IMPLICIT statement does not change the type
of an intrinsic function. The specific names that identify the intrinsic functions, their
generic names, function definitions, and the type of results are illustrated in Table 12-1.
The order, number, and type of the actual arguments passed to the intrinsics must
agree with the specifications in the table when the specific name is used to reference
a function.

For those intrinsic functions that have more than one argument, integer and real
arguments may be intermixed.

Generic names simplify the use of intrinsic functions. The generic function name may
be used with various types of arguments. If the generic name is used, the type of the
result is the same as the type of the argument. The exceptions to this are those
functions that do type conversion, nearest integer, and absolute value with a complex
argument.

An actual argument in an intrinsic function reference may be any expression, except


for a character expression involving concatenation of an operand whose length
specification is an asterisk in parentheses, (*), unless this operand is the symbolic
name of a constant.

A specific name of an intrinsic function that appears in an INTRINSIC statement may


be used as an actual argument in an external procedure reference. However, the
following names of intrinsic functions must not be used as actual arguments:

INT IFIX HFIX IDINT


FLOAT SNGL REAL DBLE
DFLOAT CMPLX DCMPLX ICHAR
CHAR LGE LGT LLE
DMAX1 AMAX0 MAX0 AMAX1
DMAX1 AMAX0 MAX1 MIN
MIN0 AMIN1 DMIN1 AMIN0
MIN1 AND IAND COMPL
NOT EQUIV OR IOR
EOR IEOR SHFT ISHFT
BITS IBITS BSET IBSET

122 3957 6053003


Functions and Subroutines

BCLR SHFTC ISHFTC BTEST


ISOL TIME CTIME DATE
RANDOM GAMMA DGAMMA LGAMA
ALGAMA DLGAMA ERF DERF
ERFC DERFC VALUE CHARS
SKIP UPPERCASE UPPERC LOW ERC
LOWERCASE LEN_TRIM TRMLEN ADJUSTL
ADJUSTR TRIM

Note that such an appearance does not cause the intrinsic function to be classified as
an external function.

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Type Conversion to 1 INT ---- Integer integer


Conversion Integer
See Note 1.
INT Real Integer
IFIX Real Integer
HFIX Real Integer
IDINT Double Integer
---- Complex Integer
---- Character Integer
Conversion to 1 REAL REAL Integer REAL
Real
See Note 2.
FLOAT Integer Real
---- Real Real
SNGL Double Real
---- Complex Real
---- Character Real
Conversion to 1 DBLE DFLOAT Integer Double
Double
See Note 3.
---- Real Double
--- Double Double-
---- Complex Double
---- Character Double

3957 6053003 123


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Conversion to 1 or 2 CMPLX ---- Integer Complex


Complex
See Note 4.
---- Real Complex
DCMPLX Double Complex
---- Complex Complex
---- Character Complex
Conversion to 1 ICHAR Character Integer
Integer
See Note 5.
Conversion to 1 CHAR Integer Character
Character
See Note 5.
Truncation int (N) 1 AINT AINT Real Real
See Note 1
DINT Double Double
Nearest Whole int(N+.5) if N is 1 ANINT ANINT Real Real
Number greater than or
equal to 0
int(N-.5) if N< 0 DNINT Double Double
Nearest int(N+.5) if N is 1 NINT NINT Real Integer
Integer greater than or
equal to 0
int(N-.5) if N< 0 IDNINT Double Integer
Absolute Value |N| 1 ABS IABS Integer Integer
(Nr2+Ni2)1/2 ABS Real Real
See Note 6. DABS Double Double
CABS Complex Real
CDABS Complex Real
Remaindering N1-int(N1/N2)*N2 2 MOD MOD Integer Integer
See Note 1. AMOD Real Real
See Note 23. DMOD Double Double
Transfer of |N1|if N2 is 2 SIGN ISIGN Integer Integer
Sign greater than or
equal to 0
-|N1| if N2< 0 SIGN Real Real
See Note 24. DSIGN Double Double

124 3957 6053003


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Positive N1-N2 if N1> N2 2 DIM IDIM Integer Integer


Difference
0 if N1is less DIM Real Real
than or equal to
N2
DDIM Double Double
Double N1*N2 2 DPROD Real Double
Precision
Product
Choosing MAX (N1,N2,...) greater than MAX MAX0 Integer Integer
Largest Value or equal to 2
AMAX1 Real Real
DMAX1 Double Double
--- AMAX0 Integer Real
--- MAX1 Real Integer
Choosing MIN (N1,N2,...) greater than MIN MIN0 Integer Integer
Smallest Value or equal to 2
AMIN1 Real Real
DMIN1 Double Double
--- AMIN0 Integer Real
--- MIN1 Real Integer
Length Length of 1 LEN Character Integer
Character Entity
See Note 11.
Index of Location of 2 INDEX Character Integer
Substring Substring N2 in
String N1
See Note 10.
Imaginary Part Ni 1 AIMAG Complex Real
of Complex See Note 6.
Argument
Conjugate of a (Nr-Ni) 1 CONJG Complex Complex
Complex See Note 6.
Argument
DCONJG Complex Complex
Square Root (N)1/2 1 SQRT SQRT Real Real
See Note 25.
DSQRT Double Double
CSQRT Complex Complex
CDSQRT Complex Complex

3957 6053003 125


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Exponential e**N 1 EXP EXP Real Real


DEXP Double Double
CEXP Complex Complex
CDEXP Complex Complex
Natural log(N) 1 LOG ALOG Real Real
Logarithm See Note 26.
DLOG Double Double
CLOG Complex Complex
CDLOG Complex Complex
Common log 10(N) 1 LOG10 ALOG10 Real Real
Logarithm See Note 26.
DLOG10 Double Double
Sine sin(N) 1 SIN SIN Real Real
See Note 27.
DSIN Double Double
CSIN Complex Complex
CDSIN Complex Complex
Cosine cos(N) 1 COS COS Real Real
See Note 27.
DCOS Double Double
CCOS Complex Complex
CDCOS Complex Complex
Tangent tan(N) 1 TAN TAN Real Real
See Note 27.
DTAN Double Double
Arcsine arcsin(N) 1 ASIN ASIN Real Real
See Note 28.
ARSIN Real Real
DASIN Double Double
DARSIN Double Double
Arccosine arccos(N) 1 ACOS ACOS Real Real
See Note 29.
ARCOS Real Real
DACOS Double Double
DARCOS Double Double

126 3957 6053003


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Arctangent arctan(N) 1 ATAN ATAN Real Real


See Note 30.
DATAN Double Double
arctan(N1/N2) 2 ATAN2 ATAN2 Real Real
See Note 30.
DATAN2 Double Double
Hyperbolic sinh(N) 1 SINH SINH Real Real
Sine
DSINH Double Double
Hyperbolic cosh(N) 1 COSH COSH Real Real
Cosine
DCOSH Double Double
Hyperbolic tanh(N) 1 TANH TANH Real Real
Tangent
ATANH Real Real
DTANH Double Double
Lexically N1 is greater 2 LGE Character Logical
Greater Than than or equal to
or Equal N2
See Note 12.
Lexically N1> N2 2 LGT Character Logical
Greater Than See Note 12.
Lexically Less N1 is less than 2 LLE Character logical
Than or Equal or equal to N2
See Note 12.
Lexically Less N1< N2 2 LLT Character Logical
Than See Note 12.
Cotangent cot(N) 1 COTAN Real Real
Time See Note 13. 1 TIME TIME Character Real
Constant
--- Integer Real
--- Real Real
Compile Time See Note 14. 1 CTIME CTIME Integer Real
--- Real Real
Date See Note 15. 1 DATE Character Character*6
Constant
Pseudo See Note 16. 1 RANDOM Integer Real
Random
Number

3957 6053003 127


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

Numeric Value See Note 21. 1 VALUE Character Integer


of Attribute
Character See Note 32. 2 CHARS CHARS Integer Character*4
String
Representation
--- Real Character*6
--- Logical Character*6
--- Complex Character*12
--- Double Character*12
Character See Note 33. 2 SKIP Character Integer
Skipping
Bitwise AND See Note 17. 2 AND AND Real Real
IAND Integer Integer
--- Logical Logical
Bitwise See Note 18. 1 COMPL COMPL Real Real Integer
Complement
NOT Integer Logical
--- Logical
Bitwise See Note 19. 2 EQUIV EQUIV Real Real
Equivalence
--- Integer Integer
--- Logical Logical
Bitwise OR See Note 20. 2 OR OR Real Real
IOR Integer Integer
--- Logical Logical
Bitwise See Note 34. 2 EOR EOR Real Real
Exclusive OR
IEOR Integer Integer
--- Logical Logical
Bitwise Shift See Note 35. 2 SHFT SHFT Real Real
--- Integer Integer
--- Logical Logical
Integer (32 bit) See Note 36. 2 --- ISHFT Integer Integer
Bitwise Shift
Bitwise See Note 37. 3 SHFTC SHFTC Real Real
Circular Shift
ISHFTC Integer Integer

128 3957 6053003


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

--- Logical* Logical


Bit Set See Note 38. 2 BSET BSET Real Real
Integer Integer
Logical* Logical
Bit Clear See Note 39. 2 BCLR BCLR Real Real
IBCLR Integer Integer
--- Logical* Logical
Bit Test See Note 40. 2 BTEST Real Logical
--- Integer Logical
--- Logical* Logical
Bit Extraction See Note 41. 3 BITS BITS Real Real
IBITS Integer Integer
--- Logical* Logical
Partial Word See Note 22. 5 CONCAT Real Integer
Manipulation
Bit Isolation See Note 31. 3 ISOL ISOL Real Real
--- Integer Integer
--- Logical* Logical
Error Function Standard Error 1 ERF ERF Real Real
Function
DERF Double Double
Error Function 1-ERF(N) 1 ERFC ERFC Real Real
Complement
DERFC Double Double
Gamma Gamma Function 1 GAMMA GAMMA Real Real
at N
DGAMM Double Double
A
Natural n of gamma at N 1 LGAMA LGAMA Real Real
Logarithm of
Gamma
ALGAMA Real Real
DLGAMA Double Double
Uppercase Converts 1 UPPER- Character Character
lowercase to CASE
uppercase
See Note 42.

3957 6053003 129


Functions and Subroutines

Intrinsic Definition Number of Generic Specific Type of Function


Function Arguments Name Name Argumen
t

UPPERC Character Character


Lowercase Converts 1 LOWER- Character Character
lowercase to CASE
uppercase.
See Note 43.
LOWERC Character Character
Trim Length Length of 1 LEN_TRI Character Integer
trimmed string. M
See Note 44.
TRMLEN Character Integer
Trim Trimmed string. 1 TRIM Character Character
See Note 45.
Adjust Left Adjust string 1 ADJUSTL Character Character
left. See Note
46.
Adjust Right Adjust string 1 ADJUSTR Character Character
right. See Note
47.

*The type for the data item on which the intrinsic works. Other arguments for this
intrinsic that specify bit positions and/or lengths must be of type real or integer.

Notes for the table:


1. For n of type integer, INT(n)=n. For n of type real or double precision, the fractional
part of the number is truncated. For example:
INT(-3.7) = -3
INT(3.7) = 3
For n of type complex, INT(n) is the value obtained by applying the preceding rule
to the real part of n. For n of type character, INT(n) is the integer that is
represented by the bit pattern of the character string (see Section 6 for more
information). For n of type real, IFIX(n) and HFIX(n) are the same as INT(n).
2. For n of type real, REAL(n) is n. For n of type integer or double precision, REAL(n) is
as much precision of the significant part of n as a real datum can contain. For n of
type complex, REAL(n) is the real part of n. For n of type character, REAL(n) is the
real number that is represented by the bit pattern of the character string (see
Section 6 for more information). For n of type integer, FLOAT(n) is the same as
REAL(n).

1210 3957 6053003


Functions and Subroutines

3. For n of type double precision, DBLE(n) is n. For n of type integer or real, DBLE(n) is
as much precision of the significant part of n as a double precision datum can
contain. For n of type character, DBLE(n) is the double precision number that is
represented by the bit pattern of the character string (see Section 6 for more
information). For n of type complex, DBLE(n) is as much precision of the significant
part of the real part of n as a double precision datum can contain. For n of type
integer, DFLOAT(n) is the same as DBLE(n).
4. CMPLX may have one or two arguments. If there is one argument, it may be of
type integer, real, character, double precision, or complex. If there are two
arguments, they may be of type integer, real or double precision. For n of type
complex, CMPLX(n) is n. For n of type integer, real, or double precision, CMPLX(n)
is the complex value whose real part is REAL(n) and whose imaginary part is zero.
For n of type character, CMPLX(n) is the complex number that is represented by
the bit pattern of the character string. (See Section 6 for more information.)
CMPLX(n1,n2) is the complex value whose real part is REAL(n1) and whose
imaginary part is REAL(n2). For n, n1, and n2 of type double precision, DCMPLX(n)
and DCMPLX(n1,n2) are the same as CMPLX(n) and CMPLX(n1,n2) respectively.
5. ICHAR provides a means of converting from a character to an integer based on the
position of the character in the collating sequence. The first character in the
collating sequence corresponds to position 0 and the last to position n-1, where n
is the number of characters in the collating sequence. The value of ICHAR(n) is an
integer in the range:0 <= ICHAR(N) <= n-1, where n is an argument of type
character of length 1. The value of n must be in the collating sequence. The
position of that character in the collating sequence is the value of ICHAR. For any
characters c1 and c2 capable of representation in the processor, (c1 .LE. c2) is true
if and only if (ICHAR(c1) .LE. ICHAR(c2)) is true, and (c1 .EQ. c2) is true if and only if
(ICHAR(c1) .EQ. ICHAR(c2)) is true. CHAR(i) returns the character in the ith position
of the processor collating sequence. The value is of type character of length 1. i
must be an integer expression whose value must be in the range 0 <= i <= n-1.
ICHAR(CHAR(i)) = i for 0 <= i <= n-1.
CHAR(ICHAR(c)) = c for any character in the collating sequence.
6. A complex value is expressed as an ordered pair of reals, (Nr,Ni), where Nr is the
real part and Ni is the imaginary part.
7. All angles are expressed in radians.
8. The result of a function of type complex is the principal value.
9. All arguments in an intrinsic function reference must be of the same type, except
for the bit manipulation intrinsics. As a Unisys extension for intrinsics requiring
more than one argument, integer and real arguments may be intermixed.
10. INDEX(n1,n2) returns an integer value indicating the starting position within the
character string n1 of a substring identical to string n2. If n2 occurs more than
once in n1, the starting position of the first occurrence is returned. If n2 does not
occur in n1, the value zero is returned. Note that zero is returned if LEN(n1) <
LEN(n2).
11. The value of the argument of the LEN function need not be defined at the time the
function is referenced.

3957 6053003 1211


Functions and Subroutines

12. LGE(n1,n2) returns the value true if n1=n2 or if n1 follows n2 in the collating
sequence described in American National Standard Code for Information
Interchange, ANSI X3.4-1977 (ASCII) and otherwise returns the value false.
LGT(n1,n2)) returns the value true if n1 follows n2 in the collating sequence
described in ANSI X3.4-1977 (ASCII) and otherwise returns the value false.
LLE(n1,n2) returns the value true if n1=n2 or if n1 precedes n2 in the collating
sequence described in ANSI X3.4-1977 (ASCII) and otherwise returns the value
false.
LLT(n1,n2) returns the value true if n1 precedes n2 in the collating sequence
described in ANSI X3.4-1977 (ASCII), and otherwise returns the value false.
If the operands for LGE, LGT, LLE, and LLT are of unequal length, the shorter
operand is considered as if it were extended on the right with blanks to the length
of the longer operand.
13. The TIME intrinsic takes one argument and returns a system time value. The
argument can be a character constant or an arithmetic expression of type real or
integer. If a character constant argument is used, the time value is returned as a
real number expressed in units of seconds as follows:

Character constant Description


'DAY' Current time of day
'ELAPSED' Elapsed time clock for program
'PROCESSOR' Total processor time for program
'I/O' Total Input/Output time for program

When used with a real or integer argument, the TIME intrinsic returns a system
time value as specified in the table under the following note for CTIME. Note that
the TIME intrinsic returns a system time value at run time.
14. The CTIME intrinsic takes one argument and returns a system time value at
compile time. The compiler actually replaces the CTIME intrinsic reference by the
returned system time value during the compilation of the program. The argument
of this intrinsic must be a constant expression of type real or integer. When
rounded to the nearest integer, the value of the argument determines the
returned system time value as indicated in the following table. Argument values
not listed in the table cause the intrinsic to return an undefined value. Be cautious
when assigning certain system time values to integers (I = CTIME(6), for example),
since conversion to integer could result in an integer overflow fault or cause
corruption of the returned result.

1212 3957 6053003


Functions and Subroutines

Argument Returned
Result
1 Returns an integer value that is the time of day expressed
in units of sixtieths of a second.
2 Returns an integer value that is the elapsed processor time
of the executing program in units of sixtieths of a second.
Note that for CTIME the executing program is the compiler
and hence, the elapsed processor time for the compilation
is returned.
3 Returns an integer value that is the elapsed I/O time of the
executing program in units of sixtieths of a second.
4 Returns an integer value of a 6-bit clock that increments
every sixtieth of a second.
6 Returns a real number for the date and time that may be
interpreted as follows:
T = CTIME (6)
DATE = ISOL (T,47,16) + 70000
TTIME = ISOL (T,31,32) * 16

where IDATE contains the date in Julian format YYDDD


where Y (year) and D (day) represent decimal digits. ITIME
is the time of day expressed in units of 2.4 microseconds.
Note that here ITIME is equal to CTIME(11).
7 Returns a real number that is the current date and time in
the following form:
bits
[47:12] Year (1900-1999)
[35:06] Month (1-12)
[29:06] Day (1-31)
[23:06] Hour (0-23)
[17:06] Minute (0-59)
[11:06] Second (0-59)
[05:06] Day of the Week (0=Sunday,
1=Monday, ..., 6=Saturday)

Note that the intrinsic function ISOL can be used to extract


information from the bit fields. For example, IYEAR = ISOL
(CTIME(7),47,12) assigns the current year to IYEAR.

3957 6053003 1213


Functions and Subroutines

Argument Returned
Result
9 Returns the current time as a real value containing six
EBCDIC characters in the format HHMMSS where H
(hours), M (minutes), and S (seconds) represent an EBCDIC
character from '0' through '9'. The CHARS intrinsic can be
used to extract the desired time information. For example:
CHARACTER TIMEX*6, HRS*2, MIN*2, SEC*2
TIMEX = CHARS(CTIME(9))
HRS = TIMEX(1:2) % ASSIGN HOURS
MIN = TIMEX(3:4) % ASSIGN MINUTES
SEC = TIMEX(5:6) % ASSIGN SECONDS

10 Returns the current date as a real value containing six


EBCDIC characters in the format xYYDDD (x is 8 bits of
zeros) where Y (year) and D (day) represent an EBCDIC
character from '0' through '9'.
11 Returns the same as 1 (time of day), except that the time
unit is 2.4 microseconds. For example, to convert to
seconds:
SEC = CTIME(11) * 2.4E-6

assigns the time of day (in seconds) to SEC.


12 Returns the same as 2 (elapsed processor time), except
that the time unit is 2.4 microseconds.
13 Returns the same as 3 (elapsed I/O time), except that the
time unit is 2.4 microseconds.
14 Returns the time elapsed since the last Halt/Load in units
of 2.4 microseconds.
15 Returns the current date as a real value containing six
EBCDIC characters in the format MMDDYY where M
(month), D (day), and Y (year) represent an EBCDIC
character from '0' through '9'.
16 Returns the same as 6 (date and time).
23 Returns a real number that contains system identification
information in the following form:
bits
[31:08] system type
0 - MCP system
1 - MCP system
2 - MCP/AS system
3 - MCP/AS (Extended) system
[23:16] System serial number

1214 3957 6053003


Functions and Subroutines

Argument Returned
Result
24 Returns the system type as a real value containing six
EBCDIC characters. The name is left-justified with blank fill.
For example, on an A17 system, a real containing 'A17 ' is
returned.
27 Returns the count of initial presence bit actions for the
calling task.
28 Returns the total time spent processing initial presence bit
actions for this task in units of 2.4 microseconds.
29 Returns the count of other presence bit bit actions for the
calling task.
30 Returns the total time spent processing other presence bit
actions for this task in units of 2.4 microseconds.
31 Returns a real number that contains the running MCP
version information in the following format:
[47:16] current release number
[31:16] current cycle number
[15:16] current patch number

These values are obtained from the $ VERSION option with


which the running MCP was compiled.

15. DATE(c) returns an EBCDIC character string of length 6 that represents the current
date at run time. The character constant argument c determines which date is
returned as indicated in the following table. M (month), D (day), and Y (year) (for
the date results) and H (hours), M (minutes), and S (seconds) (for the time result)
each represent an EBCDIC character from '0' through '9'.

Character Constant Description


'MMDDYY' Current date in the form MMDDYY'
YYMMDD' Current date in the form YYMMDD
'YYDDD' Current date in the form YYDDD (right-most
character is blank)
'HHMMSS' Current time of day in the form HHMMSS

16. The intrinsic function RANDOM returns a uniformly distributed pseudo-random


number between 0.0 and 1.0. The actual argument, which must be an integer
variable or integer array element, is modified by the intrinsic so that using the new
argument causes the next number in the pseudo-random sequence to be
returned. Each reference to the RANDOM intrinsic in an arithmetic expression
must be evaluated whenever the expression itself is evaluated. Good
pseudo-random sequences can generally be obtained if the starting value of the
argument is an odd integer close to 2**19.

3957 6053003 1215


Functions and Subroutines

17. The intrinsic functions AND and IAND return the full word logical product of all
data bits of the first argument with corresponding data bits of the second
argument.
18. The intrinsic functions COMPL and NOT return the full word logical complement of
all data bits of its argument.
19. The intrinsic function EQUIV returns the full word logical equivalence of all data
bits of the first argument with corresponding data bits of the second argument.
The bit pattern returned has 1 for each bit position in which the arguments agree,
and 0 where they are different. When both arguments are of type integer, the
exponent bits [45:07] are then set to 0.
20. The intrinsic functions OR and IOR return the full word logical sum of all data bits
of the first argument with corresponding data bits of the second argument.
21. A reference to the VALUE intrinsic returns a numeric value corresponding to a file
attribute mnemonic. The value intrinsic requires one argument, which is a valid file
attribute mnemonic. For a list of these mnemonics, refer to the ClearPath
Enterprise Servers Input/Output Subsystem Programming Reference Manual.
The compiler replaces the VALUE reference by the numeric value of the
mnemonic.
Examples:
INQUIRE (37, KIND=DEVICE, EXTMODE=XMODE)

IF (DEVICE .EQ. VALUE("DISK")) GO TO 35

IF (XMODE .EQ. VALUE ("BCL")) XMODE=VALUE ("EBCDIC")

22. The CONCAT intrinsic is provided to allow partial word manipulation. This intrinsic
takes five actual arguments. The first two of these arguments must be integer or
real variables. The last three arguments must be non-negative arithmetic
expressions. Thus, a typical CONCAT reference has the form: CONCAT(A, B, I, J,
K). The rounded values of I and J must be less than 48; the rounded value of K
must be less than or equal to 48.
The value returned from the intrinsic reference is equal to the word A with field
[I:K] replaced by field [J:K] from word B. Neither A nor B is changed by the
reference to CONCAT.
The following is an example of a program unit referencing the CONCAT intrinsic.

FUNCTION UNITE (P1, P2)


UNITE=CONCAT (P1, P2, 23, 47, 24)
RETURN
END

The value returned when UNITE is referenced is a word construction from P1 and
P2 in such a manner that the left-most 24 bits of P1 and the left-most 24 bits of P2
are placed into the word in that order.
It is more efficient to use the AND and OR intrinsics whenever possible, instead of
the CONCAT intrinsic.

1216 3957 6053003


Functions and Subroutines

23. Remaindering: A divide-by-zero fault occurs for MOD, AMOD, and DMOD when
the value of the second argument is 0.
24. Transfer of Sign: If the value of the first argument of ISIGN, SIGN, or DSIGN is 0,
the result is 0, which is neither positive nor negative.
25. Square Root: The value of the argument of SQRT and DSQRT must be greater than
or equal to 0. The result of CSQRT and CDSQRT is the principal value with the real
part greater than or equal to 0. When the real part of the result is 0, the imaginary
part is greater than or equal to 0.
26. Logarithms: The value of the argument of ALOG, DLOG, ALOG10, and DLOG10
must be greater than 0. The value of the argument of CLOG and CDLOG must not
be (0.,0.). The range of the imaginary part of the result of CLOG is: -PI< imaginary
part <= PI. The imaginary part of the result is PI only when the real part of the
argument is less than 0 and the imaginary part of the argument is 0.
27. Sine, Cosine, and Tangent: The absolute value of the argument of SIN, DSIN, COS,
DCOS, TAN, and DTAN is not required to be less than 2*PI.
28. Arcsine: The absolute value of the argument of ASIN, ARSIN, DASIN, and DARSIN
must be less than or equal to 1. The range of the result is: -PI/2 <= result <= PI/2.
29. Arccosine: The absolute value of the argument of ACOS, ARCOS, DACOS, and
DARCOS must be less than or equal to 1. The range of the result is: 0 <= result <=
PI.
30. Arctangent: The range of the result for ATAN and DATAN is: -PI/2 <= result <=
PI/2. If the value of the first argument of ATAN2 or DATAN2 is positive, the result
is positive. If the value of the first argument is 0, the result is 0 if the second
argument is positive, and PI if the second argument is negative. If the value of the
first argument is negative, the result is negative. If the value of the second
argument is 0, the absolute value of the result is PI/2. The arguments must not
both have the value 0.
31. The three arguments for ISOL (S, SB, LEN) are:
S: a real, integer, or logical expression representing the source of
the bit string to be isolated.
SB: an integer or real expression in the range 0-47. SB represents the
left-most bit in S that is to be isolated. Bits are numbered left to
right 47-0.
LEN: an integer or real expression indicating the number of bits to be
isolated. LEN must be in the range 0-48.
If there are insufficient bits to the right of SB to satisfy LEN, additional bits are
obtained starting at bit 47 and working toward SB. This has the effect of rotating
the bits in the word S.
For example: ISOL(A,10,12) would return a result consisting of the lowest 11 bits
and the highest bit of A, arranged as follows:
If the bits in A are:
47!...!10!9!8!7!6!5!4!3!2!1!0

3957 6053003 1217


Functions and Subroutines

The low 12 bits in the resulting word are:


10!9!8!7!6!5!4!3!2!1!0!47

The left-most 36 bits in the resulting word are zeros.


The range checks on SB and LEN are done at compile-time and run-time as
necessary. If both SB and LEN are constant expressions slightly better code is
generated.
The ISOL function may also be used on the left side of an assignment statement if
argument S is a real, integer, or logical variable or array element. Refer to
"Assignable Functions" in this section.
32. The CHARS function takes one argument, which can be an arithmetic expression
of type DOUBLE, INTEGER, COMPLEX, or REAL or a logical expression (type
LOGICAL). The function returns a character string representation of the bits in the
expression. This string varies in length with the argument given. If the argument
evaluates to type INTEGER, bits 31 through 0 of the expression result are returned
as a character string of length 4. If the argument is of type REAL or LOGICAL, then
all bits are returned as strings of length 6. If the argument is of type DOUBLE or
COMPLEX, then all bits are returned as strings of length 12.
33. Both arguments in the SKIP(source, target) function are expressions of type
CHARACTER. The source is of length one or more and the target is of length one.
If the second argument is more than one character long, the first character is used
as the target. The source is scanned from left to right for the target and the
function returns the index of the character that first fails the match. For example:

I=SKIP( READY, )

returns the value 4 since there are three spaces before the 'R'.
34. The intrinsic functions EOR and IEOR return the exclusive OR of all data bits of the
first argument with corresponding data bits of the second argument.
35. The intrinsic function SHFT(n1,n2) returns the value of the first argument logically
shifted n2 places. If n2 > 0, the shift is to the left. If n2 < 0, the shift is to the right.
Bits shifted out one end are lost and zeros are shifted in the other end. The
second argument must be an integer or real expression.
36. The intrinsic function ISHFT is identical to SHFT, except that the shift is only
performed on the right-most 32 bits of the first argument. That is, the left-most 16
bits are not affected. Within the 32 bits, any bits shifted out one end are lost and
zeros are shifted in the other end.
37. The intrinsic functions SHFTC(n1,n2,n3) and ISHFTC(n1,n2,n3) return the value of the
first argument with its n3 right-most bits circularly shifted n2 places. Other bits in
the word are unaffected. If n2 > 0, the shift is to the left. If n2 < 0, the shift is to
the right. The shift is circular; bits shifted out one end are shifted back in at the
other end. n2 and n3 must be integer or real expressions with 1 <= n3 <= 48.
38. The intrinsic functions BSET and IBSET return the value of the first argument with
its nth bit set where n is the value of the second argument. The second argument
must be an integer or real expression that evaluates to a value between 0 and 47
inclusive.

1218 3957 6053003


Functions and Subroutines

39. The intrinsic functions BCLR and IBCLR return the value of the first argument with
its nth bit cleared where n is the value of the second argument. The second
argument must be an integer or real expression that evaluates to a value between
0 and 47 inclusive.
40. The intrinsic function BTEST examines the nth bit of the first argument where n is
the value of the second argument. .TRUE. is returned if this bit is on (set to 1) and
.FALSE. is returned if this bit is off. The second argument must be an integer or
real expression that evaluates to a value between 0 and 47 inclusive.
41. The intrinsic functions BITS(n1,n2,n3) and IBITS(n1,n2,n3) return bits n2 through
n2+n3-1 of the first argument n1. The value returned contains these bits right-
justified with zero fill on the left. n2 is the second argument and specifies the
starting bit position. n3 is the third argument and specifies the number of bits to
extract. Unlike ISOL, the bit extraction goes from right to left. n2 and n3 must be
integers or reals with 0 <= n2 <= 47 and 1 <= n3 <= 48. (n2+n3-1) must not be
greater than 47. For example, BITS (X,36,8) returns bits 36 to 43 of X.
The BITS and IBITS functions may also be used on the left side of an assignment
statement if argument n1 is a real, integer, or logical variable or array element.
Refer to "Assignable Functions" in this section.
The range checks on n2 and n3 are done at compile-time and run-time if
necessary. If both n2 and n3 are constant expressions, slightly better code is
generated.
Note: Bit fields for BITS and IBITS are specified differently from usual A
Series conventions. Bits are numbered right to left from 0 to 47 as usual, but the
bit extraction goes from right to left (instead of the familiar left to right). That
is, a bit field contains the bits from the starting bit up to bit position (start +
length -1). For example, BITS (X,20,8) specifies bits 20 through 27.

To choose between IBITS and ISOL functions, which both perform bit field
isolation, consider that IBITS is specified in MIL-STD-1753 and is therefore more
likely to be found in other FORTRAN implementations, but ISOL generates better
code on ClearPath Enterprise Servers for non-constant bit fields.
42. The intrinsic functions UPPERCASE and UPPERC return a string identical to the
argument, except that all lowercase characters have been replaced by the
corresponding uppercase characters.
43. The intrinsic functions LOWERCASE and LOWERC return a string identical to the
argument, except that all uppercase characters have been replaced by
corresponding lowercase characters.
44. The intrinsic functions LEN_TRIM and TRMLEN return the length of the argument
string with the trailing blanks removed. If the argument contains only blank
characters, zero is returned.
45. The intrinsic function TRIM returns a string identical to the argument, except that
all trailing blanks have been removed. If the argument contains only blank
characters, an error is reported.
46. The intrinsic function ADJUSTL returns a string identical to the argument, except
that all leading blanks have been deleted and replaced with the same number of
trailing blanks.

3957 6053003 1219


Functions and Subroutines

47. The intrinsic function ADJUSTR returns a string identical to the argument, except
that all trailing blanks have been deleted and replaced with the same number of
leading blanks.

Statement Functions
A statement function is a procedure that is defined in a single statement similar to an
assignment statement. The statement function may be referenced only within the
program unit in which it is defined.

The format of a statement function statement is as follows:

 <function name>  (  )  = Q


| |
|   ,  |
| | | |
 <variable name> 
| |
 <array name> 

Q <expression> 

The relationship between the function name and the expression must conform to the
assignment rules for arithmetic, logical, and character assignment statements. Note
that the type of the expression may be different from the type of the statement
function.

The name of a statement function is a local name and must not be the same as the
name of any other entity in the program unit, except the name of a common block.

The length specification of a character statement function or statement function


dummy argument of type character must be an integer constant expression.

A statement function definition must appear after the specification statements and
before the first executable statement of a program unit. This is a non- executable
statement.

The type of value returned when a statement function is referenced depends upon
the type associated with the function name. A default type is associated with this
name in the same manner as for a variable. This default type may be changed by the
appearance of the function name in a TYPE statement or by the implicit typing of the
name in an IMPLICIT statement in the same program unit.

The statement function dummy argument list serves only to indicate order, number of
dimensions, and type of arguments for the statement function. The variable and array
names that appear as dummy arguments have a scope of only that statement. A given
symbolic name may appear only once in any statement function dummy argument list.
An external function reference in the expression that defines the statement function
may not redefine dummy arguments.

1220 3957 6053003


Functions and Subroutines

The expression for defining the statement function may contain constants, symbolic
names of constants, variables or array element references, or function references. If a
statement function is referenced in the definition, it must appear in preceding lines of
the program unit.

Each variable or array element reference may be either a reference to a dummy


argument of the statement function or a reference to a variable or array that appears
within the same program unit as the statement function statement.

If a statement function dummy argument name is the same as the name of another
entity, the appearance of that name in the expression of a statement function
statement is a reference to the statement function dummy argument. A dummy
argument that appears in a FUNCTION or SUBROUTINE statement may be referenced
in the expression of the statement function statement within the subprogram. A
dummy argument that appears in an ENTRY statement that precedes a statement
function statement may be referenced in the expression of the statement function
within the subprogram.

When a statement function reference is executed, its actual arguments must be


defined.

The following are examples of statement functions:

LOGICAL COMP
REAL ARRAY (4,5)
COMP(A) = A.LT.7.5 .OR. A.GT.10.6
ZTOTAL(A,B,C) = A + 2*B + 3*C
YFUNC(X) = X/3.6 + TOT
ZFUNC(X) = YFUNC(X) + X**02
ARYFUN (X, ARRAY, I) = ZFUNC(X) + ARRAY(1,I)

Assignable Functions
Assignable Intrinsic Functions
The BITS (also known as IBITS) and ISOL intrinsic functions may be used on the left
side of an assignment statement if the first parameter is a variable or array element.
The expression on the the right side of the assignment statement must be of type
real, integer, or logical.

Examples:
DIMENSION C(5)
A = BITS (B,0,3) % OK
BITS (B,0,3) = A % OK
BITS (B+1,0,3) = A % SYNTAX ERROR
BITS (C(A+1),D,E) = 5 % OK
BITS (SIN(A),D,E) = 5 % SYNTAX ERROR

3957 6053003 1221


Functions and Subroutines

The effect of an assignment to the ISOL or BITS function is that the expression on the
right side of the assignment is put into a bit field of the first argument. The bit field is
specified by the second and third arguments and is the same as described currently
for ISOL and BITS. Unlike when the functions are used as expressions, only the field
specified is affected (there is no zero fill); the other bits of the first argument are not
changed. Only the lowest bits of the expression are on the right side of the
assignment are used. In other words, "BITS (A,B,C) = <expr>" is the same as "BITS
(A,B,C) = BITS (<expr>,0,C)".

"BITS (A,B,C) = D" performs the same function as the intrinsic subroutine call "CALL
MVBITS (D,0,C,A,B)"; "ISOL (A,B,C) = D" performs the same function as the intrinsic
subroutine call "CALL MVBITS (D,0,C,A,B-C+1)". BITS and ISOL are more efficient than
MVBITS, but MVBITS is more versatile (MVBITS allows the specification of the source
field).

If an assignable function is used on the left side of an assignment statement, it cannot


appear as the first executable statement in the program unit unless it appears in an
INTRINSIC statement. If an assignable function is used on the left side of an
assignment statement and appears as the first executable statement of a program
unit and is not in an INTRINSIC statement, the statement is interpreted as a statement
function definition statement.

Assignable Statement Functions


A statement function reference may be used on the left side of an assignment
statement if one of the following three conditions are met:

1. The statement function definition defines the function to be a variable or an array


element. The statement function name is an arithmetic type or the same type as
the variable.
2. The statement function definition defines the function to be an assignable intrinsic
function. The statement function name is a type compatible with the type of the
intrinsic function. The statement function reference evaluates to the requirements
for assignable intrinsic functions to be the target of an assignment. (That is, the
first argument to the intrinsic function must be a variable or array element.)
3. The statement function definition defines the function to be a statement function
reference conforming to these rules. The statement function definition name is
the same type as the statement function reference.
Examples
DIMENSION C(5)
A(I) = C(I) % ALWAYS ASSIGNABLE (1)
L() = N % ALWAYS ASSIGNABLE (1)
M(I) = C(I) % NOT ASSIGNABLE (1 - TYPES)
FIELD1 (I) = BITS (I,0,9) % POSSIBLY ASSIGNABLE (2)
FIELD (J,K) = BITS (C(2),J,K) % ALWAYS ASSIGNABLE (2)
FIELD2 (X) = BITS (SIN(X),10,19) % NOT ASSIGNABLE (2 NOT VAR)
FIELD3 () = FIELD (7,N) % ALWAYS ASSIGNABLE (3)
L() = 3 % N IS ASSIGNED 3
FIELD (1,2) = 3 % C(2) WILL EQUAL 6

1222 3957 6053003


Functions and Subroutines

A(1) = FIELD (0,2) % C(1) WILL EQUAL 2


FIELD1 (L()) = 99 % N WILL EQUAL 99
FIELD1 (INT(SIN(.5))) = 99 % SYNTAX ERROR (2 - NOT VAR)
F = FIELD1 (INT(SIN(.5))) % OK (CAN STILL USE AS EXPR)
FIELD2 (.5) =6 % SYNTAX ERROR (1 @ DECL)
G = FIELD2 (.5) % OK (CAN STILL USE AS EXPR)

Defined Statement Functions


A statement function can also be interpreted as a "macro" or "define." While the
compiler control option DEFINEDSTMTFUN is true, statement function definitions are
interpreted by the compiler as text substitution instructions. As with non-defined
statement functions, the expression must be assignment- compatible with the type of
the name of the function. However, the checking for this is done at reference time,
not at the statement function statement.

A defined statement function may have no more than 255 arguments.

There are several effects of setting DEFINEDSTMTFUN:

1. The statement function is not analyzed for the <expression> syntax at the time of
the declaration. If a syntax error exists, it is reported at each reference to the
<function name>.
2. Either or both the declaration or reference of the statement function may or may
not conform to ANSI requirements.
3. The types of the <variable names> used as dummy arguments are not significant.
There is no type checking at declaration time.
4. The <variable names> are purely dummy arguments; they do not have to be
variables at all, they can be any legal <symbolic name>. Conversely, the use of a
name as a dummy argument does not affect the use of the name outside of the
statement function.
5. A reference to a defined statement function results in a text substitution using
actual arguments (if any). One consequence of this is that the same statement
function may referenced with many different types of arguments and still evaluate
to a correct <expression>.
6. A statement function reference may be used on the left side of an assignment
statement as long as the reference results in an assignable entity (variable, array
element, assignable intrinsic function, or other assignable statement function).
This is a more relaxed requirement than for non-defined statement functions.
7. When used as an expression, the type returned by a defined statement function
reference is the type of the name of the defined statement function. A type
conversion is performed as necessary between the type of the expression
resulting from text substitution and the type of the defined statement function
name as per normal FORTRAN77 typing rules.

3957 6053003 1223


Functions and Subroutines

8. When a defined statement function reference is used on the left side of an


assignment statement, all statement functions referenced during text substitution
(including those in the statement function declaration) must be either the same
type or an arithmetic type. The specific types of such statement functions have no
effect on the resulting assignment statement. If text substitution results in a
variable on the left side, a type conversion is performed between the type of the
expression on the right side and the variable. If text substitution results in an
assignable function (ISOL or BITS) on the left side, no type conversion is
performed (and the expression on the right side must be INTEGER, REAL, or
LOGICAL).
Examples:
$ SET DEFINEDSTMTFUN
DOUBLE PRECISION DBL
DIMENSION ARY (1:9)
DBL (X) = ISOL (X, 2, 3)
INTGR (X,Y) = X (Y)

DBL (A) = B
INTGR (ARY,3) = 1.2
B = DBL (A)
B = INTGR (ARY,3)

C* THE LAST FOUR STATEMENTS ARE THE SAME AS:


ISOL (A, 2, 3) = B
ARY(3) = 1.2
B = REAL (DBLE (ISOL (A,3,3)))
B = REAL (INT (ARY(3)))
END

External Functions
An external function is a procedure that is specified external to the program unit that
references external functions it. It is specified in a function subprogram.

A function subprogram is a sequence of statements initiated by a function statement


and terminated by an END statement. A function subprogram specifies one or more
external functions. The FUNCTION statement indicates the beginning of a function
subprogram and specifies the dummy arguments used in that subprogram to obtain
the function value. The maximum number of arguments used by an external function
is 255.

The format for a FUNCTION statement is as follows:

1224 3957 6053003


Functions and Subroutines

 FUNCTION  <function name>  <function arg list> 


| |
 <type> 

<type>

 INTEGER 


| | | |
 REAL   * <length spec> 
| |
 DOUBLE PRECISION 
| |
 COMPLEX 
| |
 DOUBLE COMPLEX 
| |
 LOGICAL 
| |
 CHARACTER 

<func arg list>


 (  ) 
| |
|   ,  |
| | | |
 <variable name> 
| |
 /  <variable name>  / 
| |
 <array name> 
| |
 /  <array name>  / 
| |
 <procedure name> 
| |
 /  <procedure name>  / 

A FUNCTION statement must appear only as the first statement of a function


subprogram.

The name of an external function is a global name and must not be the same as any
other global name or any local name, except a variable name, in the function
subprogram.

The name of the function subprogram must appear as a variable name in the
subprogram. During every execution of the external function, this variable must
become defined, and once defined, may be referenced or become redefined. The
value of this variable when a RETURN or END statement is executed in the
subprogram is the value of the function. If this variable is a character variable with a
length specification of an asterisk in parentheses, (*), it must not appear as an operand
for concatenation, except in a character assignment statement. In addition to returning
the value of the function, an external function may define dummy arguments to return
values.

Note: If the type of a function is specified in a FUNCTION statement, the function


name must not appear in a type statement. A warningresults if a name has its type
explicitly specified more than once in a program unit.

3957 6053003 1225


Functions and Subroutines

When an external function is referenced in a program unit, it must be of the same


type as the function declaration. If a function is a character function, the length of the
character function in the program unit in which it is referenced must be the same as
the declared length.

In a function subprogram, the name of a dummy argument is local to the program unit
and must not appear in an EQUIVALENCE, PARAMETER, SAVE, INTRINSIC, DATA, or
COMMON statement, except as a common block name. A character dummy
argument, whose length specification is an asterisk in parentheses, (*), must not
appear as an operand for concatenation, except in a character assignment statement.

The actual arguments in an external function reference must agree in order, number,
and type with the corresponding dummy arguments in the referenced function. The
use of a subroutine name as an actual argument is an exception to the rule requiring
agreement of type.

The actual arguments in the reference of an external function may be an array name,
an intrinsic function name, an external procedure name, a dummy procedure name, or
any expression, except a character expression involving concatenation of an operand
whose length specification is an asterisk in parentheses, (*), unless the operand is the
symbolic name of a constant.

Note that if there are no dummy arguments in the function statement, the function
must be referenced with an empty actual argument list.

The following are sample function statements and sample references to these
functions:

FUNCTION ZTEMPP(I,X,Y)
DIMENSION Y(10)
...
RETURN
END

The preceding function may be referenced as in the following program excerpt:

DIMENSION A(10),B1(5)
...
...
B1(I*03) = ZTEMPP(J,C1,A)/FRT + OL(6+TOL)
...
END

The following is the logical function LFIND:

LOGICAL FUNCTION LFIND()


...
RETURN
END

1226 3957 6053003


Functions and Subroutines

This function may be referenced as in the following program excerpt:

LOGICAL LFIND
...
...
IF (LFIND()) GO TO 95
....

The following is the character function RANGER:

CHARACTER FUNCTION RANGER(A,B)


CHARACTER A,B*(*)
...
...
RETURN
END

This function may be referenced as in the following program excerpt:

CHARACTER RANGER,CHR1,CHR2,CHR3
...
...
IF (RANGER(CHR1,CHR2).LT.CHR3) GO TO 35
...

The following is the character function CCONVT:

CHARACTER*02 FUNCTION CCONVT(A)


CHARACTER A*(*)
...
...
RETURN
END

The preceding function may be referenced as in the following program excerpt:

CHARACTER CCONVT,CHAR1*02,CHAR2*06,CHAR3*08
...
CHAR3 = CCONVT(CHAR1)//CHAR2
...
...

Subroutines
A subroutine, if it is not an intrinsic, is a procedure that is specified external to the
program unit that references it. It is specified in a subroutine subprogram.

A subroutine subprogram is a sequence of statements initiated by a subroutine


statement and terminated by an END statement.

3957 6053003 1227


Functions and Subroutines

SUBROUTINE Statement
The SUBROUTINE statement indicates the beginning of a subroutine subprogram and
may specify the dummy arguments used in that subprogram. The maximum allowable
arguments for any single subprogram is 255.

The format of a SUBROUTINE statement is the following:

 SUBROUTINE  <subroutine name>  <sub arg list> 

<sub arg list>


| |
 (  ) 
| |
|   ,  |
| | | |
 <variable name> 
| |
 /  <variable name>  / 
| |
 <array name> 
| |
 /  <array name>  / 
| |
 <procedure name> 
| |
 /  <procedure name>  / 

A subroutine subprogram specifies one or more subroutines; it is a program unit that


has a SUBROUTINE statement as its first statement.

The name of a subroutine is a global name and must not be the same as any other
global name or any local name in the program unit.

In a subroutine subprogram, the name of a dummy argument is local to the program


unit and must not appear in an EQUIVALENCE, PARAMETER, SAVE, INTRINSIC, DATA,
or COMMON statement, except as a common block name. A character dummy
argument whose length specification is an asterisk in parentheses, (*), must not
appear as an operand for concatenation, except in a character assignment statement.

A subroutine subprogram is referenced by a CALL statement. Note that if there are no


dummy arguments, the SUBROUTINE statement may be used with or without empty
parentheses. A subroutine specified by either form may be referenced by a CALL
statement of either form.

The following are examples of subroutine statements:

SUBROUTINE SUBA
SUBROUTINE MULTMT(ARRAY1,ARRAY2)
SUBROUTINE MAXI(A,B,C,*,D,E)
SUBROUTINE GFOR(Z,FUNC)
SUBROUTINE PHASEA()

1228 3957 6053003


Functions and Subroutines

Intrinsic Subroutines
Intrinsic subroutines are subroutines that are known to the compiler and need not be
supplied in the program. These subroutines may not be passed as actual arguments to
subprograms. Table 12-2 describes intrinsic subroutines.

Table 121. Intrinsic Subroutines

Intrinsic Subroutine Definition Number of Specific Type of Argument


Arguments Name

Character Data Transfer See Note 1. 3 MOVE See Note 1.


Filling Area See Note 2. 3 FILL See Note 2.
EBCDIC to ASCII See Note 3. 3 ASCII See Note 3.
Conversion
ASCII to EBCDIC See Note 3. 3 EBCDIC See Note 3.
Conversion
Fault Handling See Note 4. 1 DVCHK Real Integer
Fault Handling See Note 5. 1 OVERFL Real Integer
Bit Manipulation See Note 6. 5 MVBITS See Note 6.
Program Termination See Note 7. 0 EXIT N/A
Library Creation See Note 8. 1 FREEZE Character Constant
Character Translation See Note 9. 4 TRANS See Note 9.
Sort See Note 10. 3 or 4 FSORT See Note 10.
Merge See Note 10. 4 to 11 FMERGE See Note 10.
Define Collating See Note 11. 2 COLLSEQ See Note 11.
Sequence
Establish Collating See Note 11. 0 or 1 FSSEQ See Note 11.
Sequence
Define Translate Table See Note 12. 2 TRANSTB See Note 12.
L

Notes for the table:


1. The three arguments for the MOVE subroutine are DEST, SRC, and LEN, where
MOVE transfers LEN characters from SRC to DEST.
DEST: a REAL or CHARACTER array or subscripted array reference, or a
CHARACTER variable or substring. DEST specifies the address of
the first destination character of the move.
SRC: a REAL or CHARACTER array or subscripted array reference, or a
CHARACTER variable or expression. SRC specifies the address
of the first source character to be moved.
LEN: an integer or real expression giving the number of characters to
be transferred.

3957 6053003 1229


Functions and Subroutines

MOVE treats DEST and SRC as pointers into character strings and attempts to
transfer LEN characters from SRC to DEST without regard to word boundaries or
values. The exception to this rule is that words containing label information may
not be moved. For example, the ASSIGN statement "ASSIGN 10 TO I" makes it
impossible to move the word I.
Example:
REAL A(14,10)
CHARACTER NAME(10)*60, DATE(10)*10
INTEGER AGE(10)
REAL SALARY(10)
READ (1) A
DO 10 I = 1,10
CALL MOVE ( NAME(I), A(1,I), 60 )
AGE(I) = A(11,I)
CALL MOVE ( DATE(I), A(12,I), 10 )
SALARY(I) = A(14,I)
10 CONTINUE

2. The statement CALL FILL (DEST, SRC, LEN) causes the value of SRC to be placed at
successive locations beginning at DEST until the character count LEN has been
exhausted.

DEST: a REAL or CHARACTER array or subscripted array reference, or a


CHARACTER variable or substring. DEST specifies the address of
the first character of the destination.
SRC: an arithmetic expression. If SRC is a single precision expression
its length is 6. If SRC is a double precision expression its length is
12. SRC specifies the value to be transferred.
LEN: an integer or real expression giving the number of characters to
be transferred. If LEN is greater than the length of SRC then
multiple copies of SRC are transferred. If LEN is greater than the
length of the array pointed at by DEST, then a run-time fault
occurs.

FILL attempts to fill the area pointed to by DEST with copies of SRC until LEN is
satisfied. If DEST points into a COMMON area, the area from DEST to the end of
COMMON is FILLed for up to LEN character positions.
Example:
CHARACTER*12 A
REAL B(5)
REAL X/ABCDE/
A=############
CALL FILL (A,X,8)
PRINT *,A
DO 10 K=5,12
CALL FILL (B(1),5,K)
PRINT *,B

1230 3957 6053003


Functions and Subroutines

10 CONTINUE
END

When the previous program is run, the following output is produced:


ABCDE AB####
5*0.0
5.0 4*0.0
5.0 4*0.0
5.0 4*0.0
5.0 4*0.0
5.0 4*0.0
5.0 4*0.0
2*5.0 3*0.0

3. The intrinsic subroutines ASCII and EBCDIC both take three arguments: DEST, SRC,
and LEN. ASCII causes the EBCDIC characters in SRC to be translated into ASCII
characters in DEST for LEN characters. Conversely, EBCDIC causes the ASCII
characters in SRC to be translated into EBCDIC characters in DEST for LEN
characters.

DEST: a REAL, INTEGER, LOGICAL, or CHARACTER array or subscripted


array reference, a CHARACTER variable or a CHARACTER
substring. DEST specifies the address of the first character of the
destination.
SRC: a REAL, INTEGER, LOGICAL, or CHARACTER array or subscripted
array reference, a CHARACTER variable, a CHARACTER
substring, or a CHARACTER constant. SRC specifies the address
of the first character of the source.
LEN: an integer or real expression giving the number of characters to
be translated.

ASCII and EBCDIC treat DEST and SRC as pointers into a character string and
attempt to translate LEN characters from SRC to DEST without regard to word
boundaries or value. If SRC and DEST character addresses are within eight
characters of each other, the results are undefined.
4. The intrinsic subroutine DVCHK allows the program to handle divide-by-zero faults.
If at least one call to the intrinsic DVCHK appears anywhere in the program and a
divide-by-zero fault occurs during the execution of the program, a zero is returned
as the result and the execution of the program continues.
When the DVCHK intrinsic is executed, a value is returned to its argument
indicating whether or not a divide-by-zero fault has occurred since the last call on
DVCHK or, in the case of the first call, since the beginning of the program. A one is
returned when a divide-by-zero has occurred. Otherwise, a two is returned.
The DVCHK intrinsic takes one argument that must be a variable or array element
of type real or integer. DVCHK may not be passed as an actual argument to a
subprogram. DVCHK may not be used in conjunction with binding.

3957 6053003 1231


Functions and Subroutines

5. The intrinsic subroutine OVERFL allows the program to handle exponent overflow
and exponent underflow faults. If at least one call to the intrinsic OVERFL appears
anywhere in the program and an exponent overflow or exponent underflow fault
occurs during the execution of the program, a result is returned and program
execution continues from that point. When exponent overflow occurs, the largest
possible real or double precision value is returned as the result. When exponent
underflow occurs, zero is returned.
When the OVERFL intrinsic is executed, a value is returned to its argument
indicating whether an exponent overflow or exponent underflow fault has
occurred since the last call of OVERFL or, in the case of the first call, since the
beginning of the program. A one is returned when exponent overflow has
occurred; a two is returned when neither exponent overflow nor exponent
underflow has occurred; and a three is returned when exponent underflow has
occurred.
The OVERFL intrinsic takes one argument that must be a variable or array element
of type real or integer. OVERFL may not be passed as an actual argument to a
subprogram. OVERFL may not be used in conjunction with binding.
6. The intrinsic MVBITS takes five arguments: SRC, SB, LEN, DEST, and DB. MVBITS
transfers a bit field from a "source" to a bit field of a "destination".

SRC: an integer, real, or logical expression that represents the "source".


SB: the starting bit of the bit field of the source from which the bit
transfer begins. This must be an integer or real expression
between 0 and 47 inclusive.
LEN: the length of the bit field transfer. This must be an integer or real
expression between 1 and 48 inclusive.
DEST: a real, integer, or logical variable or array element that represents
the "destination" for the bit transfer.
DB: the starting bit in the destination where the bits are to be
transferred. This must be an integer or real expression between 0
and 47 inclusive.<ENDCOLTABLE>

MVBITS assign SRC.[SB+LEN-1:LEN] to DEST.[DB+LEN-1:LEN]. Note that SB+LEN-1


and DB+LEN-1 must reference a valid bit position (for example, between 0 and 47
inclusive).
Note: Bit fields for MVBITS are specified differently from usual A Series
conventions. Bits are numbered right to left from 0 to 47 as usual, but the bit
extraction goes from right to left (instead of the familiar left to right). That is, a
bit field contains the bits from the starting bit up to bit position (start + length -
1).

As an example, CALL MVBITS (S, 4, 12, D, 32) transfers bits 4 through 15 of S to


bits 32 through 43 of D.

1232 3957 6053003


Functions and Subroutines

7. Execution of the intrinsic subroutine EXIT causes termination of the program. CALL
EXIT performs a similar function to that of the STOP statement, except that no
message is displayed.
The intrinsic subroutine EXIT takes no arguments and cannot be passed as an
actual argument to a subprogram.
8. The FREEZE intrinsic changes the running program into a library stack. The
character constant argument must be either 'TEMPORARY' or 'PERMANENT'. See
Section 18 for more information on creating libraries.
9. The intrinsic subroutine TRANS translates the characters in the source into the
destination under the control of a translate table for the specified length. Each
source character is used as an index into the translate table. The character found
at that position in the table is moved to the destination string. The TRANS routine
takes four arguments:

DEST: Same as in Note 3.


SRC:
LEN:
TABLE: An array defined as REAL with 64 elements. This array
contains the translate table and is specified using the
COLLSEQ or TRANSTBL intrinsic subroutine.

10. The intrinsic subroutines FSORT and FMERGE perform a sort or merge,
respectively. A sort accepts records from the input, arranges them in order, and
returns them to the output. A merge accepts sorted records from multiple inputs
and merges them in order to a single output. These subroutines take four kinds of
arguments:

INFO: a CHARACTER array or subscripted array reference, a


CHARACTER variable, a CHARACTER substring, or a
CHARACTER constant. This character string describes how
the sort or merge will operate.
INPUT: a logical unit number or a subroutine defined in an
EXTERNAL statement. If a logical unit number, the records
to be arranged are read from the unit. If a subroutine, the
subroutine is called to retrieve each record. It is called once
for each record. There is one INPUT argument for a sort and
between 2 and 8 INPUT arguments for a merge.
OUTPUT: a logical unit number or a subroutine defined in an
EXTERNAL statement. If a logical unit number, the arranged
records are written to the unit. If a subroutine, the
subroutine is called once for each record.
COMPARE: an optional argument that may be a subroutine defined in an
EXTERNAL statement. If it appears, the subroutine is called
whenever two records are compared. The subroutine
determines the order of the records. If it does not appear,
the order is determined by keys described in the INFO
argument.

3957 6053003 1233


Functions and Subroutines

The INFO argument is a character string that describes the operation of the sort or
merge. It contains a number of clauses, each of which describes an attribute of
the process. If an attribute has multiple parts, those parts are contained in
parentheses. The clauses are separated by blanks or commas. Examination of the
string is terminated at the end of the string or when a period occurs. The following
clauses describe the operation of the sort:
RSZ=rlth record length in bytes

KEY=key-desc describes a single key


KEY=(d,...,d) describes several keys
each key description takes the form:
position/length/sequence/type
position position beginning at 1 in bytes
unless hex type
length in bytes unless hex type default 1
sequence A (ascending) or D (descending) default A
type character specifying format, each format is
byte- or hex-oriented, which can affect
position and length. The types are
(default N):
N - display numeric
S - alphabetic/alphanumeric
B - integer binary
E - real, binary with exponent
X - double, extended
V - left overpunched sign
Q - right overpunched sign
R - left separate sign
T - right separate sign
U - unsigned hex
L - left signed hex
P - right signed hex

COMP appears if, and only if, a comparison routine is used,


one of either COMP or KEY must appear

DUPL indicates duplicate keys should be ordered based on


appearance (SORT only)

CORE=size core size in words (default 12000), if the size


specified is below the minimum (8000) then an
appropriate size is calculated for you

WORKFILE=type describes type of a single workfile (may be abbreviated


WORK)

WORKFILE=(t,t) describes disk and tape workfiles. The workfile type


may be:
DISK/size

1234 3957 6053003


Functions and Subroutines

DISK indicates disk workfile size is number of


words, default 600,000, if the size is below the
minimum (180,000) then an appropriate size is
calculated for you
TAPE/#tapes
TAPE indicates tape workfiles #tapes indicates
number of tapes, between 3 and 8, default 3
if no workfiles are specified, a memory only sort is
performed

CCSVERSION=name specifies coded character set version


CCSVERSION uses default version if no name is specified

RESTART=r-val describes restart functions (default 0). The values


for r-val are:
0 - no restart capability
1 - restart previous sort, the prior uncompleted
sort must have allowed restart
9 - restart previous sort if all input has been
received, the prior uncompleted sort must
have allowed restart
2 - allow restart
6 - allow restart and enable extensive error
recovery from I/O errors
10 - allow restart only after all input has been
received
14 - allow restart only after all input has been
received and enable extensive error recovery
from I/O errors

The input procedure, if used, is a subroutine defined in an EXTERNAL statement


that has three parameters. The first parameter is the record, defined to be a
character variable. The second parameter is the length of the record in characters.
The third parameter is used to indicate when the input is finished and is defined to
be a logical variable. If true, then the record is ignored and the input procedure is
not called again.
The output procedure, if used, is a subroutine defined in an EXTERNAL statement
that has two parameters. The first parameter is the record, defined to be a
character variable. The second parameter is the length of the record. The output
procedure is called once for each record to be output.
The comparison procedure, if used, is a subroutine defined in an EXTERNAL
statement that has three parameters. The first and second parameters are
records, defined to be character variables. The third parameter is an integer that
specifies the relation between the two records. It is set to 1 if the record in the
first parameter precedes the record in the second parameter, 2 if the order is
immaterial, and 3 if the first record follows the second record.

3957 6053003 1235


Functions and Subroutines

The following example creates a set of test records, sorts them in ascending
order, and merges them with an existing file, eliminating any records with
duplicate keys. The comparison routine ensures that test records with duplicate
keys appear after existing records.
FILE 1(FILE=SORT/EXAMPLE/INPUT; ,STATUS=OLD,MAXRECSIZE=6)
FILE 2(FILE=SORT/EXAMPLE/TEST. ,STATUS=NEW,MAXRECSIZE=6)
FILE 3(FILE=SORT/EXAMPLE/OUTPUT. ,STATUS=NEW,MAXRECSIZE=6)

INTEGER COUNT, RANDOMARG


COMMON COUNT, RANDOMARG
EXTERNAL INPROC, COMPPROC, OUTPROC

COUNT = 0
RANDOMARG = TIME( 11 )

CALL FSORT(RSZ=36 KEY=1/6/A/N, INPROC, 2 )

OPEN( 3 )
CALL FMERGE(RSZ=36 KEY=1/6 . COMP,
* 1, 2, OUTPROC )
CLOSE( 3 )

STOP
END

SUBROUTINE INPROC( RECORD, LTH, EOF )


CHARACTER*36 RECORD
LOGICAL EOF
INTEGER COUNT, RANDOMARG
COMMON COUNT, RANDOMARG
LTH = 36
EOF = COUNT .GE. 100
IF( EOF ) RETURN
COUNT = COUNT + 1
KEY = RANDOM( RANDOMARG ) * 1000
WRITE( RECORD, 91 ) KEY, *TEST*
91 FORMAT( I6.6, 6X, A6, 18X )
RETURN
END

SUBROUTINE COMPPROC( RECA, RECB, RESULT )


CHARACTER*36 RECA, RECB
INTEGER RESULT
IF( RECA(1:6) .LT. RECB(1:6) ) THEN
RESULT = 1
ELSE IF( RECA(1:6) .GT. RECB(1:6) ) THEN
RESULT = 3
ELSE
IF( RECA(13:18) .EQ. *TEST* ) THEN

1236 3957 6053003


Functions and Subroutines

RESULT = 3
ELSE IF( RECB(13:18) .EQ. *TEST* ) THEN
RESULT = 1
ELSE
RESULT = 2
END IF
END IF
RETURN
END

SUBROUTINE OUTPROC( RECORD, LTH )


CHARACTER RECORD*(*)
INTEGER COUNT, RANDOMARG
COMMON COUNT, RANDOMARG, LASTKEY
READ( RECORD, FMT = (I6) ) KEY
IF( KEY .NE. LASTKEY ) THEN
WRITE( 3, FMT = (A36) ) RECORD
ELSE
WRITE( 6, FMT = (1X, A12, A36) ) DUPLICATE: ,RECORD
END IF
LASTKEY = KEY
RETURN
END

For more information on how the Sort operates, see the ClearPath Enterprise
Servers System Software Utilities Operations Reference Manual.
11. Sorting may be done on the basis of an alternate collating sequence. Normally,
characters are sorted on the basis of the EBCDIC character sequence. Every
character is assigned a position in the sequence. An alternate collating sequence
allows a different ordering of the characters. For example, EBCDIC specifies that
lower case letters precede upper case letters. An alternate collating sequence can
be written to make them equal. There are two routines for handling alternate
collating sequences: COLLSEQ and FSSEQ. COLLSEQ creates a sequence and
FSSEQ establishes a sequence for use by the Sort. The TRANS routine may also
be used with an alternate collating sequence. For sorting, TRANS is most often
used in user-defined compare routines that use the alternate collating sequence
order, but must provide other code.
The COLLSEQ subroutine creates an alternate sequence. It takes two arguments:
DESC: A CHARACTER array or subscripted array reference, a
CHARACTER variable, a CHARACTER substring, or a
CHARACTER constant. This character string describes the
order of characters in the alternate collating sequence.
TABLE: An array defined as REAL with 64 elements. This array contains
the alternate collating sequence in the form of a translate
table.

3957 6053003 1237


Functions and Subroutines

The DESC string lists the characters of the new sequence in order. In other words,
the first character specified becomes first in the sequence, the next character
becomes the second, and so on. A character is specified in a character string or by
a number (0-255) that specifies its position in the original collating sequence.
Multiple characters may be specified in the character string or by a range of
numbers (for example, 0-128). Characters that have equal positions in the
sequence are indicated by "&". The last character in the DESC string must be a
period. The ASCII sequence may be specified by using 'ASCII . '.
The FSSEQ routine establishes an alternate collating sequence for use with FSORT
and FMERGE. Once executed, all following sorts and merges use the alternate
collating sequence to compare character keys. If FSSEQ is executed with no
arguments, then the original (EBCDIC) sequence is reestablished.

TABLE: An array defined as REAL with 64 elements. This array


contains the alternate collating sequence created with
COLLSEQ.

The following program uses a collating sequence where digits appear before
letters, comma and period are equal, and lower case letters appear immediately
after their upper case counterparts:
CHARACTERS*256 INP
REAL TABLE(64)
INP = 0-74 "." & "," 76-106 108-128
* // "0123456789"
* // "AaBbCcDdEeFfGgHhIiJjKkLlMm
* // NnOoPpQqRrSsTtUuVvWwXxYyZz" .
CALL COLLSEQ( INP, TABLE )
CALL FSSEQ( TABLE )
CLOSE( 6 )
CALL FSORT( RSZ=72 KEY=1/36//S, 5, 6 )
STOP
END

12. The intrinsic subroutine TRANSTBL builds a translate table for use with the TRANS
intrinsic subroutine. The TRANSTBLE subroutine takes two parameters:

DESC: A CHARACTER array or subscripted array reference, a


CHARACTER variable, a CHARACTER substring, or a
CHARACTER constant. This character string describes which
source characters are translated into which destination
characters.
TABLE: An array defined as REAL with 64 elements. This array
contains the translate table in a form appropriate for use by
the TRANS intrinsic subroutine.

1238 3957 6053003


Functions and Subroutines

The DESC string consists of a series of clauses that describe the translation. Each
clause lists which source characters are to be translated to which destination
characters. The table is built by applying each clause in order. Characters not
specified are translated to 0. The source and destination are separated by the
word TO. Each source or destination may either be a character string (surrounded
by quotes), a number between 0 and 255 (corresponding to its position in the
collating sequence), a sequence of characters specified by two characters or
numbers separated by a hyphen, or a pre-defined table (EBCDIC, ASCII, or HEX).
The number of characters in the destination must either be equal to the number in
the source or 1.
The following program translates lower case characters to upper case characters
and unprintable characters found before the space to the period character.
CHARACTER*256 INP
CHARACTER*20 TEST,RSLT
REAL TABLE(64)

INP = EBCDIC TO EBCDIC


* // 0-63 TO "."
* // "abcdefghijklmnopqrstuvwxyz" TO
* // "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
CALL TRANSTBL( INP, TABLE )
10 READ(5,END=20,FMT=(A10))TEST
CALL TRANS( RSLT, TEST, 10, TABLE )
PRINT 91, TEST,RSLT
91 FORMAT(1X,A10,5X,A10)
GO TO 10

20 STOP
END

3957 6053003 1239


Functions and Subroutines

CALL Statement
A subroutine is referenced by a CALL statement.

The format of a CALL statement is as follows:

 CALL  <subroutine name>  <call arg list> 

<call arg list>


| |
 (  ) 
| |
|   ,  |
| | | |
 <expression> 
| |
 <array name> 
| |
 <procedure name> 
| |
 *  <label> 
| |
 & 

Execution of a CALL statement results in the evaluation of actual arguments that are
expressions, the association of actual arguments with the corresponding dummy
arguments, and the transfer of control into the subroutine subprogram that is
referenced. Return of control from the referenced subroutine completes execution of
the CALL statement.

The actual arguments in a subroutine reference must agree in order, number, and type
with the list of arguments in the referenced subroutine. The use of a subroutine name
or an alternate return specifier as an actual argument is an exception to the rule
requiring agreement of type.

Each actual argument in a CALL statement must be an array name, an intrinsic function
name, an external procedure name, a dummy procedure name, an alternate return
specifier, or an expression. A character expression involving concatenation of an
operand whose length specification is an asterisk in parentheses, (*), is not allowed,
unless the operand is the symbolic name of a constant.

An alternate return specifier has the form *<label> (or &<label>) where the label is a
statement label of an executable statement that appears in the same program unit as
the CALL statement.

The following are examples of CALL statements:

CALL SUBA()
CALL MULTMT(ARRAYA,ARRAYB)
CALL MAXI(U,V,W,*30,X,Y)
CALL GFOR(2*C(3)/4.1,FACTOR)
CALL PHASEA

1240 3957 6053003


Functions and Subroutines

ENTRY Statement
An ENTRY statement permits a procedure reference to begin with a particular
executable statement within the function or subroutine subprogram in which the
ENTRY statement appears. One or more ENTRY statements may appear within a
function subprogram after the FUNCTION statement, or within a subroutine
subprogram after the SUBROUTINE statement. An ENTRY statement must not appear
between a block IF statement and its corresponding END IF statement, or between a
DO statement and the terminal statement of its DO-loop.

An ENTRY statement is classified as a non-executable statement.

The format of an ENTRY statement is the following:

 ENTRY  <function name>  <func arg list> 
| |
 <subroutine name>  <sub arg list> 

If an ENTRY statement appears in a subroutine subprogram, the ENTRY name is also a


subroutine name and is referenced as a subroutine. If the ENTRY name appears in a
function subprogram, the ENTRY name is also an external function name and is
referenced as a function. Note that if there are no dummy arguments, the ENTRY
statement may be used with or without empty parentheses. A function that is
specified by either form must be referenced by an ENTRY statement with empty
parentheses. A subroutine that is specified by either form may be referenced by a
CALL statement of either form.

An ENTRY statement appearing in the body of a subprogram provides an alternate


point at which to begin execution when the procedure is called. Execution begins with
the first executable statement after the ENTRY statement.

The dummy argument list in an ENTRY statement is independent of any other dummy
argument lists in the program unit. If the same names appear in more than one
dummy argument list in a subprogram, they need not occupy the same positions in
those lists. An ENTRY statement may contain more or fewer dummy arguments than
the FUNCTION or SUBROUTINE statement. Entry into a procedure at any point results
in initialization of only those dummy arguments included in the dummy argument list
of the statement in which entry occurs. Use of dummy arguments not included in the
dummy argument list where the procedure was entered is prohibited.

If the entry name within a function subprogram is to have a non-default type, it must
be referenced in a type or IMPLICIT statement both in the calling program unit and in
the function subprogram body.

3957 6053003 1241


Functions and Subroutines

Within a function subprogram all variables whose names are also the names of entries
are associated with each other and with the variable, if any, whose name is also the
name of the function subprogram. Therefore, any such variable that becomes defined
causes all associated variables of the same type to become defined and all associated
variables of different types to become undefined. Such variables are not required to
be of the same type unless the type is character, but the variable whose name is used
to reference the function must be in a defined state when the RETURN or END
statement is executed. An associated variable of a different type must not become
defined during the execution of the function reference.

If an entry name in a function subprogram is of type character, each entry name and
the name of the function subprogram must be of type character and have the same
length specification. In a function subprogram, a variable name that is the same as an
entry name must not appear in any executable statement that precedes that entry
name in an ENTRY statement.

The following is an example of a subroutine containing an ENTRY statement:

SUBROUTINE SUBA(A,B)
A=A/2.0
ENTRY XSUBA(B,A)
A=A**B
B=A
RETURN
END

This subroutine may be called by statements of both these forms:

CALL SUBA(G,H)
CALL XSUBA(G,H)

It should be noted that when using a specific entry point to a subroutine or function
subprogram, any assignment statements in the program previous to the entry point
will not be recognized.

For example:

G = 5
H = 6
CALL SUBA (G, H)
CALL XSUBA (G, H)
END
SUBROUTINE SUBA (A, B)
INTEGER C
C = 4
A = A / 2.0
PRINT *, A, B, C
ENTRY XSUBA (B, A)
A = A * B
B = A

1242 3957 6053003


Functions and Subroutines

PRINT *, A, B, C
RETURN
END

When the preceding program is run, the output appears as follows:

2.5 6.0 4
2*15.0 4
2*225.0 0

When XSUBA is called, c is 0 since the assignment statement located previous to the
entry point is ignored.

Note: Only the dummy arguments that are associated with the entry point through
which the subprogram is entered may be used.

RETURN Statement
The executable RETURN statement may appear only in a function or subroutine
subprogram. It causes control to be returned to the referencing program unit.

The format of a RETURN statement is as follows:

 RETURN 


| |
 <integer expression> 

Execution of a RETURN statement in a function or subroutine subprogram causes the


return of control to the currently referencing program unit. The RETURN statement is
an optional statement. If an END statement is encountered before a RETURN
statement is executed the END has the same effect as executing a RETURN
statement. For a function, the value of the function must be defined prior to the return
and is available to the referencing program unit.

Execution of a RETURN statement (or END statement) causes all entities within a
subprogram to become undefined, except for entities in common, entities specified
by SAVE statements, or entities that have been initially defined and have not been
redefined.

Alternate Return
Note: In addition to the asterisk, the ampersand (&) is used to represent an
alternate return for a subroutine call. The ampersand is accepted regardless of the
state of the CONVERT option.

If the integer expression, n, is specified in the RETURN statement of a subroutine,


execution of this return transfers control to the executable statement labeled
appropriately in the calling program unit. This return statement is referred to as an
alternate return.

3957 6053003 1243


Functions and Subroutines

When an alternate return is executed, the integer expression is evaluated. The


resulting value, n, is used to select the nth asterisk in the dummy argument list of the
procedure. If n is less than one or greater than the number of asterisks in the dummy
argument list, control returns to the CALL statement that initiated the procedure
reference. Otherwise, control is returned to the statement identified by the alternate
return specifier in the CALL statement corresponding to the nth asterisk in the dummy
argument list of the currently referenced name. This completes the execution of the
CALL statement.

An alternate return specifier is of the form *s, where s is the statement label of an
executable statement that appears in the same program unit as the CALL statement.

The following program excerpt illustrates a calling program unit able to handle
alternate returns from the called subprogram.

CALL SUBA(I,*33,B,*20,J)
15 Z=A1 + N
20 Z=Z + A2
33 Z=Z + A1

The called subroutine could be the following:

SUBROUTINE SUBA (I,*,B,*,J)


IF (I) 5,6,7
5 RETURN 1
6 RETURN I+2
7 RETURN
END

First, suppose that when the IF statement in the subroutine is executed, I is greater
than zero. Then there is a transfer of control to the statement labeled 7, which is a
standard return. The subroutine returns to the calling program unit at the CALL
statement, then execution continues to the statement labeled 15.

Second, suppose that I is less than zero. When the IF statement in the subroutine is
executed, there is a transfer of control to the statement labeled 5. This is an alternate
return to the first label in the actual argument list. It returns to the statement labeled
33 in the calling program unit.

If I is equal to zero when the IF statement is executed, there is a transfer of control to


the statement labeled 6. The arithmetic expression evaluates to 2, causing a return to
the statement labeled 20 in the calling program unit.

If a RETURN 3 or RETURN 0 had been attempted in SUBA, a standard return would


have been executed.

1244 3957 6053003


Functions and Subroutines

Arguments and Common Blocks


Arguments and common blocks provide a means of communication between the
referencing program unit and the referenced procedure. The entities that appear in the
argument list of the procedure are called dummy arguments; the entities that appear
in the argument list of the procedure reference are called actual arguments.

Data may be communicated to a statement function or intrinsic function by an


argument list. Data may be communicated to and from an external procedure by an
argument list or common blocks. Procedure names may be communicated to an
external procedure only by an argument list.

Statement functions, external functions, and subroutines use dummy arguments to


indicate the type and whether each argument is a single value, array of values,
procedure, or statement label. Note that a statement function dummy argument may
be only a variable and an actual argument must not be the name of a statement
function in the program unit containing the reference.

Each dummy argument is classified as a variable, array, dummy procedure, or asterisk.


At the execution of a function or subroutine reference, an association is established
between the corresponding dummy and actual arguments. The first dummy argument
becomes associated with the first actual argument; the second dummy argument
becomes associated with the second actual argument, and so on.

A dummy argument that is a variable may be associated with an actual argument that
is a variable, array element, substring, constant, symbolic name of a constant, function
reference, or expression. If the actual argument is a variable, array element, or
substring, then the associated dummy argument may be defined or redefined within
the subprogram and the actual argument takes on the value of the dummy argument.
If the actual argument is a constant, symbolic name of a constant, function reference,
expression involving operators, or expression enclosed in parentheses, then
redefining the associated dummy argument within the referenced procedure has no
effect on the value of the actual argument. Actual arguments consisting of
expressions are evaluated just before the association of dummy arguments to actual
arguments.

If the dummy argument is a variable and the actual argument is the name of an array,
the actual argument is treated as a subscripted array name and references the first
element of that array. For example, if subroutine SUB has a single dummy argument
which is a variable, and A is an array, then CALL SUB(A) is equivalent to CALL
SUB(A(1)).

If a dummy argument is of type character, the associated actual argument must be of


type character and the length of the dummy argument must be less than or equal to
the length of the actual argument. If the dummy argument length is less than the
length of the actual argument, the left-most characters are associated with the
dummy argument.

3957 6053003 1245


Functions and Subroutines

If a dummy argument is of type character and the actual argument is a character


constant, any attempt to redefine the dummy argument within the referenced
procedure results in termination of the program at run time. The message issued
when a program is terminated in this manner is "MEMORY PROTECT."

When the compiler control option CALLBYREFERENCE is not set and a variable or array
element appears as an actual argument (for example, the corresponding dummy
argument is a variable), it is called by name. That is, if the value of the dummy
argument changes, the final value of the dummy argument is assigned to the
corresponding actual argument when execution of the subprogram is completed. The
only exception is a character variable dummy argument. A change in the value of a
character variable dummy argument is recorded as a change in the value of the
corresponding actual argument at the time of the change rather than at the end of the
subprogram execution.

When a FUNCTION, SUBROUTINE, or ENTRY statement is processed, any item


appearing in the argument list, except for a *, may be enclosed in slashes. Any dummy
argument that is enclosed in slashes and turns out to be a non-character variable is
treated as call by reference. Any change in value of a call by reference dummy
argument is recorded as a change in the value of the corresponding actual argument
at the time of the change rather than at the end of the subprogram execution. In
subroutine ONE, dummy arguments A and B are call by reference.

SUBROUTINE ONE(/A/, /B/, C, D)


REAL A, B
A = B + 1
...
END
A dummy argument that is an array may be associated with an actual argument that is
an array, array element, or array element substring. Care should be taken that a
dummy array is not declared larger than the corresponding actual array, or an invalid
index may result when the dummy array is referenced.

When considering the length of a character type array, the overall character length of
the array should be considered, rather than the number of elements in the array. The
length of an element in the dummy argument array may be different from the length
of an array element in the actual array. The character array should be thought of as a
string of characters.

A dummy argument that is an asterisk may be associated only with an actual


argument that is an alternate return specifier in the CALL statement.

A dummy argument that is a dummy procedure may be associated only with an actual
argument that is an intrinsic function, external function, subroutine, or another dummy
procedure.

If a dummy argument is associated with an item in a common block in the referenced


subprogram, neither the dummy argument nor the item in the common block may be
defined during the execution of the referenced subprogram. Also, if two dummy
arguments become associated with one another, neither of them may be defined
during execution of the subprogram.

1246 3957 6053003


Functions and Subroutines

The variables and arrays in a common block may be defined and referenced in all
subprograms that contain a declaration of that common block. Because association is
by storage rather than by name, the names of the variables and arrays may be
different in the different subprograms.

Within a subprogram, there is a maximum number of arguments that may be passed


to a subprogram appearing as a formal argument. The total storage requirement for
the arguments must not be greater than 46 words. Since the compiler may use more
than one word to represent an argument, the total storage requirement may not be
obvious. Therefore, the compiler issues an error message if the argument limit is
exceeded for invocations of subprograms that appear as formal arguments.

Example:
PROGRAM MAIN
EXTERNAL PASS
CALL SUB (PASS)
END
SUBROUTINE SUB (P)
CALL P (X1,X2,...,XN)
END

With a subroutine SUB, if the call to P has an argument list that exceeds 46 words, the
compiler issues an error message.

3957 6053003 1247


Functions and Subroutines

1248 3957 6053003


Section 13
Block Data Subprogram

Block data subprograms are used to provide initial values for variables and array
elements in common blocks. A block data subprogram is a non- executable program
unit that has a BLOCK DATA statement as its first statement. There may be more than
one block data subprogram in an executable program.

The format of a BLOCK DATA statement is the following:

 BLOCK DATA   



 <block data subprogram name> !

The optional name is a global name and must not be the same as any local name in the
subprogram, the name of an external procedure, main program, common block, or
other block data subprogram in the same executable program.

The BLOCK DATA statement must appear only as the first statement of a block data
subprogram. The only other statements that may appear in a block data subprogram
are IMPLICIT, PARAMETER, DIMENSION, COMMON, SAVE, EQUIVALENCE, DATA,
END, and TYPE statements. Comment lines are also permitted.

If an entity in a common block is initially defined, all entities having storage units in the
common block storage sequence need not be specified.

The same named common block may be specified in more than one block data
subprogram in the same executable program. Within each block data subprogram, the
items listed for the common block are considered to start at the beginning of the
common block. If a given location in the common block is initialized in more than one
block data subprogram, results are unpredictable.

More than one common block may have entities initially defined in a single block data
subprogram.

The following is an example of a block data subprogram:

BLOCK DATA
IMPLICIT LOGICAL (L)
COMMON L1, LCTL, /BLKA/A(3)
DATA L1, LCTL, A/2*.TRUE.,3*03.2/

3957 6053003 131


Block Data Subprogram

132 3957 6053003


Section 14
Debugging Aids

Note: This entire section is a Unisys extension to the national standard.

Debug statements assist in isolating programming errors. The debugging aids for
FORTRAN77 are implemented by means of statements and compiler control options.
All statements start with the word DEBUG and conform to the usual FORTRAN77
statement formulation rules. The ability to inhibit code generation for a statement at
compilation time, as well as output at execution time, is provided.

The code (and output) from all debugging statements may be deleted permanently at
compilation time by setting the OMITDEBUG compiler control option. In that way the
statements can become a permanent part of a symbolic program, included while the
program is being developed and excluded while the program is in production form.

FORTRAN77 also provides for inhibiting output at execution time. All output from
debugging statements is inhibited unless DEBUG is specified for the task attribute
OPTION. The default of the task attribute OPTION is DEBUG reset. It can be set for
each execution of a program at compilation time by the CANDE statement:

COMPILE X; OPTION=DEBUG

or at execution time for a particular run by the CANDE statement:

RUN X; OPTION=DEBUG

or at execution time for a particular run by the WFL statement:

RUN X; OPTION=(DEBUG);

It is also possible to change debugging status programmatically by use of DEBUG


START and DEBUG STOP.

In addition to the debug facilities described here, the interactive FORTRAN77 Test and
Debug System (TADS) constitutes an important debugging aid. Refer to the ClearPath
Enterprise Servers FORTRAN77 Test and Debug Programming Reference Manual
for more information.

3957 6053003 141


Debugging Aids

DEBUG DUMP Statement


The DEBUG DUMP non-executable statement causes the values of a list of variables
and arrays within a program unit to be output when program control passes a
specified label. This statement must appear before any executable statements.
Arrays must be dimensioned before appearing in a DEBUG DUMP statement. A
DEBUG DUMP statement may not have a label.

The DEBUG DUMP statement format is as follows:

 DEBUG DUMP  (  <unit identifier>  ) 

! " , $
% %
&' /1\  LABELS  (  <label list>  ) '&1
% %
2 /1\  FREQ  (  <control condition>  ) 1
% %
7 /1*\  VARS  (  <variable list>  ) ;

<unit identifier>
' <positive integer expression> '1
% %
2 <variable name> 1
% %
7 * ;
<label list>

! " , $
% %
& <label> &1
<control condition>

! " , $
% %
&' /1\  <frequency condition> '&1
% %
7 /1\  <bounds condition> ;

<frequncy condition>

 <positive integer constant> 1

<bounds condition>

 <integer variable>  = ' <integer constant> ' , 


% %
7 <integer variable> ;
' <integer constant> '1
% %
7 <integer variable> ;

<variable list>
! " , $

142 3957 6053003


Debugging Aids

% %
&' <variable name> '&1
% %
7 <array name> ;

The <unit identifier> specifies where the output is to go. It may be either a unit
number, a variable name, or an asterisk (*). An asterisk causes output to be sent to the
default output unit 6.

If LABELS is specified, then values are dumped when control passes to any of the
designated labels (otherwise, values are dumped at every label). A label can appear in
only one DEBUG DUMP statement per program unit.

FREQ provides the ability to limit the number of times dumping takes place. When
<frequency condition> is used, dump action occurs every <frequency condition>th
time control passes any label where the dump action is to take place. The <bounds
condition> causes a dump when the <integer variable> is within the specified bounds.
If both a <bounds condition> and a <frequency condition> are requested, the <bounds
condition> is subject to the <frequency condition>. FREQ can be used to specify that
dump action should take place every fth time through a loop, or when a DO- LOOP
index is within a certain range.

VARS is the list of items to be displayed and it must be included. Each item is either a
variable or an array name. The same variable or array name may appear in more than
one DEBUG DUMP statement list.

There can be more than one DEBUG DUMP statement per program unit. A DEBUG
DUMP statement may not appear in a program unit that is declared to be in a library, a
BLOCK GLOBALS or BLOCK DATA program unit.

Example of DEBUG DUMP:


FILE 1(KIND="REMOTE")
DEBUG DUMP(1) LABELS (10), FREQ(3), VARS(K)
DO 10 K=1,5
M=K+1
10 CONTINUE
END

Output:

DUMP LABEL 00010 AT 005:0006:5 (00000800 IN MAIN)


K=1,
DUMP LABEL 00010 AT 005:0006:5 (00000800 IN MAIN)
K=4,

DEBUG PROGRAMDUMP Statement


The DEBUG PROGRAMDUMP statement causes program execution to pause
temporarily and causes the MCP to output any previously specified information. The
program is then resumed without affecting execution. A DEBUG PROGRAMDUMP
statement may not have a label.

3957 6053003 143


Debugging Aids

The DEBUG PROGRAMDUMP statement format is the following:

 DEBUG PROGRAMDUMP ''1


% %
% ! " , $ %
% % % %
7 ( & <programdump option> & ) ;

<programdump option>

' ARRAY '1


% %
2 ARRAYS 1
% %
2 BASE 1
% %
2 CODE 1
% %
2 DBS 1
% %
2 FILE 1
% %
2 FILES 1
% %
2 LIBRARIES 1
% %
2 PRESENTARRAY 1
% %
2 PRESENTARRAYS 1
% %
2 PRIVATELIBRARIES 1
% %
2 SIBS 1
% %
2 ALL1
% %
2 TODISK 1
% %
7 TOPRINTER ;

If no <programdump option>s are specified, the information is output and analyzed


according to the specifications of the task attribute OPTION.

The PRESENTARRAY and PRESENTARRAYS option causes only those arrays in the
present state (at the time the program dump is taken) to be dumped.

Note: If the ARRAY or ARRAYS program dump option is set along with the
PRESENTARRAY or PRESENTARRAYS program dump option, all arrays will be
dumped.

The <programdump option>s TODISK and TOPRINTER are used to specify the
destination of the dump.

When TODISK has been specified, a disk file containing the dump is created in a
format acceptable to DUMPANALYZER. The listing produced currently by
PROGRAMDUMP is suppressed, unless TOPRINTER is also specified.

144 3957 6053003


Debugging Aids

The program dump title has the following format:

PDUMP/<task name>/<date>/<time>/<mix number>

<date> ::= yymmdd


<time> ::= hhmmss

The portion of the task name included in the dump file title is limited to eight nodes.

If TOPRINTER is also set, after the disk file has been produced, a regular program
dump to printer is then taken. Since the dump to disk has some effects in which the
contents of memory could be changed the two dumps may not be identical.

All other program dump option settings (for example, ARRAYS, LIBRARIES) still affect
the contents of the disk dump, except BASE. The base of stack and the PIB are always
dumped for any stack dumped.

On a non-ASD system, these options are ignored and the current printer dump is
produced.

There can be more than one DEBUG PROGRAMDUMP statement per program unit. A
DEBUG PROGRAMDUMP statement may not appear in a program unit that is declared
to be in a library, a BLOCK GLOBALS or BLOCK DATA program unit, or a logical IF
statement.

DEBUG MONITOR Statement


The DEBUG MONITOR non-executable statement provides the ability to monitor
changes in the values of simple variables and array elements within a program unit.
This statement must appear before any executable statements. Arrays must be
dimensioned prior to appearing in a DEBUG MONITOR statement. Monitoring takes
place when the value of a monitored item changes by the execution of an assignment
statement. In the case of simple variables, monitoring also takes place when the item
value changes through a READ statement, or through being passed as an actual
argument to a program unit. When the value of a monitored object changes, the stack
number, stack history, monitored item name (up to six characters), and its old and new
values are printed. Variables and arrays of type character cannot be monitored. A
DEBUG MONITOR statement may not have a label.

The DEBUG MONITOR statement format is the following:

3957 6053003 145


Debugging Aids

 DEBUG  MONITOR  (  <unit identifier>  )  VARS  ( 

 <variable list>  ) 1

<unit identifier>

' <positive integer expression> '1


% %
2 <variable name> 1
% %
7 * ;

<variable list>

! " , $
% %
&' <variable name> '&1
% %
2 <array element name> 1
% %
7 <array name> ;

The <unit identifier> specifies where output is to go. It may be either a unit number,
an identifier, or an asterisk (*). An asterisk causes output to be sent to the default
output unit 6.

If the list contains an array identifier without subscripts, then every element of that
array is monitored. If the list contains actual array elements, then only those elements
of the array are monitored.

An individual subscript is either a constant or a simple variable; it cannot be an


arithmetic expression. Using a simple variable in an <array element name> allows the
monitored element of an array to be changed. For example, "I" is designated as the
individual subscript for the array A. Whenever the element in A is changed, whose
index is equal to the current value of I, that element is monitored. This can be
particularly useful within a loop.

There can be more than one DEBUG MONITOR statement per program unit; the
effects are cumulative. An item can be specified for monitoring in only one DEBUG
MONITOR statement per program unit. An item that is equivalent to an item that is
being monitored is not monitored unless it is specified in a DEBUG MONITOR
statement. A DEBUG MONITOR statement cannot appear in a program unit that is
declared to be in a library, a BLOCK GLOBALS or BLOCK DATA program unit.

Examples
FILE 1(KIND=REMOTE)

BLOCK DATA
COMMON /COM/ ELMT1, ELMT2
END

PROGRAM MAIN
COMMON /COM/ A, B
DEBUG MONITOR(1) VARS(ELMT1)

146 3957 6053003


Debugging Aids

A=1
ELMT1=2
CALL SUB
END

SUBROUTINE SUB
COMMON /COM/ A, B
DEBUG MONITOR(1) VARS(A)
A=3
ELMT1=4
END

In the preceding example, the first element in common is monitored in SUB only. Each
program unit in which monitoring of a common element is to take place must contain
a DEBUG MONITOR statement specifying the element as it appeared in the COMMON
statement in that program unit.

FILE 1(KIND=REMOTE)

PROGRAM MAIN
DIMENSION A(5)
DEBUG MONITOR(1) VARS(A(I))
I=3
A(1)=3
A(2)=4
A(3)=5
I=5
A(4)=6
A(5)=7
END

In the preceding example, the assignments of A(3) and A(5) are monitored. Since a
simple variable is used as an individual subscript in the DEBUG MONITOR statement,
the location in A whose index is equal to the current value of I is monitored.

DEBUG <statement> Statement


The DEBUG <statement> statement allows a statement to be conditionally compiled
and conditionally executed. It provides users with the ability to specify their own
debugging aids. A DEBUG <statement> statement may not have a label.

The DEBUG <statement> statement format is as follows:

 DEBUG ' <WRITE statement> '1


% %
2 <PRINT statement> 1
% %
2 <PUNCH statement> 1
% %
7 <CALL statement> ;

3957 6053003 147


Debugging Aids

There can be more than one DEBUG <statement> statement per program unit. A
DEBUG <statement> statement cannot appear in a program unit that is declared to be
in a library, a BLOCK GLOBALS or a BLOCK DATA program unit, or a logical IF
statement.

Example
PROGRAM MAIN
L=1
DEBUG CALL DEBUG(L)
END

SUBROUTINE DEBUG(M)
. . .
END

The preceding example illustrates one use of the DEBUG <statement> statement.
Generation of the CALL on the subroutine DEBUG can be inhibited at compilation by
using the OMITDEBUG compiler control option. The actual call on the subroutine
DEBUG is dynamic at execution time. The subroutine DEBUG could cause side effects,
depending on whether or not it is actually executed. Note that the use of the word
DEBUG as a subroutine name is not significant.

DEBUG START Statement


The DEBUG START statement causes all program units to execute DEBUG statements
as if DEBUG had been specified for the task attribute OPTION for the current
execution. Code generation can be inhibited at compilation with the OMITDEBUG
compiler control option. Note that any code generated is always invoked. A DEBUG
START statement may not have a label.

The DEBUG START statement format is the following:

 DEBUG  START 1

There can be more than one DEBUG START statement per program unit. A DEBUG
START statement cannot appear in a program unit that is declared to be in a library, a
BLOCK GLOBALS or BLOCK DATA program unit, or a logical IF statement.

DEBUG STOP Statement


The DEBUG STOP statement causes all program units to execute DEBUG statements
as if DEBUG had not been specified for the task attribute OPTION for the current
execution. Code generation for the statement can be inhibited at compilation with the
OMITDEBUG compiler control option. Note that any code generated is always invoked.
A DEBUG STOP statement may not have a label.

The DEBUG STOP statement format is as follows:

 DEBUG  STOP1

148 3957 6053003


Debugging Aids

There can be more than one DEBUG STOP statement per program unit. A DEBUG
STOP statement cannot appear in a program unit that is declared to be in a library, a
BLOCK GLOBALS or BLOCK DATA program unit, or a logical IF statement.

Example
PROGRAM MAIN 1
DEBUG PROGRAMDUMP (ARRAYS) 2
A=1 3
DEBUG START 4
CALL SUB1 5
DEBUG PROGRAMDUMP (ARRAYS) 6
DEBUG STOP 7
CALL SUB2 8
DEBUG PROGRAMDUMP (ARRAYS) 9
END 10

SUBROUTINE SUB1 11
B=1 12
DEBUG PROGRAMDUMP 13
CALL SUB2 14
END 15

SUBROUTINE SUB2 16
C=1 17
DEBUG PROGRAMDUMP 18
END 19

The preceding example (with line numbers to the right for reference) illustrates the
use of DEBUG START and DEBUG STOP statements. Output from the DEBUG
PROGRAMDUMP statement on line 2 is dependent on the status of the DEBUG task
attribute. If the program is executed with DEBUG specified for the task attribute
OPTION, a program dump is produced.

Once the DEBUG START statement on line 4 is executed, the program continues as if
DEBUG were specified for the task attribute OPTION. When SUB1 is called, the DEBUG
PROGRAMDUMP statement on line 13 produces a program dump. When SUB1 calls
SUB2, the DEBUG PROGRAMDUMP statement on line 18 also produces a program
dump.

When control returns to MAIN, the DEBUG PROGRAMDUMP statement on line 6


produces a program dump. After the DEBUG STOP statement on line 7 is executed,
the program continues as if DEBUG were not specified for the task attribute OPTION.
The call on SUB2 from line 8 produces no debugging output. When control returns to
MAIN, the DEBUG PROGRAMDUMP statement on line 9 also produces no debugging
output.

Note that DEBUG START and DEBUG STOP can be used to produce debugging
information based on the logical flow of an executing program.

3957 6053003 149


Debugging Aids

1410 3957 6053003


Section 15
Storage Allocation

Note: This entire section is a Unisys extension to the national standard.

Each FORTRAN77 data item is allocated one or more units of storage depending upon
the type of value the item represents. The unit of storage is the data word, 48 bits of
which are accessible to the user.

The following FORTRAN77 features require storage configurations:

Simple Variables
Arrays
Equivalent Data Items
Elements of Common Storage
The method of storage allocation for each of these features is discussed in this
section. The notation [m:n] is used to describe data word fields. The 48 accessible bits
of a data word are considered numbered, with the left-most bit being bit 47 and the
right-most bit being bit 0. In the notation [m:n], m denotes the number of the left-most
bit of the field being described, and n denotes the number of bits in the field. For
example, the field shown (bit 28 through 24) would be described by [28:5]:


            
 47 43 39 35 31 27 23 19 15 11 7 3

            
 46 42 38 34 30 30 26 22 18 14 10 6

            
 45 41 37 33 29 25 21 17 13 9 5 1

            
 44 40 36 32 28 24 20 16 12 8 4 0


Figure 151. Storage Allocation

Hexadecimal constants are used extensively in this section to describe word


contents. The preceding diagram of a data word graphically represents hexadecimal
constants as column.

3957 6053003 151


Storage Allocation

Variable
Each variable requires one, two, or more words of storage depending upon the type
of variable. The variable types are:

Integer variables
Real variables
Double precision variables
Complex variables
Logical variables
Character variables
Each of these variable types has a unique internal storage configuration.

Integer Variables
An integer variable requires one word of storage. The data word corresponding to an
integer variable is partitioned as follows:

Field Contents
[47:1] Undefined
[46:1] Sign bit
[45:7] Must contains all zeros
[38:39] Magnitude of data item

Integer values are represented internally in signed-magnitude notation. The sign of the
value is denoted by bit 46 of the data word involved. This bit is 0 for positive values
and 1 for negative values. The magnitude of the value is stored right-justified in bits 38
through 0 preceded by zeros.

For example, the internal representation of the integer 10 described using hexadecimal
constant notation is as follows:

Z00000000000A

The internal representation of -10 is as follows:

Z40000000000A

The largest integer value that may be stored is Z007FFFFFFFFF = 549755813887.

152 3957 6053003


Storage Allocation

Real Variables
A real variable requires one word of storage. The data word corresponding to a real
variable is partitioned as follows:

Field Contents
[47:1] Undefined
[46:1] Mantissa sign bit
[45:1] Exponent sign bit
[44:6] Magnitude of data item exponent
[38:39] Magnitude of data item mantissa

Real (floating point) values are represented internally in signed magnitude mantissa
and exponent notation. The sign of the mantissa is denoted by bit 46 while the sign of
the exponent is denoted by bit 45 of the data word. 0 denotes a positive value and 1 a
negative value for these bits. The magnitude of the exponent is contained in bits 44
through 39; hence, the exponent may not exceed a magnitude of 2**06 - 1 = 63. The
magnitude of the mantissa is contained in bits 38 through 0. This field is identical to
the magnitude field of a data word contained in an integer value. Thus, an integer data
word may be considered a real data word with an exponent field containing all zeros.

The value represented by a real data word is the following:

(mantissa) *08**(exponent)

The magnitude of the mantissa is usually stored left-justified within its word field.
Therefore, the internal representation of the real value 0.5 (or .5E0) in hexadecimal
constant notation is Z26C000000000. The exponent in this example is -13 and the
mantissa is 4*08**32.

Double Precision Variables


A double precision variable requires two adjacent words of storage. The data words
corresponding to a double precision variable are partitioned as follows:

Field Contents
First Word
[47:1] Undefined
[46:1] Mantissa sign bit
[45:1] Exponent sign bit
[44:6] Least significant part of magnitude of exponent
[38:39] Most significant part of magnitude of mantissa

3957 6053003 153


Storage Allocation

Field Contents
Second Word
[47:9] Most significant part of magnitude of exponent
[38:39] Least significant part of magnitude of mantissa

Double precision values are represented internally in signed magnitude mantissa and
exponent notation with a most significant part and a least significant part. The sign of
the mantissa is contained in bit 46 of the first data word while the sign of the
exponent is contained in bit 45 of the first word. 0 denotes a positive value and 1 a
negative value for these bits. The magnitude of the exponent is contained in a total of
15 bits. The first nine of these 15 bits (the most significant part of the magnitude of the
exponent) are contained in bits 47 through 39 of the second data word. The remaining
six of these 15 bits (the least significant part of the magnitude of the exponent) are
contained in bits 44 through 39 of the first data word.

The magnitude of the mantissa is contained in a total of 78 bits. The first 39 bits (the
most significant part of the magnitude of the mantissa) are contained in bits 38
through 0 of the first data word. The remaining 39 bits (the least significant part of the
magnitude of the mantissa) are contained in bits 38 through 0 of the second word.

The value represented by a double precision data-word pair may be obtained by the
formula:

((most significant part of mantissa) + (least significant part of mantissa)*


08**(-13)) *08**((most significant part of exponent) + (least significant pa
rt of exponent) *02**09))

The magnitude of the mantissa is usually stored left-justified within the total 78 bit
field.

As an example, the internal two-word representation of the double precision value


1D0 in hexadecimal constant notation is the following:

Z261000000000 Z0000000000000

The contents of the first of these two data words are identical to the contents of a
data word representing the real value 1E0. When a value that does not exceed the
limits of a real variable is assigned to a double precision data word pair, then that data
word pair can be represented in a form where the second data word is all zeros and
the first data word is equal to the real representation of the value.

154 3957 6053003


Storage Allocation

Complex Variables
A complex variable requires two adjacent words of storage. The first data word
contains the real part of the variable, and the second data word contains the imaginary
part of the variable.

Each of these two data words conforms to the format of an integer or real variable. If
the complex variable is assigned the value of a complex constant whose real and/or
imaginary part is an integer constant, then the first and/or second data word of the
complex constant is partitioned as an integer data word. A real constant in the
complex constant similarly controls the structure of the corresponding complex data
word.

For example, if C is complex, the assignment statement:

C = (1,0.5E0)

places into the two data words corresponding to C these values:

Z000000000001 Z26C000000000

The first data word (the real part of C) contains a representation of the integer
constant 1. The second data word (the imaginary part of C) contains a representation
of the real constant 0.5E0. If the assignment statement were:

C = (1,1)

then the data words would be:

Z000000000001 Z000000000001

Logical Variables
A logical variable requires one word of storage. The data word corresponding to a
logical variable is partitioned as follows:

Field Contents
[47:47] Unused
[0:1] Value bit
Even though logical operators reference all 48 bits, the left-most 47 accessible bits of
the data word have no effect on the value, while the value represented by that
variable is contained in bit 0 of the data word. When bit 0 is 1, the value of the variable
is .TRUE. and when bit 0 is 0, the value of the variable is .FALSE..

Usually, the internal representation of a logical value is identical to the representation


of an integer 1 or integer 0; however, since only the state of bit 0 is taken into
consideration, the remaining 47 bits may assume any states.

3957 6053003 155


Storage Allocation

.TRUE. is stored as:

000000000000000000000000000000000000000000000001

.FALSE. is stored as:

000000000000000000000000000000000000000000000000

The value for .NOT. .TRUE. is the complement of .TRUE. where all ones are changed
to zeros, and all zeros are changed to ones; therefore, .NOT. .TRUE. is stored as:

111111111111111111111111111111111111111111111110

The value for .NOT. .FALSE. is achieved in the same way; .NOT. .FALSE. is stored as:

111111111111111111111111111111111111111111111111

Character Variables
Character variables are stored as strings of EBCDIC characters. Character variables
that are not in a COMMON statement are collected and stored together in character
pools. These character pools are stored internally as EBCDIC arrays.

Arrays
FORTRAN77 arrays are provided to allow the user to organize program storage
locations into a convenient structure. Internally, an array is stored as a group of one or
more contiguous storage units. A FORTRAN77 array of any number of declared
dimensions is represented internally by a one-dimensioned array of storage locations.
Each element of an array has storage requirements and partitioning identical to that of
a variable of the same type as the array. Thus, each element of a real array requires
one data word partitioned like a real variable and each element of a complex or double
precision array requires two data words partitioned like a complex or double precision
variable, and each element of a character array requires the number of characters
specified in the length specification for the array. If the length is not specified the
length is one character.

Double precision and complex arrays use two words per element instead of one. The
standard array limit is 2**20-1 on MCP/AS processors or 2**28-1 on MCP/AS
(Extended) processors, but the double precision and complex arrays each have a
reduced limit of 2**19-1 on MCP/AS processors or 2**27-1 on MCP/AS (Extended)
processors to avoid exceeding the standard limit.

Each integer, real, and logical array is allocated as many data words as there are
elements in the array. Each double precision and complex array is allocated twice as
many internal data words as there are elements in the array. Each character array is
allocated as a string of EBCDIC characters. The total number of characters in the array
is equal to the number of elements in the array times the length of the array elements.
Each character array is stored in its own character pool, which is stored internally as
an EBCDIC array.

156 3957 6053003


Storage Allocation

The elements of an array are ordered into a sequence. The subscript of an array
element has a subscript value that determines which element of the sequence is
identified by the array element. The first element has a subscript value of 1. The ANSI
standard does not permit REAL subscripts. The value of the REAL expression is
truncated to generate an index into the array.

If an array is declared by the array declarer:

A(L1:U1,L2:U2,L3:U3,...,Ln:Un)

the subscript value for the array element:

A(S1,S2,S3,...Sn)

would be

1+(S1-L1)
+ D1*(S2-L2)
+ D1*D2*(S3-L3)
+ ...
+ D1*D2*...*D(n-1)*(Sn-Ln)

where:

Dk is the size of the kth dimension, equal to Uk-Lk+1


Uk is an integer
Lk is an integer
n is the number of dimension
Sk is the kth subscript expression, which is an integer

The offset of an array element within the sequence is its position in the sequence
relative to the first element. The offset of an array element is equal to its subscript
value minus 1. The offset of the first element of an array is 0.

Example:
For an array declared:

DIMENSION A(0:5,1:4)

the subscript value for A(3,2) would be:

= 1 + (3-0) + 6*(2-1)
= 1 + 3 + 6
= 10

The ordering of the array elements produced by the subscript value is identical to that
obtained by listing all of the array elements by varying the first subscript expression
most rapidly, the second subscript expression next most rapidly, and so on.

3957 6053003 157


Storage Allocation

Example:
For the array A declared by the declarer:

DIMENSION A(0:2,1:2,-2:-1)

the elements are stored in the following order:

A(0,1,-2)
A(1,1,-2)
A(2,1,-2)
A(0,2,-2)
A(1,2,-2)
A(2,2,-2)
A(0,1,-1)
A(1,1,-1)
A(2,1,-1)
A(0,2,-1)
A(1,2,-1)
A(2,2,-1)

Element A(0,1,-2) corresponds to the first element of the internal array. This order is
the order in which array elements are considered when a multidimensional array is
used in an EQUIVALENCE statement or when the name of a multidimensional array
appears in an I/O list, DATA statement, argument list, COMMON statement, as a
format designator, or as an internal file identifier.

An array is stored internally in consecutive locations as long as the storage


requirement of the array does not exceed 1023 words. Arrays exceeding this size are
segmented for overlay purposes unless the compiler option LONG is set. Each
segment contains a maximum of 256 words and is automatically overlaid and recalled
as necessary during execution of the program.

Equivalent Data Items


The EQUIVALENCE statement allows the user to assign a number of program data
items to a single storage unit. Thus, more than one variable name or array element
name may refer to one storage location.

Single Storage Locations


The least complicated use of the EQUIVALENCE statement involves the assignment of
data items requiring a single word of storage to a mutual storage location. As an
example, assume that the following statements are the first statements of an
executable program:

IMPLICIT INTEGER (A), REAL (B), LOGICAL (L)


DIMENSION AR(2)
EQUIVALENCE (A, AR(2),B2), (AL,L)

158 3957 6053003


Storage Allocation

The EQUIVALENCE statement causes the integer variable A, the integer array element
AR(2), and the real variable B2 all to be assigned to the same data word. The first
element of AR is not affected by this statement. A change in the value of any one of
the three equivalent items produces a simultaneous equivalent change in the value of
the other two items.

The EQUIVALENCE statement also causes the integer variable AL and the logical
variable L to be assigned to the same data word. As the variable L changes value, AL
changes value. For example, the assignment statement:

L = .TRUE.

also places the integer value 1 into variable AL. As the variable AL changes value, L
changes value accordingly. As AL assumes even integer values, L assumes the value
.FALSE., and as AL assumes odd integer values, L assumes the value .TRUE..

Multiple Storage Locations


EQUIVALENCE statements may involve data items requiring more than one word of
storage. As an example, assume that the following statements are the first
statements of a program:

DOUBLE PRECISION D
REAL A(2)
EQUIVALENCE (A,D,B)

The EQUIVALENCE statement causes the real array A, the double precision variable D,
and the real variable B to be assigned to identical data words. As A and D both require
two data words, the first and second elements of A become equivalent to the first and
second words, respectively, of the storage unit assigned to D. The variable B,
requiring only one data word, is assigned to the same word as A(1) and the first word
of D.

Array Handling
The EQUIVALENCE statement may be used to assign a group of contiguous storage
locations to a number of program arrays. There are two types of possible array
references in an EQUIVALENCE statement: an array name and a subscripted array
name with the same number of subscript expressions as the array has dimensions.

Assume that the following statements are the first statements of a program unit:

REAL A(4), B(10,10), C(100), D(50), E(3,3), F(50)


DOUBLE PRECISION DE(2) /2*1D0/
EQUIVALENCE (A,DE), (B(1,1), C(1)), (D,F(26), E(2,1))

3957 6053003 159


Storage Allocation

The first list in this EQUIVALENCE statement causes the real array A and the double
precision array DE to share four storage words. The first two elements of A become
equivalent to the two words of the first element of DE, and the last two elements of A
become equivalent to the two words of the second element of DE. The initial value list
in the type statement declaring DE causes the double precision value 1D0 to be placed
in DE(1) and DE(2) and in the word pairs A(1),A(2) and A(3),A(4).

The second list in the EQUIVALENCE statement causes the real arrays B and C to
share 100 storage words. Each element in the 100 element array C, beginning with C(1),
is assigned to the same storage unit as a unique element of B. The elements of the
two-dimensional array B are stored internally in the manner described in the
discussion of arrays in this section. The internal storage units assigned to C occur in
the same order as the elements of that array. Hence, each C(I) is equivalent to the ith
internal element of B and it follows that if the following two PRINT statements occur
in this program unit, identical output is produced:

PRINT 1, (C(I), I=1,100)


PRINT 1, B
The third list in the sample EQUIVALENCE statement indicates that the elements of the
arrays D, F, and E are to be equivalent in such a manner that D(1), F(26), and the second
internal element of the two-dimensional array E are to be assigned identical internal
storage units. Therefore, the elements F(26) through F(50) become equivalent to the
first 25 elements of D. Equivalencing is handled as shown. Each of the lines denotes a
single storage location, and the array elements on a line are assigned to the same
storage location.
F(1)
through
F(25) E(1,1)
D(1) F(26) E(2,1)
D(2) F(27) E(3,1)
D(3) F(28) E(1,2)
D(4) F(29) E(2,2)
D(5) F(30) E(3,2)
D(6) F(31) E(1,3)
D(7) F(32) E(2,3)
D(8) F(33) E(3,3)
D(9) F(34)
through through
D(25) F(50)
D(26)
through
D(50)

1510 3957 6053003


Storage Allocation

The following DATA statement initializes the elements E(1,2), E(2,2), F(28), F(29), D(3),
and D(4) with the value 6:

DATA (E(J,2), J=1,2) / 2*06./

The following example results in an array of length 12. EQUIVALENCing of arrays


cannot be used to produce an array that exceeds the standard limit of 2**20-1 words
on MCP/AS processors or 2**28-1 words on MCP/AS (Extended) processors.

REAL A(10), B(6)


EQUIVALENCE (A(8), B(2))

The association of A and B can be graphically illustrated as follows:

010203040506070809101112

 A 

  B 

Elements in Common Storage


The COMMON statement allows program values to be communicated between
program units without using argument lists and permits these data items to be
referenced by the same or different symbolic names in each program unit. This
statement also allows data initialization by means of a BLOCK DATA or main program
unit.

In an executable program, each element of a common block is allocated space in


common storage once. Each program unit may reference a common block (and hence
each location in the block) through an appropriate COMMON statement.

The size of each block of common storage is either as large as the maximum size
indicated by a COMMON statement referencing that block in any program unit or as
large as the maximum length to which the block is extended by an EQUIVALENCE
statement.

Assume that the following statements are the first statements of a program unit:

SUBROUTINE MSG
DOUBLE PRECISION D
LOGICAL FLAG(6)
COMMON WORD1, WORD2,D,FLAG,TEXT(20)
COUNT = 1

The COMMON statement provides the maximum size of the blank common block in
the executable program containing program unit MSG. The total size of this common
block is then 30 words. In the MSG subprogram these are the words assigned to the
real variables WORD1 and WORD2, the word pair assigned to the double precision
variable D, the six words assigned to the logical array FLAG, and the twenty words
assigned to the real array TEXT. These data words are contained within the common
block in the order listed.

3957 6053003 1511


Storage Allocation

The blank common block just described could be referenced, for example, by a
common statement within another program unit:

SUBROUTINE DUMP
COMMON T(10)
PRINT 1,T
1 FORMAT(X,Z12)
RETURN
END

In this case, the elements of real array T correspond to the first 10 data words
contained in the common block. The last 20 data words of the common block are not
accessed in the DUMP subprogram.

Additionally, the EQUIVALENCE statement may interact with the COMMON statement
to extend the length of a common block beyond the maximum size specified for the
block by COMMON statements.

As an example, assume that the following statements form two units of an


executable program:

FUNCTION SUM(N)
COMMON /GR1/IT(3,3)
.
.
.
RETURN
END

LOGICAL FUNCTION TEST(L)


LOGICAL X(6)
COMMON /GR1/K(9)
EQUIVALENCE (K(6),X)
.
.
.
RETURN
END

The common block referenced by these two program units is named GR1 and consists
of 11 data words. The function SUM accesses the first nine words of this block
through the two-dimensional integer array IT. The function TEST accesses the first
nine words of the block through the integer array K. In addition, the next two locations
of GR1 are referenced as the logical array elements X(5) and X(6) since X is equivalent
to K starting at the element K(6).

Array K and array IT both refer to the same area of common storage. Use of array K
allows these locations to be referenced using only one subscript expression.
Equivalencing portions of the X and K arrays allows some elements of GR1 to be
handled as both integer and logical type items.

1512 3957 6053003


Storage Allocation

The common block could not have been extended backwards by the EQUIVALENCE
statement. The following combination of statements is invalid:

LOGICAL X(6)
COMMON /GR1/K(9)
EQUIVALENCE (X(3),K)

The total sum of all variables and arrays in a COMMON block cannot exceed 2**20-1
words on MCP/AS processors or 2**28-1 words on MCP/AS (Extended) processors.

3957 6053003 1513


Storage Allocation

1514 3957 6053003


Section 16
Compiler Information

Note: This entire section is a Unisys extension to the national standard.

The FORTRAN77 compiler is written in Unisys Extended ALGOL. This program


compiles source programs to produce object programs that may be executed on any
Unisys ClearPath Enterprise Server. The FORTRAN77 compiler and the object
programs generated by this compiler are designed to operate under control of the
Unisys Master Control Program (MCP).

Compiler Files
Input Files
The primary compiler input file has the internal name CARD; the secondary input file
has the internal name SOURCE. The presence of the primary file CARD is required for
each compilation; the presence of the secondary file SOURCE is optional. The file
SOURCE is used as input when the MERGE compiler option is set in the primary file or
during a SEPCOMP. To change their file attributes, both the CARD file and the SOURCE
file may be label-equated by means of FILE system control cards.

Compiler control images and certain comments may be passed to the compiler
through a file having the internal name INITIALCCI. It is only used if resident on the
system; no warning is issued if an INITIALCCI file does not exist. A user's INITIALCCI
file, if present, is used; otherwise, a public file, if present, is used (this file, if set up by
the system administrator, should be read-only). For more information on the use and
contents of this file, refer to Section 17.

Additional files may be input to this compiler through use of the INCLUDE compiler
control statement.

In certain cases, the compiler requires information from other files other than source
text input files. The input files HOST and XREFFILE are discussed with SEPCOMP in
Section 17. (HOST may also be necessary during autobinding.)

3957 6053003 161


Compiler Information

Output Files
Output files produced by this compiler include the object code file, an optional
updated symbolic file, a listing, and an error message file.

When it is compiled through WFL, the object code file has the internal name CODE and
is saved after the compilation only if LIBRARY is specified. Also the TITLE of the saved
code file is identical to the program name appearing on the COMPILE card unless the
file has been label equated.

The updated symbolic file is generated only if the compiler option NEW is set. This file
contains the compilation source input or a selected portion of this input as specified
by the states of the NEW and INCLNEW compiler options and may be used for
succeeding compilation. This output file has the internal name NEWSOURCE, as well
as the default TITLE NEWSOURCE if the file is not label equated.

The listing is a file that is created when the compiler option LIST is set. The LIST option
is set by default unless the compilation is initiated through CANDE. The file has the
internal name LINE and bears the following information:

1. Compiler version.
2. Date and time of compilation.
3. Code file title.
4. Source and compiler control statements input to the compiler.
5. Code segmentation information.
6. Mark field of the source.
7. Error messages and error count.
8. Warning messages.
9. A listing of the code generated (optional).
10. A list of stack addresses of data items used in the program (optional).
11. Number of input card images scanned.
12. Elapsed compilation time.
13. Processing time required for compilation.
14. Estimated size of program working stack when the program is executed.
15. Estimated size of program files and related storage.
16. Estimated core storage requirement.
17. Total number of words of object code generated.
18. Number of words of array storage required for execution of the program.
19. Number of segments in generated program.
20. Number of disk segments required for code file.

162 3957 6053003


Compiler Information

21. Date the compiler was compiled.


22. Name and contents of the INITIALCCI file.
Depending upon the setting of various compiler options, this listing may contain some
or all of the items listed previously. A single character appears in column 114 on the
listing to denote the source of the card image. A "C" indicates that the card image
came from the file CARD, an "S" indicates that the card image came from the file
SOURCE, an "I" indicates that the card image came from an included file, a "P" denotes
a CARD image that has superseded a SOURCE card image, and an "O" indicates that
the card image was read, but not compiled, during a FULLSEPCOMP.

The output error message file with the internal name and TITLE of ERRORS is created
when the ERRORS compiler option is set. This file is normally used for compilations
initiated through CANDE or IPS, in which case ERRORLIST is set by default and the
ERRORS compiler file is assigned to (or listed at) the remote device involved. When a
syntax error is detected, the offending card image is written to this file, and an error
message is written on the following line of text.

If file equates for ERRORS are present, they are used. Otherwise, if file equates for
ERRORFILE are present, they are used. When file equates for both are present, the
ones for ERRORS are used.

The files XREFDECFILE and XREFREFFILE are created if the compiler control option
XREFFILES is set. These cross reference information files are assigned the TITLEs
XREFFILES/<code file name>/DECs and XREFFILES/<code file name>/REFS,
respectively.

The immediate cross reference information file NEWXREFFILE is also created by the
compiler if XREFFILES (or XREF) is set. If MAKEHOST is set, the file is saved and the
information in it is used in future sepcomps. During a sepcomp, the file XREFFILE
should be label equated to the title of the old NEWXREFFILE.

Compiler File Table


The FORTRAN77 compiler input and output files are listed in Table 16-1, which provides
information concerning the configuration of each file. The attributes of any of these
files may be changed through the use of FILE system control card images.

3957 6053003 163


Compiler Information

Table 161. Compiler Files

Internal Name Purpose Kind Intmode Record Block Size Comments


Size

CARD Primary Input READER EBCDIC 14 or May be Required for


File 15 Blocked or each
words Unblocked compilation.
CANDE file is
equated to
this file
automatically
for
compilations
initiated
through
CANDE.
SOURCE Secondary DISK EBCDIC 14 or May be Optional file.
Input File 15 Blocked or Selected as
words Unblocked input by
setting
MERGE or
SEPCOMP
compiler
option.
(user specified) Include File DISK EBCDIC 14 or May be Optional input
15 Blocked or file opened by
words Unblocked $INCLUDE
card bearing
appropriate
TITLE or
internal file
name. Five
levels
(maximum) of
nesting
permitted (see
discussion of
INCLUDE
option).
CODE Object Code DISK SINGLE 30 1890 words Generated
File words object code
file. Saved or
discarded and
assigned a
TITLE as
indicated in
text.

164 3957 6053003


Compiler Information

Table 161. Compiler Files

Internal Name Purpose Kind Intmode Record Block Size Comments


Size

NEWSOURCE Updated DISK EBCDIC 15 420 words Optional


Symbolic words output file
Output File produced
when NEW
compiler
option is set.
This file
contains
portions of the
source input,
is assigned a
default TITLE
of
NEWSOURCE,
and is suitable
for use in a
later
compilation.
LINE Listing PRINTER EBCDIC 22 22 words Optional file
words produced
when the
compiler
option LIST is
set. Label-
equatable to
REMOTE.
ERRORS Error Listing REMOTE EBCDIC 14 14 words Error listing
Output File for CANDE; words produced
DISK for when
IPS; ERRORLIST
PRINTER compiler
otherwise option is set.
Contains card
images and
error
messages.
XREFDECFILE Cross DISK EBCDIC 17 510 words Information on
Reference words declarations
Declarations for cross
Information reference
analysis. Title
is
XREFFILES/<c
ode file
name>/DECS.

3957 6053003 165


Compiler Information

Table 161. Compiler Files

Internal Name Purpose Kind Intmode Record Block Size Comments


Size

XREFREFFILE Cross DISK EBCDIC 210 210 words Information on


Reference words references for
References cross
Information reference
analysis. Title
is
XREFFILES/<c
ode file
name>/REFS.
NEWXREFFILE Cross DISK EBCDIC 14 180 words Intermediate
Reference words file for holding
Information the cross
Created reference
During a information
MAKEHOST necessary for
sepcomping
XREFFILES
when XREF or
XREFFILES is
set.
XREFFILE Cross DISK EBCDIC 14 180 words File holding
Reference words cross
Information reference
from a information
Previous from a
MAKEHOST previous
compile. Its
updated
contents are
written to
NEWXREFFILE
during a
sepcomp.
HOST Input Object DISK SINGLE 30 1890 words Input object
File for words code file to be
Sepcomping used during a
or sepcomp or
AUTOBIND AUTOBIND.

166 3957 6053003


Compiler Information

Table 161. Compiler Files

Internal Name Purpose Kind Intmode Record Block Size Comments


Size

INITIALCCI Compiler DISK EBCDIC 14 or May be Optional input


Control 15 Blocked or file read prior
Options File words Unblocked to card and
source files.
Compiler
control
options
included
within are
processed
before the
taskstring task
attribute.

Input Decks
The following discussion applies to FORTRAN77 compilations that are initiated through
WFL.

For a compilation, the only required card images are:

1. A BEGIN JOB system control card image.


2. A COMPILE system control card image to initiate compilation and to specify the
type of compilation to be performed.
3. An END JOB system control card image.
System control card images may be placed after the COMPILE card image to specify
compilation arguments and execution arguments and to alter attributes of files (refer
to the ClearPath Enterprise Servers Work Flow Language (WFL) Programming
Reference Manual for more information).

If the deck is to contain source input, the system control card images are followed by
a FORTRAN77 or COMPILER, EBCDIC, DATA, or ASCII system control card image,
depending on the form of the source input (EBCDIC and DATA are synonymous), and
this card image is followed by the source input and compiler control cards. If the deck
is to contain input data, then the source card images are followed by the data decks
consisting of an EBCDIC, DATA, or BINARY system control card images, bearing the
TITLE of the data file, followed by the card images bearing the data. If this data is
coded in BINARY format, then the data is terminated by a binary end (BEND) card.

Four kinds of FORTRAN77 compilations are available to the Unisys ClearPath


Enterprise Servers user. They are:

Compile for Syntax


Compile for Library

3957 6053003 167


Compiler Information

Compile and Go
Compile for Library and Go

Compile for Syntax


Compile for syntax allows a program to be compiled for syntax-checking purposes
only. The object code file is not saved after the compilation.

The form of the COMPILE system control card image for a compile for syntax is the
following:

COMPILE <program name> FORTRAN77 SYNTAX;

Compile for Library


Compile for library indicates that the object code file resulting from a successful
compilation is to be saved. Execution of this code file is not initiated.

The form of the COMPILE system control card image for a compile for library is as
follows:

COMPILE <program name> FORTRAN77 LIBRARY;

The code file resulting from a compile for library may be executed by means of a RUN
or EXECUTE system control card. For execution, the only required card images are:

1. A BEGIN JOB system control card image.


2. A RUN or EXECUTE system control card image bearing the TITLE of the code file
to be executed.
3. An END JOB system control card image.
System control card images may be placed after the RUN or EXECUTE card image to
specify execution arguments and to alter file attributes. If the deck is to contain input
data, the system control card images are followed by data decks consisting of an
EBCDIC, DATA, or BINARY system control card images bearing the TITLE of the data
file, followed by the data card images. If this data is coded in BINARY, the data is
terminated by a binary end (BEND) card.

Compile and Go
Compile and go indicates that the object code file resulting from a successful
compilation is to be immediately executed and then discarded.

The form of the COMPILE system control card image for a compile and go follows:

COMPILE <program name> FORTRAN77 [GO];

168 3957 6053003


Compiler Information

Compile for Library and Go


Compile for library and go indicates that the object code file resulting from a
successful compilation is to be immediately executed and saved.

The form of the COMPILE system control card image for a compile for library and go
follows:

COMPILE <program name> FORTRAN77 LIBRARY GO;

Compilations Using TASKSTRING


The TASKSTRING task attribute is a string containing a maximum of 254 EBCDIC
characters. The TASKSTRING may be used to pass compiler control options to the
compiler. FORTRAN77 allows TASKSTRING to (optionally) contain a $ or $$ as the first
non-blank entity in the string, although the dollar signs have no relevance when used
here. The "%" and the "!" are treated as comment indicators and the information that
follows either of them is ignored. SET, RESET, and POP can be used with the compiler
control options in TASKSTRING just as they would be in standard compiler control
images. The following options may not be passed to the compiler through the
TASKSTRING or appear in any files that included by an INCLUDE option found in the
TASKSTRING:

DELETE, VOIDT, END, OMIT, PAGE, and VOID

If the INCLUDE option is used in the TASKSTRING, it must be the only option in the
string. The included files must consist of valid compiler control images. The options
passed to the compiler through the TASKSTRING are processed after the options read
from the INITIALCCI file, if present, but before any records are processed from the
actual program.

To pass the compiler control options to the compiler using the TASKSTRING task
attribute, append the following to the COMPILE system control card image:

COMPILER TASKSTRING="compiler control image";

Compilations Through CANDE


A FORTRAN77 compilation initiated using the Command and Edit Language (CANDE)
differs from other FORTRAN77 compilations in the following ways:

1. Compiler option LIST is reset by default.


2. Compiler options FREE, ERRORLIST, and LINEINFO are set by default.
3. Compiler option ERRORLIMIT has a default value of 10.
4. The ERRORFILE into which syntax errors are written is equated to the remote
terminal initiating the compilation.

3957 6053003 169


Compiler Information

5. Unless otherwise specified:


a. The CARD file is equated to the work file or specified disk file.
b. No SOURCE file is used.
c. The object code file created by compiling the file <filename> is
(<usercode>)OBJECT/<filename>.
6. All compilations are compiled for library. Execution of the object code may be
initiated by either of two CANDE commands: RUN or EXECUTE.

Compiler Generation Option


NOAUTOBIND (Reset)
When the NOAUTOBIND compiler generation option is set, the BINDER is not bound
into the FORTRAN77 compiler. The resulting compiler is smaller and takes less time to
produce than a compiler for which NOAUTOBIND is not set. A warning is issued if an
attempt is made to set the compiler control option AUTOBIND in a program being
compiled with a NOAUTOBIND compiler. BINDER input statements and BINDER
control options have no effect in a program compiled with a compiler for which
NOAUTOBIND has been set. (Refer to "AUTOBIND" in Section 17.)

1610 3957 6053003


Section 17
Compiler Control Options

Note: This entire section is a Unisys extension to the national standard.

A compiler control option (CCO), formerly referred to as a dollar option, may be used
to affect the way in which the FORTRAN77 compiler compiles and generates code,
input, and output. CCOs are input on a compiler control image (CCI), formerly referred
to as a dollar card.

<compiler control image>

 $ 
    
  <target option>     
    
  <option phrase> 
 
 <inclusion option> 

<option phrase>

 
 

    
 SET   <Boolean option>  
    
 POP   <immediate option>  
    
 RESET   <value option>  
 
   
   
 <Boolean option> 
   
 SET   =  <option expression> 

3957 6053003 171


Compiler Control Options

<Boolean option>

 <ANSI option> 


 
 <ASCII> 
 
 <autobind> 
 
 <binder> 
 
 <bindinfo option>
 
 <callbyreference>
 
 <check option>
 
 <checksubstrings option>
 
 <code option> 
 
 <codefileinit option> 
 
 <convert option> 
 
 <dbltosngl option> 
 
 <debug option> 
 
 <definedstmtfun option> 
 
 <delete option> 
 
 <doublearrays> 
 
 <double option> 
 
 <errorlist option> 
 
 <expressiontoarray> 
 
 <free option> 
 
 <freenew option> 
 
 <freesource option> 
 
 <fullsepcomp option> 
 
 <heap option> 
 
 <Hollerithtocharacter> 
 
 <implicitnone option> 
 
 <inclnew option> 
 
 <ivdep option> 
 
 <library> 
 
 <lineinfo option> 

172 3957 6053003


Compiler Control Options

 
 <list option> 
 
 <listdollar option> 
 
 <listincl option> 
 
 <listinitialcci option> 
 
 <long option> 
 
 <longlimit option> 
 
 <makehost option> 
 
 <map option> 
 
 <merge option> 
 
 <new option> 
 
 <newseqerr option> 
 
 <omit option> 
 
 <omitdebug option> 
 
 <onlyansiintrinsics option> 
 
 <optimize option> 
 
 <own option> 
 
 <ownarrays option> 
 
 <separate> 
 
 <sepcomp option> 
 
 <seq option> 
 
 <seqerr option> 
 
 <statistics option> 
 
 <summary option> 
 
 <tads option> 
 
 <trace option> 
 
 <user option> 
 
 <v_globaltemps> 
 
 <v_report> 
 
 <variabletoarray> 
 
 <void option> 
 
 <warnfatal option> 

3957 6053003 173


Compiler Control Options

 
 <warnsupr option> 
 
 <xref option> 
 
 <xreffiles option> 

<inclusion option>

 <copybegin option> 


 
 <copyend option> 
 
 <include option> 

<immediate option>

 <clear option> 


 
 <end option> 
 
 <page option> 

<value option>
 <errorlimit option> 
 
 <idlen option> 
 
 <sharing option> 
 
 <strings option> 

<option expression>

 <Boolean option> 


   
 NOT   <predefined Boolean option> 

CCO information appears in columns 1 through 72 of a CCI. An eight- digit sequence


number may optionally appear in columns 73 through 80. A CCI cannot be continued.
A CCI can be identified in one of three ways:

1. By a dollar sign ($) in column 1 of the input record


2. By a blank in column 1 and a dollar sign in column 2
3. By a dollar sign ($) in both columns 1 and 2
A CCI with its dollar sign in column 2 or a CCI with a dollar sign in both columns 1 and 2
is a permanent CCI and remains associated with the source language. If a new source
file is created, it appears in the file. If a source listing is created, it appears in the
listing. A CCI with its dollar sign in column 1 does not appear in a new source file or
listing (unless the CCO LISTDOLLAR is set).

174 3957 6053003


Compiler Control Options

CCOs can be broken down into three types:

<Boolean options> have an associated atate, set or reset. A subtype of


<Boolean options> is <predefined Boolean options>.
<Predefined Boolean options> have an associated state,
like the <Boolean options>. The difference is that
<predefined Boolean options> may not have their
associated states changed. They are valid only in an
option expression.
<immediate cause the compiler to perform a function independent
options> of subsequent processing.
<value options> cause the compiler to store a value associated with a
given function.

The keywords SET, RESET, and POP affect the state of standard options and user
options. Each standard and user option has an associated "stack" in which up to 24
previous values of the option are saved. The management of the current value and the
stack of previous values for the option are described as follows:

1. If a <Boolean option> is the object of a SET or RESET, the option is enabled or


disabled, respectively, and the previous value is pushed onto the stack.
2. If a <Boolean option> is the object of a POP, the current value of the option is
discarded and the value most recently pushed onto the stack is removed from the
stack and becomes the current value of the option.
3. If a <Boolean option> is not the object of a SET, RESET, or POP (that is, no SET,
RESET, or POP appeared on the CCI prior to the option), then it is treated as if it
were the object of a SET.
A <Boolean option> may be assigned to the state of another <Boolean option>. In the
following example, the CCO DOUBLE is assigned the current state of LIST.

$ SET DOUBLE = LIST

Certain <Boolean options> are initially reset and become set by appearing on a CCI,
even if they are preceded by POP or RESET. Once these options become set, they
remain set throughout the compilation. In addition, these options must precede the
first source image. The <Boolean options> with the previously described properties
are MAKEHOST, SEPCOMP, FULLSEPCOMP, CODEFILEINIT and CONVERT. SEPCOMP
and FULLSEPCOMP are mutually exclusive once one is set; that is, once one becomes
set, the other can never become set.

A CCI that consists of only a dollar sign has no effect unless merging, also referred to
as patching, is taking place. (See CCOs MERGE or SEPCOMP for a description of this
process).

A CCI may be commented by using "%" or "!". Anything that follows "%" or "!" is ignored
by the compiler.

3957 6053003 175


Compiler Control Options

Two features are available to pass the compiler an initial set of compiler control
options: The INITIALCCI file and the TASKSTRING task attribute (Refer to Section 16 for
more information on the TASKSTRING attribute.)

Only valid compiler control images may appear in the INITIALCCI file. Dollar signs may
be used in columns 1, 2, or both. The placement of the dollar signs in the INITIALCCI
file, however, has no effect on the new source or listing. A "%" or "!" may appear
anywhere in the file as a comment indicator. Anything that follows the "%" or the "!" on
a line is ignored by the compiler. The following options may not be passed to the
compiler through the INITIALCCI file:

DELETE, VOIDT, END, OMIT, PAGE, VOID, and INCLUDE

The INITIALCCI file may be referenced by several different compilers. Therefore, in this
file, and only in this file, any compiler control image that begins with a string followed
by a ":" is treated as a comment, unless the string is "FORTRAN77", "BATCH", or
"INTERACTIVE". The following examples illustrate this feature:

String Result
$FORTRAN77: SET LIST FREE Tells the compiler that this image
should be processed by FORTRAN77.
$BATCH: SET LIST FREE Tells the compiler that this image
should be processed if the compile
was initiated through batch mode.
$INTERACTIVE: RESET LIST SET FREE Tells the compiler that this image
should be processed if the compile
was initiated through CANDE.
$JUNK: SET LIST The FORTRAN77 compiler will not
process this image. The image does
not appear in the listing if one is
requested.

The effect of a given CCO in the INITIALCCI file or TASKSTRING is exactly that of the
same CCO placed at the beginning of a program, with the following exceptions:

1. Any option referring to sequence numbers or the new source (CHECK, SEQ, NEW,
NEWSEQERR, INCLNEW) applies only to the program lines. Sequence numbers are
not checked in the INITIALCCI file, the TASKSTRING, or the TASKSTRING included
files. Information from these three sources is not placed in the new source, if one
is requested.
2. Any option referring to the listing generated by the compiler (LIST, DOUBLE,
LISTDOLLAR) applies only to the program lines. A separate option has been
provided to control the listing of the INITIALCCI file: LISTINITIALCCI. The
TASKSTRING always appears in the heading of the listing, if one is requested.
The remainder of this section lists alphabetically the FORTRAN77 compile control
options.

176 3957 6053003


Compiler Control Options

A_SERIES (Set)
A_SERIES is a predefined Boolean option and its state cannot be changed. It is
intended for use by Unisys only.

ANSI (Reset)
When the ANSI option is set, an attempt is made to issue a warning for all
compile-time use of features that are an extension to the ANSI standard. Note that the
use of run-time extensions to the ANSI standard are NOT flagged.

ASCII (Reset)
ASCII is a Boolean option. Setting this option causes all character and Hollerith data to
be interpreted as ASCII characters. Any files declared when ASCII is set are capable of
handling ASCII data. Formatted, list directed, and unformatted I/O also handle the ASCII
characters correctly. Note that namelist I/O is not supported for ASCII data.

The ASCII option may be set or reset on a line-by-line basis; however, care must be
used when changing the setting of the ASCII option. It is the user's responsibility to
ensure than any mixing of ASCII and EBCDIC data is coordinated properly. Files can
handle ASCII data only if the ASCII option is set when the file is declared, implicitly or
explicitly. An explicit file declaration is a file declared via the FILE statement. Implicit
file declarations occur when the compiler encounters a new unit number for the first
time. Unit numbers can appear in I/O statements, auxiliary I/O statements (OPEN,
CLOSE, and so forth), IMPORT statements, or EXPORT statements. If the file is not
declared under the ASCII option, or the program changes the INTMODE of the file, the
results of any I/O operations with ASCII data are undefined. If the file is declared under
the ASCII option, the results of any I/O operations with EBCDIC data are undefined.
Note that the setting of the ASCII option does not affect files that are imported
because the importing program does not determine the attributes of an imported file.
Library subprograms and files must be coordinated for use with ASCII data.

AUTOBIND (Reset)
The AUTOBIND compiler option allows the processes of compiling and program
binding to be combined into one job. During compilation, any line that begins with a
dollar sign ($) and contains as its first word BIND, DONTBIND, EXTERNAL, HOST,
PURGE, STOP, or USE is processed as an instruction to be passed to the Binder. Also,
a Binder control image may be specified via the BINDER compiler option. The
AUTOBIND option may appear only before the first input source statement in the
program.

3957 6053003 177


Compiler Control Options

Setting the AUTOBIND option causes the BINDINFO option to be set automatically.
The programmer may additionally set SEPARATE or LIBRARY. If SEPARATE or
LIBRARY is set, all program units, including any main program, are treated as separate
subprograms, and the host program must come from outside the source file. In such a
case, the host may be specified either via a Binder HOST statement or via file
equation. If neither SEPARATE nor LIBRARY is set, the object code of the source
program acts as the host for any binding that is performed. Specifying a host does not
override the use of this object code as the host.

Two types of control information may be passed to the Binder when using the
autobinding feature: Binder control option images and Binder input statements. Binder
option images are specified by "$ BINDER" followed by the list of options and option
actions. Except for the word BINDER following the dollar sign, the line is written
exactly as if it were a Binder control image input directly to the Binder.

Binder input statements are passed to the Binder by placing a dollar sign before them.
Except for the dollar sign, the input statement is written exactly as if it were input
directly to the Binder. Thus, a semicolon should be included at the end of the
statement.

Note that STATISTICS, TADS, MAKEHOST, SEPCOMP, and FULLSEPCOMP may not be
set when AUTOBIND is set. If any of these options is already set at the time
AUTOBIND is set, the previously set option is turned off and a warning is issued.

Example 1
Suppose the following source file SEPSUBS is compiled:

$ SET LIBRARY
SUBROUTINE SUB1
PRINT *, ENTERED SUB1
END
SUBROUTINE SUB2
PRINT *, ENTERED SUB2
END

Now the following program is compiled:

$ SET AUTOBIND
$ BIND = FROM OBJECT/SEPSUBS;
PROGRAM MAIN
CALL SUB1
CALL SUB2
CALL SUB3
END
SUBROUTINE SUB3
PRINT *, ENTERED SUB3
END

178 3957 6053003


Compiler Control Options

When the preceding program is run, this output is produced:

ENTERED SUB1
ENTERED SUB2
ENTERED SUB3

Example 2
First the following program in file BINDIT is compiled:

$ SET BINDINFO
PROGRAM BINDIT
REAL RESULT, FUN
EXTERNAL FUN
RESULT = FUN (1.5)
PRINT *, RESULT = , RESULT
END

Then the following program is compiled with AUTOBIND and SEPARATE set:

$ SET AUTOBIND SEPARATE


$ BINDER SET LIST
$ HOST IS OBJECT/BINDIT;
REAL FUNCTION FUN (ARG)
REAL ARG
FUN = 2 * ARG
END

When the preceding source is compiled and run, the following output occurs:

RESULT = 3.0

Also, because SET LIST is specified to the Binder, a Binder listing is generated.

BINDER (No Associated States)


When the AUTOBIND option is set, $ BINDER signifies a Binder control image. See the
description of the AUTOBIND option for more information.

BINDINFO (Reset)
Setting BINDINFO causes the compiled code file to be suitable for use by the Binder.
If the code file is a Binder host file, subprograms written in ALGOL, COBOL, FORTRAN,
or FORTRAN77 itself may be bound into this host, adding to or replacing program units
from the FORTRAN77 host code. The options SEPARATE and LIBRARY set BINDINFO
automatically and produce FORTRAN77 subprograms that may be bound into
FORTRAN77, ALGOL, COBOL, or FORTRAN hosts. A bound-in subprogram serving as a
FORTRAN77 main program must consist of either a true FORTRAN77 main program or
a subroutine (untyped procedure) that has no arguments. See the ClearPath
Enterprise Servers BINDER Programming Reference Manual for more information.

3957 6053003 179


Compiler Control Options

The default value of the BINDINFO option will change to TRUE in a future release.

The BINDINFO option may appear only before the first source input statement in the
program, and its value as then established is retained across any future sepcomps.
BINDINFO may not be set if either STATISTICS or TADS has been set previously. If
BINDINFO is set and the program later sets STATISTICS or TADS, BINDINFO is
automatically reset and a warning is issued. No file compiled with STATISTICS or TADS
set may be used as a Binder host.

When BINDINFO is set, syntax errors for inconsistent subprogram references are
issued even if the references occur in different program units and the subprogram in
question is not actually declared.

Example:
100 $ SET BINDINFO
110
120 SUBROUTINE ONE (D)
130 DOUBLE PRECISION D
140 CALL TWO (D)
150 END
160
170 PROGRAM MAIN
180 LOGICAL L
190 CALL TWO (L)
200 END

** ERROR; EXTERNAL SUBROUTINE TWO HAS BEEN INCORRECTLY


REFERENCED BY PROGRAM UNIT MAIN AT 170: ARGUMENT
#1 FOR SUBROUTINE TWO RESTRICTED TO TYPE DOUBLE

CALLBYREFERENCE (Reset)
When CALLBYREFERENCE is not set and a variable or array element appears as an
actual argument (for example, the corresponding dummy argument is a variable), the
argument is passed by value-result. That is, if the value of the dummy argument
changes, the final value of the dummy argument is assigned to the corresponding
actual argument when execution of the subprogram is completed. The only
exceptions are character variable dummy arguments. A change in the value of a
character variable dummy argument is recorded as a change in the value of the
corresponding actual argument at the time of the change rather than at the end of the
subprogram's execution.

When a SUBROUTINE, FUNCTION, or ENTRY statement is processed, the compiler


examines the state of CALLBYREFERENCE. If it is set, the compiler treats any
non-character dummy argument variables in that program unit as call by reference.
Any change in value of a call by reference dummy argument is recorded as a change in
the value of the corresponding actual argument at the time of the change rather than
at the end of the subprogram's execution.

1710 3957 6053003


Compiler Control Options

The options CALLBYREFERENCE and VARIABLETOARRAY cannot both apply to a given


dummy argument. No dummy argument variable appearing in a SUBROUTINE or
FUNCTION statement when CALLBYREFERENCE is set can be passed to an array by
using VARIABLETOARRAY. If CALLBYREFERENCE is set when an ENTRY statement is
processed, but because of VARIABLETOARRAY a non-character dummy argument
variable cannot be made call by reference, a warning message is issued.

If a dummy argument is a type integer variable, the value it assumes when the
subprogram is entered is normally made an integer. This does not apply to call by
reference integer arguments. A call by reference integer dummy argument assumes
the value of the actual argument, even if the actual argument is real.

CHECK (Reset)
The CHECK option causes the compiler source input files and updated source file
NEWSOURCE to be checked for sequence number errors. A sequence error condition
exists when a sequence number on a source card image is less than or equal to the
sequence number on the preceding card image. A warning message is placed on the
output listing when such an error is found. When the CHECK, SEQERR, and
NEWSEQERR options are reset, the compiler performs no sequence checking.

CHECKSUBSTRINGS (Reset)
When the CHECKSUBSTRINGS option is set, the compiler generates code to check
bounds on substrings.

CLEAR (No Associated States)


The immediate option CLEAR resets and discards the previous values of all Boolean
options with the exception of those listed here:

A_SERIES DOUBLE INCLNEW OWNARRAYS


ANSI ERRLIST IVDEP SEPARATE
ASCII ERRORLIST LIBRARY SEPCOMP
AUTO BIND FREE LINEINFO SINGLE
BINDINFO FREENEW MAKEHOST TADS
CODEFILEINIT FREESOURCE M ERGE User Options
CONVERT FREETAPE NEW XREF
DEBUG FULLSEPCOMP OS_1100 XREFFILES

CODE (Reset)
The CODE option causes the output listing to contain the object code generated by
the compiler.

3957 6053003 1711


Compiler Control Options

CODEFILEINIT (Reset)
The CODEFILEINIT option is initially reset and becomes set by appearing on a compiler
control image, even if it is preceded by a POP or RESET. Once it becomes set, it
remains set throughout the compilation and remains set in any separate compilations
that may occur later. In addition, the option may appear only on a compiler control
record that precedes the first source input statement.

When this option is specified, the initialization of data areas (arrays, COMMON
storage, and characters) is done only when the data is first referenced and is initialized
from the codefile, provided the size of the data area does not exceed 2**20-1 words at
the time of its initialization. If the size of the data area does exceed 2**20-1 words at
the time of its initialization, then that data area will be initialized at stack building time
and not from the code file. Although this option may cause small programs to run
slower, it is beneficial for large programs that may have many items initialized.
Specifying the option cuts down on the startup time and only those data areas that are
actually used are initialized. Side effects of setting this option are that the compile
time for the program is slightly longer, and the codefile could be much larger.

Not specifying this option causes all the items to be initialized at stack building time.
This method is best for programs that have few initializations and that use most of the
data areas that have been initialized.

Note that the value of CODEFILEINIT in any separate compilation retains the value of
CODEFILEINIT when MAKEHOST is set. Any reference to CODEFILEINIT in a separate
compilation is ignored.

One side effect caused by CODEFILEINIT in separate compilations is that COMMON


storage always retains the values from previous compilations; to zero out a once
initialized area, one must specifically zero it out in the separate compilation change.

CONVERT (Reset)
The CONVERT option aids in the conversion from old FORTRAN to FORTRAN77. The
CONVERT option must appear before the first FORTRAN source statement, and
cannot be reset. Under this option, certain rules of old FORTRAN hold for FORTRAN77
compilations.

Specifying CONVERT (F77DO) results in the implementation of all CONVERT features


with the exception of DO loops, which are implemented according to FORTRAN77 DO
loop specifications.

The following is a description of the features that are available in FORTRAN77 under
the CONVERT option.

1712 3957 6053003


Compiler Control Options

DO Loops
If CONVERT is specified, but F77DO is not, all DO loops are guaranteed to execute at
least once. For example:

REAL A(5)
DO 100 I=5,1
A(I)=-1.5
100 CONTINUE
WRITE (6,900) A
900 FORMAT (1X,5(1X,F4.1))

Execution of this program produces the following output:

0.0 0.0 0.0 0.0 -1.5

DATA and TYPE


When CONVERT is set, any variable that is assigned an initial value by means of a
DATA or TYPE statement is treated as a SAVE variable. A SAVE variable retains its
definition status after the execution of a RETURN or END statement in a program unit.

Conversion Restrictions
The CONVERT option does not cover all cases where there are differences between
old FORTRAN and FORTRAN77. The following is a list of things that must be changed
before an old FORTRAN program will compile in FORTRAN77.

1. In FORTRAN77 the DATA statement and statement functions must appear after
the specification statements. Statement functions have the additional restriction
that they must come before the first executable statement.
2. Multiple statements per line separated by a semicolon must be put on individual
lines.
3. There must be fewer than 100 continuation lines.
4. The syntax of the PRINT statement has changed. The slash (/) must be replaced by
an asterisk (*); that is, PRINT *, X.
5. In FORTRAN77 an array must be addressed within the declared bounds of the
array.
6. The ZIP statement is not allowed in FORTRAN77. This function can be
accomplished through the use of a LIBRARY routine.
7. A user procedure that has the same name as an intrinsic is not recognized as an
external procedure unless it appears in an EXTERNAL statement in the program
unit that references it.

3957 6053003 1713


Compiler Control Options

8. The DO statement is treated differently in several ways in FORTRAN77. These


differences include:
a. The iteration count is tested before execution of any statement within the
range of the DO-loop. This means that the loop does not have to be executed
at least once.
b. The alteration of the DO-loop arguments within the range of the loop do not
have any effect on the number of times the loop is executed. In FORTRAN77
incrementation argument values are established at the time the DO-loop is
initially evaluated.
c. Transfer of control into the range of the DO-loop is not permitted in
FORTRAN77.

COPYBEGIN and COPYEND (No Associated States)


The COPYBEGIN and COPYEND options may appear in an include file to instruct the
compiler to begin including records (COPYBEGIN) and to stop including records
(COPYEND) if the string following the option matches the string on the corresponding
INCLUDE card. A maximum of 17 characters are used from the string, all others are
ignored by the compiler. A warning message is issued if these options are found on a
compiler control image not in an include file.

A compiler control image bearing a COPYBEGIN or COPYEND option may contain no


other compiler control options. The format for these options is as follows:

$COPYBEGIN <s>
$COPYEND <s>

where <s> is any valid string.

DBLTOSNGL (Reset)
When the DBLTOSNGL option is SET, all DOUBLE PRECISION quantities are treated as
single precision, and all variables declared as type DOUBLE PRECISION are treated as
type REAL. In addition, any referenced intrinsic function that takes DOUBLE PRECISION
arguments or returns DOUBLE PRECISION values is substituted by the compiler with
its corresponding REAL function (for example, SQRT is substituted for DSQRT).

DEBUG (Reset)
The DEBUG option is intended for Unisys use only.

DEFINEDSTMTFUN (Reset)
While the DEFINEDSTMTFUN option is set, statement functions are interpreted as text
substitution instructions. Refer to "Statement Functions" in Section 12 for more
information.

1714 3957 6053003


Compiler Control Options

DELETE (Reset)
The DELETE option limits source input. When DELETE is set, only input from file CARD
is compiled; input from the secondary file SOURCE, including compiler control images,
is ignored until DELETE is reset. The ignored input is neither listed nor included in the
updated symbolic file regardless of the states of LIST and NEW. The old FORTRAN
option, VOIDT, is accepted as a synonym for DELETE regardless of the state of the
CONVERT option.

DOUBLE (Reset)
The DOUBLE option alters the format of the compilation listing. When DOUBLE is set,
the listing is DOUBLE spaced; when DOUBLE is reset, the listing is single spaced. The
old FORTRAN option, SINGLE, is accepted as a synonym for the RESET DOUBLE
option.

DOUBLEARRAYS (Reset)
The DOUBLEARRAYS option is used to permit passing arguments of DOUBLE
PRECISION and COMPLEX array data types between FORTRAN77 and other languages.
When a SUBROUTINE, FUNCTION, ENTRY, or IMPORTFROM statement is processed,
the compiler examines the state of DOUBLEARRAYS. If it is set, the compiler attempts
to pass any double precision or complex array arguments to the subroutine or
function as double data descriptors.

Libraries and DOUBLEARRAYS


A FORTRAN77 library entry point that is compiled with DOUBLEARRAYS reset and has
double precision or complex array formal arguments can only be referenced from a
FORTRAN77 program. If that library entry point is compiled with DOUBLEARRAYS set,
it can be referenced from FORTRAN77 programs and programs written in other
languages. A FORTRAN77 program that references the entry point need not be
compiled with DOUBLEARRAYS set. The entry point can be passed either double or
single data descriptors from a program written in FORTRAN77.

In order for a FORTRAN77 program to use an imported library entry point that has
double precision or complex array formal arguments, and is written in another
language, DOUBLEARRAYS must be set when the IMPORTFROM, FUNCTION, or
SUBROUTINE statement for that entry point is compiled. If DOUBLEARRAYS is set and
the library is written in FORTRAN77, then the library must have DOUBLEARRAYS set
when the entry point is compiled.

DOUBLEARRAYS Ignored
A double precision or complex array argument may be passed as a single data
descriptor, even if DOUBLEARRAYS is set, under certain circumstances, described in
the following list. Subprogram refers to the subroutine or function for which
DOUBLEARRAYS is requested (for example, DOUBLEARRAYS is set when the
SUBROUTINE, FUNCTION, ENTRY, or IMPORTFROM statement is processed). Double
precision array is used to refer to either a double precision or complex array.

3957 6053003 1715


Compiler Control Options

1. When an invocation of the subprogram passes a double precision array that is a


formal argument, each reference to the subprogram throughout the program
passes that argument as a single data descriptor.
2. If the subprogram appears as an actual argument, all of its double precision array
arguments are passed as single data descriptors each time the subprogram is
referenced throughout the program.
3. A double precision array can have an odd offset as a result of appearing in a
common block or being equivalent to an item in a common block. When an
invocation of the subprogram passes a double precision array that has an odd
offset, each reference to the subprogram throughout the program passes that
argument as a single data descriptor.
Examples
The following example demonstrates BINDER and DOUBLEARRAYS. The ALGOL
program can be bound into the FORTRAN77 program. Double precision and complex
arrays are passed from FORTRAN77 to the ALGOL procedure.

ALGOL procedure:
$ SET SEPARATE
PROCEDURE ONE(A, B, C, D);
DOUBLE ARRAY A[*]; DOUBLE B;
COMPLEX ARRAY C[*]; COMPLEX D;
BEGIN
...
END;

FORTRAN77 host:
$ SET BINDINFO DOUBLEARRAYS
SUBROUTINE ONE(A, B, C, D)
DOUBLE PRECISION A(2), B
COMPLEX C(2), D
...
END

DOUBLE PRECISION D(3)


COMPLEX C(3)
DATA D/1,2,3/, C/(4,5), (6,7), (8,9)/
CALL ONE(D(2), D(2), C(2), C(2))
END

The following example demonstrates libraries and DOUBLEARRAYS. The FORTRAN


library is invoked from the FORTRAN77 program. Double precision and complex arrays
are passed between the two.

FORTRAN library:
BLOCK GLOBALS
EXPORT ONE
END

1716 3957 6053003


Compiler Control Options

SUBROUTINE ONE(D, C)
DOUBLE PRECISION D(2)
COMPLEX C(2)
END

CALL FREEZE(TEMPORARY)
END

FORTRAN77 program:
$ SET DOUBLEARRAYS
BLOCK GLOBALS
LIBRARY L
IMPORT FROM L (ONE)
END

PROGRAM MAIN
DOUBLE PRECISION D(2)
COMPLEX C(2)
COMMON /COM/ R1, R2, D, R3, R4, C
CALL ONE(D, C)
END

The following example demonstrates the separate compilation facility and


DOUBLEARRAYS. The invocation of ONE from MAIN passes a complex array that has
an odd offset. As a result, all invocations of ONE pass a single data descriptor. The
library could not be written in ALGOL. A separate compilation that either gets rid of
the reference that passes the odd offset array or changes the common block
declaration to give the array an even offset would result in all invocations of ONE
passing a double data descriptor. TWO would not need to be recompiled.

$ SET MAKEHOST
BLOCK GLOBALS
LIBRARY L1, L2
$ SET DOUBLEARRAYS
IMPORT FROM L1 (ONE)
$ RESET DOUBLEARRAYS
IMPORT FROM L2 (THREE)
END

SUBROUTINE TWO
COMPLEX C(2)
CALL ONE(C)
CALL THREE(C)
END

PROGRAM MAIN
COMPLEX C(4)
COMMON /COM/ R1, C % C HAS AN ODD OFFSET

3957 6053003 1717


Compiler Control Options

CALL ONE(C)
END

In the preceding example, suppose that L2 is a library written in FORTRAN77. Any


reference to THREE within the previous program passes a single data descriptor. If
THREE, in the library itself, is compiled with DOUBLEARRAYS set, it can be passed a
double data descriptor from a language other than FORTRAN77. From a FORTRAN77
program it can be passed either a double or single data descriptor. If THREE is
compiled with DOUBLEARRAYS reset, it can only be passed a single data descriptor.

Restrictions
1. Recall that passing a subroutine or function as an actual argument results in any
double precision or complex arrays being passed as single data descriptors.
During a separate compilation deleting any uses of the subroutine or function as
an actual argument does not cause double precision and complex arrays to be
passed as double data descriptors. The declaration and all references to the
subprogram would have to be deleted, and the declaration added on a subsequent
separate compilation, in order to get the double precision and complex array
arguments to be passed as double data descriptors. As with other options,
DOUBLEARRAYS has to be set when compiling a program unit during a separate
compilation in order for it to take effect.
2. If a FORTRAN77 host is to pass double precision or complex arrays to bound-in
subprograms written in other languages, the subprogram must be replacement
bound. The program unit that is going to be replaced by binding must be explicitly
declared with DOUBLEARRAYS set. No references to the program unit should
force any of the double precision or complex array arguments to be passed as
single data descriptors.

END (No Associated States)


The END option signals an end of file on the medium where it is encountered.

ERRORLIMIT (200 For Non-CANDE Compilations, 10


For CANDE Compilations)
The ERRORLIMIT option allows the user to indicate that compilation is to be
terminated when a certain maximum number of syntax errors are detected in the
source input.

The proper format of the ERRORLIMIT option is the following:

ERRORLIMIT [=] n

where n is an unsigned integer constant specifying the maximum number of syntax


errors.

1718 3957 6053003


Compiler Control Options

A limit of 0 indicates that there is no limit on the number of errors allowed. The
ERRORLIMIT CCO is in effect only when it appears on a CCI that precedes the first
source input statement. The old FORTRAN option, LIMIT, is accepted as a synonym for
ERRORLIMIT regardless of the state of the CONVERT option.

ERRORLIST (Reset For Non-CANDE Compilations,


Set For CANDE Compilations)
The ERRORLIST option lists compilation errors separate from the source input listing.
When set, the ERRORLIST option directs the error listing to the compiler output file
ERRORS. When a compilation error is detected in the source input, the offending line
of text and an error message are written to ERRORS. (The error message appears in
any source input listing as well.) The ERRORLIST option is provided primarily for use
when the FORTRAN77 compiler is called from a remote terminal by CANDE, but it may
be used regardless of the manner in which the compiler is initiated. When the
compiler is initiated from CANDE, ERRORS is automatically equated to the remote
device by default.

Either ERRORS or ERRORFILE can be used when label-equating the error file. ERRORS
is the default INTNAME and TITLE of the file; any file equation of ERRORS takes
precedence over file equation of ERRORFILE. However, if ERRORFILE, but not
ERRORS, is file equated, the file has the INTNAME and default TITLE "ERRORFILE". If
ERRORS (or ERRORFILE) is assigned KIND=DISK, the PROTECTION=SAVE should also
be specified. The old FORTRAN option, ERRLIST, is accepted as a synonym for
ERRORLIST.

EXPRESSIONTOARRAY (Reset)
Within a subprogram, when the first reference is made to a subroutine or function, the
compiler examines the state of EXPRESSIONTOARRAY. If it is set, then for each
reference to that subroutine or function within the subprogram, the compiler treats
any actual arguments that are expressions as single dimension arrays of length one,
where the element in the array has the value of the expression. An expression that is
treated as an array may be passed to a formal argument that is either an array or a
variable without producing a syntax error.

An exception to the rule that the actual argument is treated as an array of length 1
occurs with Hollerith constants. If the actual argument is a Hollerith constant
containing more than four characters, it is treated as an array that is long enough to
accommodate the specified length of the string. For example, the Hollerith constant
8H1234ABCD may be passed to a formal integer array dimensioned two words long.

Use with Libraries


VARIABLETOARRAY and EXPRESSIONTOARRAY may be used to pass variables and
expressions to formal arguments that are arrays for subroutines imported from
libraries. This applies to library entry points that are declared as the result of an
INLIBRARY statement or an IMPORT statement.

3957 6053003 1719


Compiler Control Options

Using the IMPORT statement may create instances where it cannot be determined
whether a particular formal argument is an array or a variable. If it cannot be
determined from the references, it is assumed to be an array.

Use with BINDER


VARIABLETOARRAY and EXPRESSIONTOARRAY may be used to pass variables and
expressions to formal arguments that are arrays for subroutines that are bound in
using BINDER.

Referring to a subprogram that is not explicitly declared may create instances where it
cannot be determined whether a particular formal argument is an array or a variable. If
it cannot be determined from the references, it is assumed to be an array.

Use with DOUBLEARRAYS


The DOUBLEARRAYS option is used to allow double and complex array data types to
be passed between FORTRAN77 and other languages. The new options
VARIABLETOARRAY and EXPRESSIONTOARRAY may be used with DOUBLEARRAYS.
A variable or expression that is passed as an array is passed as a single data
descriptor unless DOUBLEARRAYS is used.

With DOUBLEARRAYS, a double precision or complex array argument may be passed


as a single data descriptor even if DOUBLEARRAYS is set, under certain
circumstances (for example, when an invocation of a subroutine or function passes a
double precision array that is a formal argument). This exception does not apply when
VARIABLETOARRAY is used in conjunction with DOUBLEARRAYS. If the formal
argument is a variable and is passed as an array as the result of VARIABLETOARRAY,
then DOUBLEARRAYS results in a double data descriptor.

Use with HOLLERITHTOCHARACTER


The HOLLERITHTOCHARACTER option takes precedence over the
EXPRESSIONTOARRAY option.

Examples
The following example demonstrates VARIABLETOARRAY and
EXPRESSIONTOARRAY. Setting VARIABLETOARRAY allows V to appear as an actual
argument to ONE. Setting EXPRESSIONTOARRAY allows "TEST" to appear as an actual
argument to ONE, and 0 to appear as an actual argument to TWO.

$ SET VARIABLETOARRAY EXPRESSIONTOARRAY


SUBROUTINE ONE(A, C)
DIMENSION A(1)
CHARACTER *5 C(1)
...
END

SUBROUTINE TWO(A)
DIMENSION A(1)

1720 3957 6053003


Compiler Control Options

...
END

PROGRAM MAIN
CALL ONE(V, "TEST")
CALL TWO(0)
END

The following example demonstrates BINDER, DOUBLEARRAYS, and


VARIABLETOARRAY.

$ SET SEPARATE
SUBROUTINE ONE(C)
COMPLEX C(1)
...
END

The previous FORTRAN subroutine may be bound into the following FORTRAN77
program. VARIABLETOARRAY causes CV to be treated as an array, and
DOUBLEARRAYS results in a double data descriptor being passed. Note that
replacement binding must be used with a subroutine or function that requires
DOUBLEARRAYS.

$SET BINDER DOUBLEARRAYS VARIABLETOARRAY


SUBROUTINE ONE(C)
COMPLEX C(1)
END

PROGRAM MAIN
COMPLEX CV
COMMON R1, R2, C
...
CALL ONE(CV)
END

The following example demonstrates libraries and EXPRESSIONTOARRAY. The formal


argument to ONE is an array.

$ SET EXPRESSIONTOARRAY
BLOCK GLOBALS
LIBRARY L
IMPORT FROM L(ONE, TWO)
END

PROGRAM MAIN
CALL ONE(0)
END

3957 6053003 1721


Compiler Control Options

The following example demonstrates the use of a Hollerith constant as an actual


argument along with the option EXPRESSIONTOARRAY. Storing the Hollerith constant
in integer format requires four words of storage since each word contains up to four
characters of the string.

SUBROUTINE ONE (1)


INTEGER 1 (4)
...
END

$ SET EXPRESSIONTOARRAY
PROGRAM MAIN
...
CALL ONE (14HTHIS IS A TEST)
END

The following example illustrates the effect of using both the


HOLLERITHTOCHARACTER and the EXPRESSIONTOARRAY options. In the call to
subroutine S1, where both the HOLLERITHTOCHARACTER option and the
EXPRESSIONTOARRAY option are set, the Hollerith constant is processed according
to the rules of the HOLLERITHTOCHARACTER option; that is, it is treated as a
character item. In the call to subroutine S2, the option HOLLERITHTOCHARACTER is
reset and the Hollerith constant is processed according to the rules of the
EXPRESSIONTOARRAY option; that is, it is treated as though it were an array.

$ 87SET EXPRESSIONTOARRAY HOLLERITHTOCHARACTER


SUBROUTINE S1(C)
CHARACTER C*8
...
END

SUBROUTINE S2(I)
INTEGER I(2)
...
END

PROGRAM MAIN
CALL S1(8H12345678)
$ RESET HOLLERITHTOCHARACTER
CALL S2(8H12345678)
END

Miscellaneous Notes
1. Program execution time increases when VARIABLETOARRAY or
EXPRESSIONTOARRAY is used. The options should be used only if needed.
2. A variable that appears in a DEBUG MONITOR statement may be treated as an
array as the result of using VARIABLETOARRAY. In such a case, changes that are
the result of the variable appearing as an actual argument are not monitored.

1722 3957 6053003


Compiler Control Options

FREE (Reset For Non-CANDE Compilations, Set For


CANDE Compilations)
The FREE option allows the compilation of free-form source programs from the
source file CARD. (For more information on fixed-form statements, refer to Section 1.)
The FREE option allows simple input from remote devices. The following restrictions
must be observed:

1. Continuation card images must contain a minus sign (-) or asterisk (*) as the first
non-blank character in the first six columns.
2. Comments must have a "C" in column one and a minus sign or asterisk in column
2.
3. For statements with labels, the label must appear in the first five columns.
4. Each free-form statement may contain 66 characters at most, including blanks and
not including sequence numbers. Any characters beyond the 66th character, but
before column 73, are flagged with a warning and ignored.
5. Continuation card images are shifted to the right until the continuation character "*"
or "-" is in column 6. If this shift causes a card image to extend past column 72, and
if there are blanks between the continuation character and the source, the source
is shifted to the left until either the card image no longer extends past column 72
or until the source begins in column 7.
6. Columns 73 through 80 of the source card image are reserved for the sequence
numbers, as in the case of formatted source input.
7. Compiler control images must have a dollar sign ($) in column 1 or a blank in
column 1 with a dollar sign in column 2.
8. FILE statements must have the string FILEbb in columns 1-6 where b represents a
blank.

FREENEW (Reset)
When FREENEW and NEW options are set, the updated symbolic output file
NEWSOURCE is created in a form that can be compiled with FREE set.

FREESOURCE (Reset)
The FREESOURCE option permits the source file SOURCE to be free format. The old
FORTRAN option, FREETAPE, is accepted as a synonym for FREESOURCE regardless
of the state of the CONVERT option.

3957 6053003 1723


Compiler Control Options

FREEZEANDGO (Reset)
The FREEZEANDGO option allows a FORTRAN77 program to run both as a normal
program and as a library. When FREEZEANDGO is set the program is frozen as a
permanent library with all entry points available before the main program is executed.
After freezing, the main program is executed normally. If there are still users of the
entry points when the main program finishes, the library becomes a temporary library
and thaws when there are no more users.

As an example, a FORTRAN77 program may export files and common blocks, so that if
the program calls a library, the library may have access to them. The library may use
the files and common blocks, but they actually belong to the program. This means that
the files may be label-equated at run-time and print files are associated with the
program task.

Entry points must be explicitly exported and no call on the FREEZE intrinsic may
appear.

FULLSEPCOMP (Reset)
The only difference between this option and SEPCOMP is that the entire SOURCE file
is read during SEPCOMP. All CCIs found are processed; however, as with SEPCOMP,
only selected procedures are recompiled. Adding this option allows the user to obtain
a complete SOURCE file and listing while doing a SEPCOMP. See the SEPCOMP option
for more information.

SEPCOMP (Reset) FULLSEPCOMP 



 
 (  <HOST filename>  ) 

HEAP (Reset)
The HEAP option is used to control the allocation of the SAVE or OWN arrays and
variables. Any SAVE or OWN item that is declared or first seen on a record when the
proper option is set is put into a heap. The net result is that only one D2 stack cell is
required for all these variables and arrays, and a user with a large program with many
OWN and/or SAVE items does not exceed the D2 addressing limit of 4096.

The HEAP option's format is as follows:

1724 3957 6053003


Compiler Control Options

 HEAP 


 
   
   
     
     
 (  ) 
   
 SET   ALL 
   
 RESET   ARRAYS 
 
 VARIABLES 
 
 TEMPORARIES 

The initial state of all the arguments is set. The default value for the HEAP option is
reset. When HEAP is reset, no heaping of items is done, regardless of the state of any
arguments. If HEAP appears without an argument list, the state of the arguments is
unchanged.

If ARRAYS is set, the SAVE and OWN arrays and character variables are put into the
heap. If VARIABLES is specified, the SAVE and OWN variables are put into the heap. If
TEMPORARIES is set, all the temporary arrays are heaped. If ALL is specified, all the
SAVE variables and arrays and temporary arrays are heaped.

HOLLERITHTOCHARACTER (Reset)
HOLLERITHTOCHARACTER is a Boolean option. When a CALL statement is processed,
the compiler examines the state of HOLLERITHTOCHARACTER. If it is set, the
compiler treats any Hollerith constants that appear in the CALL statement as character
constants.

The HOLLERITHTOCHARACTER option takes precedence over the


EXPRESSIONTOARRAY option. Refer to "EXPRESSIONTOARRAY" option in this section
for more information and examples.

Examples
The following example demonstrates the use of a Hollerith constant as an actual
argument along with the option HOLLERITHTOCHARACTER. In the reference to TWO,
the compiler treats the Hollerith as a character string.

SUBROUTINE ONE(I)
INTEGER I
...
END

SUBROUTINE TWO(C)
CHARACTER *14 C
...
END
PROGRAM MAIN

3957 6053003 1725


Compiler Control Options

...
CALL ONE(4H1234)
$ SET HOLLERITHTOCHARACTER
CALL TWO(14HTHIS IS A TEST)
END

The following example demonstrates the use of a Hollerith constant as an actual


argument along with the option EXPRESSIONTOARRAY. Because
EXPRESSIONTOARRAY is set, the compiler treats the Hollerith constant as an array.
Storing the Hollerith constant in integer format, as described previously, requires four
words of storage.

SUBROUTINE ONE(I)
INTEGER I(4)
...
END

$ SET EXPRESSIONTOARRAY
PROGRAM MAIN
...
CALL ONE(14HTHIS IS A TEST)
END

IDLEN (31)
The IDLEN option allows the user to specify the maximum length of identifiers. The
proper format of the IDLEN option is the following:

IDLEN [=] n

where n is an unsigned integer constant specifying the maximum length of identifiers.


n must be in the range 6 to 31. The IDLEN CCO is in effect only when it appears on a
CCI that precedes the first source input statement.

IMPLICITNONE (Reset)
The IMPLICITNONE compiler control option can be set or reset at any time; however,
the most recently specified value of IMPLICITNONE takes effect only when the first
statement of the next program unit is encountered. If IMPLICITNONE is set, all
variables, arrays, symbolic names of constants, and functions (except intrinsic
functions) must have their types explicitly declared. Setting the IMPLICITNONE option
once at the beginning of a program has the same effect as including an IMPLICIT
NONE statement within every program unit in that program.

1726 3957 6053003


Compiler Control Options

INCLNEW (Reset)
The INCLNEW option controls the contents of the updated symbolic file NEWSOURCE.
When INCLNEW and NEW options are set, any source text that is input to the
compiler via the INCLUDE option, is output to file NEWSOURCE. If INCLNEW is reset,
then the INCLUDEd text is not written to the NEWSOURCE file. If the state of the NEW
option is reset, the INCLNEW option is ignored.

INCLUDE (No Associated States)


The INCLUDE option allows the user to input text from specified files in addition to the
CARD and SOURCE files. When the compiler is accepting source input from the CARD
or SOURCE file and a $ INCLUDE record is encountered, the portion of the file
indicated on this record is inserted into the input text in place of the $ INCLUDE
record. The included text may also contain $ INCLUDE records, however, only five text
nesting levels are permissible.

The following is the proper format for the INCLUDE image:

 INCLUDE 


       
 <f>    <m>   - <n>  
 
 ( <s> ) 

where

f is either an internal file name or a file TITLE enclosed in apostrophes or


quotation marks
m is either unsigned integer constant from one to eight digits or an
asterisk
n is an unsigned integer constant from one to eight digits
s is any valid string (case insensitive)

In the format for the INCLUDE image, m indicates the sequence number of the first
record to be included from the file referenced by this INCLUDE statement. If m is an
asterisk rather than a sequence number, then inclusion begins with either the first
record of the file or the record following the last record included from this file by a
previous INCLUDE statement at the same level as the present INCLUDE statement. If
item m is missing, inclusion begins at the same point indicated by an asterisk. Item n
denotes a one-to-eight digit unsigned integer constant that is the sequence number of
the last record to be included from the file. If this item is missing, records are included
from the file until the end of the include file is encountered.

3957 6053003 1727


Compiler Control Options

The item s indicates that a string may be specified as the including delimiter instead of
a range of sequence numbers. The compiler starts searching at the beginning of the
included file for a COPYBEGIN card with a matching string. The compiler includes all of
the records following the matching COPYBEGIN card until a matching COPYEND card
is found, at which time the compiler stops including records from the included file.
The remainder of the included file is never seen by the compiler. Only 17 characters
from the string specified in the INCLUDE statement are used in the search; if the first
17 characters match the first 17 characters on a COPYBEGIN card, the compiler begins
the include. (Refer to "COPYBEGIN and COPYEND" in this section for a description of
these cards.)

The item f denotes the file from which the include records are to be drawn. If this item
is missing from the INCLUDE statement, then the file to be used is the file designated
to be the last INCLUDE statement at that level. An error condition exists if an INCLUDE
statement appears that does not specify a file, and no previous INCLUDE statement at
the same level has specified a file. Thus, the first INCLUDE image at any of the five
possible levels of text nesting must contain either a file TITLE or an internal file name.

A compiler control image bearing an INCLUDE option may contain no other compiler
control options. A warning message is issued for any INCLUDE option that does not
result in the inclusion of records. For example, if an include file is empty or if the
specified range, sequence numbers, or string is not found in the include file, the
compiler does not include any records.

The following are examples of INCLUDE images:

$ INCLUDE FILE8 00001000 - 09000000


$ INCLUDE
$ INCLUDE "SOURCE/XYZ" - 900
$ INCLUDE INCLFILE
$ INCLUDE INCLFILE ("DELIM")

The first example instructs the compiler to accept as input all records from the library
file with internal file name FILE8 that have sequence numbers between and including
00001000 and 09000000. The TITLE and other attributes of the FILE8 file may be
specified on a FILE system control card.

The second example instructs the compiler to accept as input a portion of the file
accessed by the last INCLUDE statement in this deck at this level. The records to be
included consist of all records following the last record accessed by the last INCLUDE
statement at this level. If this example is in the same deck as the first example and no
other INCLUDE statements intervene, the file with internal name FILE8 is accessed and
the first record with the next sequence number after 09000000 is included.

The third example instructs the compiler to accept as input a portion of the file with
the TITLE of SOURCE/XYZ. All records between the last record included from that file
at this level and the record with the sequence number immediately higher than
00000900 are included.

1728 3957 6053003


Compiler Control Options

The fourth example instructs the compiler to accept as input a portion of the file with
the internal name INCLFILE. All records in the file between the last record included
from that file at this level and the end of the file are included.

The fifth example instructs the compiler to begin searching INCLFILE from the first
record of the file, for a COPYBEGIN card with "DELIM" as the string. If the compiler
does not find one, it begins including records from the INCLFILE until a COPYEND card
with "DELIM" as the string is found. If the matching COPYEND card is never found, the
remainder of the file is included.

IVDEP (Reset)
The option IVDEP indicates to the compiler that any dependency that is found in the
following DO loop should be ignored. The setting applies only to the first DO
statement encountered when IVDEP is set. Note that the setting of IVDEP at a DO
statement applies to the entire loop, including all loops nested within the DO
statement. IVDEP has no effect unless vectorization is invoked.

For further information on vectorization, see Section 19.

LIBRARY (Reset)
LIBRARY is similar to SEPARATE in that it causes all program units to be separately
compiled; however, when LIBRARY is set, all the program units go into a single code
file. The title of the resulting code file is the default title or the title specified in the
COMPILE command.

If the LIBRARY option is set, the SEPARATE option is set by the compiler. When a
compilation is initiated through CANDE and SEPARATE is set, the LIBRARY option is
set by the compiler.

The state of the LIBRARY option cannot be changed after the first source statement is
processed.

LINEINFO (Reset For Non-CANDE Compilations, Set


For CANDE Compilations)
The LINEINFO option causes sequence number information and its relationship to code
to be saved. If a program terminates abnormally, the sequence number of the
termination point is provided.

The default value of the LINEINFO option will change to TRUE in a future release.

3957 6053003 1729


Compiler Control Options

LIST (Set For Non-CANDE Compilations, Reset For


CANDE Compilations)
The LIST option controls the generation of the LINE compiler file. An output listing is
generated on the file LINE only if the LIST option is set for some portion of the source
input. The source statements for which the LIST option is set are placed in this listing.
The LIST option may be set and reset as desired within the source input.

The following is a description of the LINE file records that are produced by setting the
LIST option. Columns that are unspecified are blank.

Columns Description of Contents


001-028 Program Unit Name, determined as follows:
1. Entry point name, if applicable
2. Subprogram name, if applicable
3. Main Program Name (.MAIN. if none)
If the program unit name is nore than 28 characters, the name is
truncated and three '.' characters placed in the last three columns
(columns 26-28).
030 Vectorization result flag. See "Vectorization Result Flags" in Section
19 for an explanation of the codes.
032-103 The FORTRAN Source
105-112 The eight digit sequence number
114 One letter, indicating from where the line came, as follows:
C = CARD
I = INCLUDE
P = PATCH
S = SOURCE
O = SEPCOMP
116-121 Code address in the format wwww:o where wwww represents the
word and o represents the offset. The code segment number is
printed on a separate line whenever the segment number changes.
123-132 The Mark field (from columns 81-90 of the FORTRAN source image).

LISTDOLLAR (Reset)
The LISTDOLLAR option causes all compiler control statements to be included in the
listing if the LIST option is set.

1730 3957 6053003


Compiler Control Options

LISTINCL (Set)
The LISTINCL option controls the generation of the LINE compiler file within INCLUDE
files. If LIST is set, resetting LISTINCL suppresses the output of included records to
the LINE file. If LIST is reset, the state of the LISTINCL option has no effect. LISTINCL
may be set and reset as desired within the source input.

LISTINITIALCCI (Reset)
The LISTINITIALCCI option causes the contents of the INITIALCCI file to appear in the
heading of the compiler listing, if generated. This option may appear in the INITIALCCI
file or on any compiler control image before the first input source statement of the
program.

LONG (Reset)
The LONG option alters array storage handling. Normally, arrays requiring more than
1024 words of storage are segmented into 256-word pages for overlay purposes.
Arrays or COMMON blocks that are declared after the LONG option is SET are not
segmented regardless of their storage requirements, unless their length in word units
exceeds either 4096, or the value of n provided in the LONGLIMIT compiler control
option.

LONGLIMIT (4096)
The LONGLIMIT control option is shown as

LONGLIMIT [=] n

where n is an unsigned integer constant and 256 <= n <= 65536. When choosing a
value for n, it should be considered that access to an element of a LONG array is more
efficient than access to an element of a segmented array. However, a large value for n
may result in the need for the allocation of an equally large portion of memory at a
given instant.

The value of n may be altered by successive value assignments to LONGLIMIT, but the
LONGLIMIT compiler option may only appear before the first FORTRAN statement.
The default value for n is 4096.

It must be noted that n is interpreted to be in word units. Therefore, a DOUBLE


PRECISION array of 5000 elements is only declared LONG if the LONGLIMIT is at least
10000, since two words of storage are required for each element of a DOUBLE
PRECISION array. The LONG compiler option may be SET and RESET at any time by the
user.

3957 6053003 1731


Compiler Control Options

Arrays declared internally by the compiler are also affected by the use of the
LONGLIMIT and LONG compiler control options. Temporary arrays are declared LONG
regardless of the state of the LONG option, but only if their length does not exceed
the current LONGLIMIT at the time that they are declared. COMMON blocks and
EQUIVALENCE statements comprising arrays are also declared LONG, if and only if
they contain an array that is declared while the LONG option is SET and if the length of
the COMMON or EQUIVALENCE arrays does not exceed the current LONGLIMIT at the
time they are declared.

MAKEHOST (Reset)
The MAKEHOST option instructs the compiler to collect and save certain information
during the current compilation in order to facilitate a separate compilation at a later
time. Refer to the SEPCOMP option for more information.

The MAKEHOST option will be deimplemented in a future release.

MAP (Reset)
The MAP option increases the amount of compilation information contained on the
listing. When MAP is set, the listing contains the address couples of items named in
the program being compiled. The displacement portion of the address couple is in
hexadecimal notation. LIST must be set to produce the listing. The old FORTRAN
option, STACK, is accepted as a synonym for MAP regardless of the state of the
CONVERT option.

MERGE (Reset)
 MERGE 
 
 (  <source filename>  ) 

The MERGE option allows the compiler to accept source input from more than one
file. When the MERGE option is set, the compiler accepts source input from the file
CARD. The primary input (from file CARD) is merged with the secondary input (from
file SOURCE) on the basis of sequence numbers to produce the total source input to
the compiler. If matching sequence numbers occur on records from these two files,
the primary input record overrides the secondary input record. When a primary control
card image containing only a dollar sign is encountered, the secondary record with the
same sequence number is ignored. When MERGE is reset, only primary input is
accepted by the compiler.

1732 3957 6053003


Compiler Control Options

NEW (Reset)
 NEW 
 
 (  <NEWSOURCE filename>  ) 

The NEW option causes the updated symbolic output file NEWSOURCE to be
generated. When the NEW option is set, the source input from the CARD and, if
MERGE is set, SOURCE files are placed in the file NEWSOURCE. Text inserted into the
source input by the INCLUDE option is placed in the NEWSOURCE file only if the
INCLNEW option is also set. All CCIs in the source input whose dollar sign appears in
column 2 or that have a dollar sign ($) in both columns 1 and 2 are placed on the
NEWSOURCE file when NEW is set.

The NEW option may be set and reset as desired throughout the source input.

The NEWSOURCE file is created despite the occurrence of syntax errors in the source
input.

If the NEW option and the FREE or FREESOURCE options are set concurrently, the
compiler appropriately edits the output of the NEWSOURCE file to ensure that the
updated symbolic is acceptable as either free- or fixed-form input.

NEWSEQERR (Reset)
The NEWSEQERR option allows sequence number error checking to be performed on
the updated symbolic output file as the file is generated. When the NEW and
NEWSEQERR options are set, the updated symbolic file NEWSOURCE is generated
and the sequence numbers on the card images in this file are checked for errors. A
sequence error condition exists when a sequence number on a record is less than or
equal to the sequence number on the preceding record. When such a sequence error
is detected, an error is reported, and the NEWSOURCE file is not saved.

OMIT (Reset)
When the OMIT option is set, records from both CARD and SOURCE files are ignored
by the compiler. They are, however, listed and included in an updated symbolic file.
On a listing the omitted statements are flagged by the word OMIT. See also the VOID
option.

OMITDEBUG (Reset)
When the OMITDEBUG option is set, code generation for DEBUG statements is
inhibited. When code generation is inhibited, specifying DEBUG for the task attribute
OPTION has no effect. With this option, the DEBUG statements may become a
permanent part of a symbolic program: included while the program is being checked
out, and excluded while the program is in production form.

3957 6053003 1733


Compiler Control Options

ONLYANSIINTRINSICS (Reset)
All ClearPath Enterprise Server extensions to the list of ANSI standard FORTRAN77
intrinsics are recognized when ONLYANSIINTRINSICS option is reset. If this option is
set, any reference to a ClearPath Enterprise Server intrinsic is treated as an EXTERNAL
SUBROUTINE or FUNCTION reference. In other words, it is treated as though the
intrinsic name appeared in an EXTERNAL statement in that subprogram. The following
intrinsics are affected:

ADJUSTL CHARS EQUIV LOWERC


ADJUSTR COMPL ERF LOWERCASE
ALGAMA CONCAT E RFC MOVE
AND CONTAN EXIT MVBITS
ARCOS CTIME FILL NOT
ARSIN DARCOS GAMMA OR
ASCII DARSIN HFIX OVERFL
ATANH DATE IAND RANDOM
BCLR DCMPLX IBCLR SHFT
BI TS DCONJG IBITS SHFTC
BSET DERF IBSET SKIP
BTEST DERF C IEOR TIME
CDABS DLGAMA IOR TRIM
CDCOS DFLOAT ISHFT TRMLENC
DEXP DGAMMA ISHFTC UPPERC
CDLOG DVCHK ISOL UPPERCASE
CDSIN EBCDIC LEN_TRIM VALUE
CDSQRT EOR LGAMA

If the ONLYANSIINTRINSICS option is set, any of these intrinsics may be used by


placing its name in an INTRINSIC statement in the program unit where it is referenced.

The ONLYANSIINTRINSICS option may be altered at any time; however, only its status
(set or reset) at the time the first statement of a program unit is encountered is
applicable within that program unit.

This option may be used both as an aid in insuring that a program conforms to the
ANSI standard and as a method of using a non-ANSI intrinsic name as a subprogram
name. The latter method is easier than including an EXTERNAL statement in every
program unit that references the subprogram, provided that the non-ANSI intrinsics
are not used.

1734 3957 6053003


Compiler Control Options

OPTIMIZE (Reset)
The OPTIMIZE option is used to control optimization. The format is as follows:

 OPTIMIZE 


 
   
   
 (  <optimize argument list>  ) 
 
 SET 
 
 RESET 
<optimize argument list>


 
 ALL 
 
 LOOPS 
 
 DIVIDE 
 
 SEGMENT 
 
 EXPRORDER 
 
 VECTOR 
 
 BLAS 
 
 NOALIAS 

When OPTIMIZE is set, the optimizations performed depend upon the state of the
arguments. When OPTIMIZE is reset, no optimization is done regardless of the state of
any arguments. The initial state of all arguments is set. The default state for the
OPTIMIZE option itself is reset. If OPTIMIZE appears without an argument list, only the
OPTIMIZE option itself is affected; the state of all of the arguments is unchanged. If an
argument list appears, only those arguments specified are affected. The state of an
argument named in an argument list is set, unless reset has been specified.

Example:
$SET OPTIMIZE ( LOOPS RESET DIVIDE )

OPTIMIZE is SET, LOOPS is SET, DIVIDE is RESET, and the state of all other arguments
remains unchanged.

Setting the argument ALL causes all of the arguments to be set. Resetting the
argument ALL causes all of the arguments to be reset.

3957 6053003 1735


Compiler Control Options

When the argument LOOPS is set, the compiler examines DO loops and attempts to
perform various optimizations on the loops. Optimization is attempted if both the
OPTIMIZE option and the LOOPS argument are set at the time the DO statement is
seen. Resetting either OPTIMIZE or LOOPS within a loop does not affect the
optimization of that loop, only of subsequent loops.

Optimizations performed include moving invariant expressions outside the loop,


strength reduction, recognizing common subexpressions, and whole array
assignments.

Simple variables contained in COMMON or those that are SAVE when HEAP is SET
require indexing code to obtain their value or to store a new value into them. The
optimizer replaces occurrences of these simple variable with a true machine simple
variable, that is a stack cell, within the loop. The true machine simple variable is
initialized with the value of the user's simple variable prior to the loop and if it is
changed within the loop, the resulting value is stored into the user's simple variable
after execution of the loop has been completed. If a variable that is explicitly
equivalenced is changed within the loop, then that variable is not subject to this
optimization.

A use of a variable that does not conform to the ANSI standard may cause
unpredictable results, for example the variable has aliases through passing the same
actual argument to two formal arguments of the same subprogram.

If a whole array or a contiguous portion thereof is being assigned a loop constant


value or a contiguous portion of another array, the assignment may be optimized by
being performed all at once. The array being assigned to may not be used elsewhere
in the loop.

For example, the DO loops,

DO 10 I=1,100 and DO 20 I=1,100


A(I) = 1.0 A(I) = B(I)
10 CONTINUE 20 CONTINUE

are optimized.

If, as in the preceding examples, no statements remain in the loop when the
assignment is optimized, the loop variable is set to its final value and no other loop
code is necessary. Note that a check for a zero trip count is always performed.

DO loops that do not conform to the ANSI standard either are not optimized or
produce unpredictable results. Optimization of loops containing calls on user- supplied
subroutines or functions may be limited because all arguments and all items in
COMMON or equivalenced to COMMON are considered loop variant. DO loops that
contain GO TOs, IFs, or I/O statements are not considered for optimization.

1736 3957 6053003


Compiler Control Options

If it can be determined at compile time that a short DO loop will execute no more than
three times, the loop can be unrolled for quicker execution if the following conditions
apply:

1. The loop contains no subroutine calls, function references, or inner loops.


2. The loop contains no labels, except a label on the final statement.
3. The loop body contains no more than five statements (not counting a final
CONTINUE statement).
When DIVIDE and LOOPS are set, a division by a loop constant divisor is replaced by a
multiply of the divisor's reciprocal. The result of a reciprocal multiply is mathematically
equivalent to the divide, but there may be a slight significance difference. The
reciprocal is calculated outside of the loop and the value saved for use inside the loop.
Note that for this optimization to occur, both LOOPS and DIVIDE must be set when the
DO statement of the loop is seen.

DIVIDE can also effect vectorization. For more information on vectorization, refer to
Section 19.

When LOOPS is set, the user might get unexpected results with affected loops when
running TADS.

The SEGMENT argument is used to control code file segmentation. When SEGMENT is
set, the compiler groups together code from adjacent subroutines into a code
segment. When the end of a code segment is reached, a new segment is started. If
the location of the break causes much branching between code segments, a
performance degradation may be noticed. This may be corrected by resetting
SEGMENT before the beginning of the subroutine or function in which the segment
break occurs. Resetting SEGMENT causes a new code segment to be started at the
beginning of each new procedure or until SEGMENT is set. Grouping code into fewer
code segments results in fewer initial presence bit interrupts, improving performance.
SEGMENT may be set or reset at any time, but it does not take effect until the
beginning of the next procedure.

The EXPORDER argument is used to control the order in which expressions are
evaluated at run time. When either OPTIMIZE or EXPORDER is reset, expressions are
strictly evaluated from left to right. When both OPTIMIZE and EXPORDER are set, an
attempt is made to minimize the number of stack cells required to evaluate the
expression. For example, the expression

B + C *D

is evaluated as though the compiler was evaluating the expression

C * D + B

Note that use of this option with expressions that do not conform to the ANSI
standard can cause unpredictable results, that is if the expression contains a function
reference that alters the value of another entity in the expression.

3957 6053003 1737


Compiler Control Options

The VECTOR argument is used to request the vectorization of DO loops. Note that
vectorization is only done if OPTIMIZE is set, the VECTOR argument is set at the time
the DO statement is encountered, the EXPORDER argument is set for the statement
to be vectorized, and all systems indicated by the TARGET option, or its default value,
support these features.

The NOALIAS argument is used to request that potential aliasing of formal arguments,
items in common, and equivalenced items is to be ignored by the compiler when
vectorizing.

The BLAS argument is used to request vector operators to be emitted in place of


references to the BLAS (Basic Linear Algebra Subprograms). Note that vector
operators are not supported on all systems and that this option only takes effect if all
systems indicated by the TARGET option, or its default value, support these operators.
See this section for more information on the TARGET compiler control option.

OS_ 1100 (Reset)


OS_1100 is a predefined Boolean option and its state cannot be changed. It is intended
for use by Unisys only.

OWN (Reset)
The OWN option affects variables and arrays that are not formal arguments and are
declared or first appear when the OWN option is set. These variables and arrays retain
their values between subroutine calls, just as if they had been included in a SAVE
statement.

OWNARRAYS (Reset)
When the OWNARRAYS option is set, all arrays and character variables (and only
arrays and character variables, unless the OWN option is also set) are treated as if
they had been declared with OWN set. If array reinitialization is not required, a
program can be run faster with OWNARRAYS set. Setting the compiler option
OWNARRAYS causes temporary arrays that are created by the compiler to be moved
to the static global environment. This saves presence bit action when used repeatedly
by a subprogram.

PAGE (No Associated States)


The PAGE option allows the user to control in part the format of the output listing.
The appearance of the PAGE option within the source input causes a skip to the top of
the next physical page. The output listing then continues, beginning with the CCI that
contained PAGE.

1738 3957 6053003


Compiler Control Options

SEPARATE (Reset)
Setting SEPARATE indicates to the compiler that all program units are to be compiled
separately. SEPARATE produces separate code files for each program, subroutine,
function, or block data subprogram, unless LIBRARY is set. These code files may be
bound to a host file via the program BINDER. Refer to the ClearPath Enterprise
Servers BINDER Programming Reference Manual for more information.

If SEPARATE is set, BINDINFO is set automatically. If the compilation is initiated


through CANDE, LIBRARY is also set automatically. When SEPARATE is set and
LIBRARY is reset, the code file generated for each program unit has a title constructed
from the object program name--usually, the name contained on the COMPILE control
card of the WFL deck initiating the compilation. The title of each subprogram code file
or named main program code file consists of the object program name with the
lowest-level (right-most) identifier in the name replaced by the subprogram name.
Note that if the subprogram name is longer than 17 characters, only the first 17
characters are used. If the object program name on the COMPILE card consists of only
one identifier, then the title of the subprogram code file is the subprogram name. The
title of an unnamed main program's code file is identical to the program name on the
COMPILE card.

The state of the SEPARATE option cannot be changed after the first source statement
is processed. Also, it is not possible to SEPCOMP a program for which SEPARATE has
been set. If MAKEHOST, SEPCOMP, or FULLSEPCOMP is used together with
SEPARATE, a warning is issued stating that the sepcomping option is not permitted
and has been ignored.

Any program unit in a compilation deck may be preceded by file declarations. If


SEPARATE is set, then, at compilation time, a given file declaration applies to all
subsequent program units in the source deck. At execution time, for a given file
designator, the file declaration in the host program (if such a declaration exists) is
considered the valid one. If the declaration is not present in the host, then the first file
declaration bound to the host has precedence.

A syntax error is issued if SEPARATE is set and a global (COMMON) variable or array
or an OWN variable or array appears as an element of a NAMELIST list in a
subprogram.

When SEPARATE is set, a program unit may use DATA statements with common
block entities only when both of the following conditions are met:

1. The program unit is a main program or block data subprogram.


2. The compiler control option CODEFILEINIT is not set.
It is not possible to bind subprograms that have the compiler control option
STATISTICS or TADS set. If SEPARATE is used with STATISTICS or TADS, a warning is
generated and the STATISTICS or TADS option is ignored. Also, neither XREF nor
XREFFILES may be set when SEPARATE is set.

3957 6053003 1739


Compiler Control Options

SEPCOMP (Reset)
The purpose of the separate compilation facility (the use of which is referred to as
"sepcomping") is to save time when recompiling programs. Sepcomping allows any file
statement or program unit (referred to as environments) to be deleted, changed, or
added during a successive compilation. Only those affected environments are
recompiled and linked. Three CCOs are provided for sepcomping: MAKEHOST,
SEPCOMP, and FULLSEPCOMP.

The SEPCOMP option will be deimplemented in a future release.

MAKEHOST
 MAKEHOST 

Sepcomping can be done only to a program that has been compiled with MAKEHOST
set. MAKEHOST instructs the compiler to collect and save certain information during
the current compilation in order to facilitate a separate compilation at a later time.
When the MAKEHOST compiler control option is SET, the information that the
compiler saves in order to perform subsequent separate compilations reflects the
structure of the NEWSOURCE file when the option NEW is SET and the CARD file (or
patched SOURCE file when performing a separate compilation) when NEW is RESET.
A user can compile a program with INCLUDE options, set NEW, and perform a
separate compilation against the NEWSOURCE that is produced. MAKEHOST may be
set only before the first FORTRAN77 source image of a full compile. It cannot be set
or reset after the initial setting and cannot be equated to another option. The file for
which MAKEHOST is being requested must be a sequenced file. The default state for
MAKEHOST is set when sepcomping is taking place; otherwise, MAKEHOST is reset.

SEPCOMP
 SEPCOMP 
 
 (  <HOST filename>  ) 

This option informs the compiler that a separate compilation is requested. It must
appear before any FORTRAN77 source images in the primary (CARD) file. SEPCOMP
cannot be set or reset after the initial setting or be equated to another option. When
SEPCOMP is requested, the compiler automatically sets the MAKEHOST option,
thereby allowing repeated sepcomping. The default state for SEPCOMP is reset.

1740 3957 6053003


Compiler Control Options

FULLSEPCOMP
 FULLSEPCOMP 
 
 (  <HOST filename>  ) 

The only difference between this option and SEPCOMP is that the entire secondary
(SOURCE) file is read during sepcomp. All CCIs are processed. However, as with
SEPCOMP only selected portions of the program are recompiled. This option may be
used to obtain a complete NEWSOURCE file and listing during sepcomp. SEPCOMP
causes only those portions of the secondary input file that are being recompiled to be
read. If FULLSEPCOMP is used and the LIST option is set, any input that is read, but not
compiled, is marked by the letter "O" in column 114 in the program listing.

User Interface
A request for a separate compilation causes the compiler to distinguish between a
primary input file (CARD) and a secondary input file (SOURCE). The SOURCE input file
is the file originally compiled with MAKEHOST set. The CARD input file is currently
being compiled and has SEPCOMP or FULLSEPCOMP set. During sepcomp, the
primary input file contains patch input images to be applied against the secondary
input file.

The compiler views the secondary input file as being composed of environments. The
information that the compiler retains about each environment is the span of sequence
numbers it encompasses. Based on the sequence number of the input from the
primary input file, the compiler can determine within which environment, if any, the
input record resides. It can then continue compiling from the point where the
environment begins in the secondary input file, merging the input from the primary
input file. Input from the primary input file that does not open any environment causes
the compiler to read and compile the input in the primary input file until an
environment opens up. This latter case is the mechanism by which new environments
program units are added.

Compiler Files
CARD
The CARD file, as in a normal compilation, is the primary input file. During sepcomp, it
contains the FORTRAN77 symbolic images that are applied against the SOURCE file to
create a new executable program. The CARD file may be label-equated to the
compiler file CARD, or the default file named CARD may be used. Note that, just as
with MERGE, a CARD file can be created for use with SEPCOMP by making a patch
against the SOURCE file through SYSTEM/EDITOR.

3957 6053003 1741


Compiler Control Options

SOURCE
The SOURCE file is the FORTRAN77 symbolic file that corresponds to the HOST file.
This file may be label-equated to the compiler file SOURCE, or the default file named
SOURCE may be used. During SEPCOMP, the SOURCE file provides the compiler with
the FORTRAN77 symbolic against which the patches specified in the CARD file are
applied; it is the user's responsibility to ensure that the SOURCE and CARD files are
compatible.

HOST
The HOST file is the code file associated with the FORTRAN77 symbolic file (SOURCE).
It may be label-equated, optionally specified immediately following SEPCOMP or
FULLSEPCOMP on the CCI, or the default compiler file HOST may be used. Specifying
with the option takes precedence over the label- equation form. The HOST file is used
to provide environment information concerning the SOURCE file, as well as the source
of all object code that is not recompiled during sepcomp. It is, therefore, extremely
important that the user guarantee the compatibility of the SOURCE and HOST files.

NEWSOURCE
If the NEW option is set, the compiler file NEWSOURCE is generated. For the
SEPCOMP option, this file contains the merged (CARD and SOURCE) input that was
recompiled or added during the current separate compilation. Note that this file does
not necessarily include all of the original symbol, but only those environments that
were recompiled or added. To get a complete file, FULLSEPCOMP should be used.

NEWXREFFILE
If XREF or XREFFILES is set along with MAKEHOST, the compiler file NEWXREFFILE is
generated. This file contains necessary information to keep cross reference
information current and is used in the next separate compilation to obtain an
up-to-date cross reference listing or cross reference files.

XREFFILE
If XREF or XREFFILES is set during a separate compilation, and the file XREFFILE is
present, the compiler checks to ensure that the HOST file and the XREFFILE file
correspond to one another. If they do not, a warning message is produced: all cross
reference information produced, as well as the contents of NEWXREFFILE, reflect only
those environments that are recompiled. If the files do correspond, complete cross
reference information is produced and maintained in NEWXREFFILE, which may be
used as XREFFILE in a subsequent sepcomp.

Sepcomping Examples
The following examples help demonstrate the use of the separate compilation facility.
In each case the first program is compiled with MAKEHOST set allowing for
subsequent sepcomping.

1742 3957 6053003


Compiler Control Options

1000 $ MAKEHOST FREE


1100 FILE 1(KIND="DISK")
1200 FILE 2(KIND="DISK")
1300 C- DURING THE SEPCOMP A DECLARATION FOR
1400 C- UNIT 3 IS ADDED HERE.
1500
2000 C- DURING THE SEPCOMP A BLOCKGLOBALS
2100 C- IS ADDED HERE WHICH CONTAINS A DECLARATION
2200 C- FOR LIBRARY L.
2300
3000 C- DURING THE SEPCOMP THE MAIN PROGRAM IS
3100 C- MOVED HERE AND RENAMED.
3000
4000 SUBROUTINE ONE (A, B)
4100 C- DURING THE SEPCOMP THIS SUBROUTINE
4200 C- CHANGES TO A FUNCTION.
4300 DIMENSION A(1)
4400 REAL B
4500 PRINT *,A,B
4600 END
4700
5000 SUBROUTINE TWO (C, D)
5010 DIMENSION ARY (4)
5020 C- SUBROUTINE THREE TAKES TWO ARGUMENTS. THE
5030 C- FIRST IS AN ARRAY AND THE SECOND IS A
5040 C- VARIABLE. THE FOLLOWING REFERENCE TO THREE
5050 C- TREATS THE FIRST ARGUMENT AS A SUBARRAY
5060 C- AND THE SECOND AS AN ELEMENT OF THE ARRAY.
5070 C- DURING THE SEPCOMP THE TYPES OF THE
5080 C- ARGUMENTS TO THREE CHANGE. THE FIRST
5090 C- ARGUMENT BECOMES A VARIABLE AND THE SECOND
5100 C- AN ARRAY. THE FOLLOWING REFERENCE REMAINS
5110 C- VALID AND SUBROUTINE TWO NEED NOT BE
5120 C- RECOMPILED.
5130 CALL THREE (ARY (2), ARY (2))
5140 C- FOUR IS ADDED DURING THE SEPCOMP.
5150 CALL FOUR (ARY (1))
5160 END
5170
6000 SUBROUTINE THREE (A, B)
6100 C- DURING THE SEPCOMP, THREE IS DECLARED TO BE
6200 C- IMPORTED FROM LIBRARY L.
6300 DIMENSION A(2)
6400 END
6500
7000 C- SUBROUTINE FOUR IS ADDED HERE DURING THE SEPCOMP.
7100
8000 PROGRAM MAIN
8010 C- DURING THE SEPCOMP, PROGRAM MAIN

3957 6053003 1743


Compiler Control Options

8020 C- IS MOVED BEFORE SUBROUTINE ONE AND RENAMED


8030 C- START. THE COMMON BLOCK L IS RENAMED MAIN.
8040 C- A BLOCKGLOBALS IS ALSO ADDED IN WHICH A
8050 C- LIBRARY L IS DECLARED.
8060 COMMON /L/ A (4), B
8070 C- THE FOLLOWING REFERENCE MUST BE CHANGED SINCE
8080 C- ONE IS CHANGED TO A FUNCTION BY THE SEPCOMP.
8090 CALL ONE (A (2), B)
8100 END

The contents of the CARD file for the FULLSEPCOMP are as follows:

The SOURCE file is label equated to the program that was originally compiled.
The HOST file is label equated to the object file from the program that was
originally compiled.
The NEW option is set, producing a NEWSOURCE file. A listing of that file follows
this CARD file.
The FREESOURCE option is set.
The CARD file from the MAKEHOST is now the SOURCE file to which FREESOURCE
applies. Since it is in free format, FREESOURCE must be used.

0 $ FULLSEPCOMP NEW FREESOURCE


1300 FILE 3(KIND="REMOTE")
1400 $
2000 BLOCKGLOBALS
2100 LIBRARY L
2200 END
3000 PROGRAM START
3010 COMMON /MAIN/ A(4), B
3020 R = ONE (A (2), B)
3030 END
3100 $
4000 FUNCTION ONE (A, B)
4100 $ SET DELETE
4200 $ POP DELETE
6100 $ SET DELETE
6200 $ POP DELETE
6310 INLIBRARY L
7000 SUBROUTINE FOUR (A)
7100 END
8000 $ SET DELETE
8100 $ POP DELETE

The following is a listing of the NEWSOURCE file from the FULLSEPCOMP. This file
may be used as the SOURCE file in a subsequent separate compilation; the object file
produced would be its corresponding HOST file.

1744 3957 6053003


Compiler Control Options

1100 FILE 1(KIND="DISK")


1200 FILE 2(KIND="DISK")
1300 FILE 3(KIND="REMOTE")
1500
2000 BLOCKGLOBALS
2100 LIBRARY L
2200 END
2300
3000 PROGRAM START
3010 COMMON /MAIN/ A(4), B
3020 R = ONE (A (2), B)
3030 END
3200
4000 FUNCTION ONE (A, B)
4300 DIMENSION A(1)
4400 REAL B
4500 PRINT *,A,B
4600 END
4700
5000 SUBROUTINE TWO (C, D)
5010 DIMENSION ARY (4)
5020 C- SUBROUTINE THREE TAKES TWO ARGUMENTS. THE
5030 C- FIRST IS AN ARRAY AND THE SECOND IS A
5040 C- VARIABLE. THE FOLLOWING REFERENCE TO THREE
5050 C- TREATS THE FIRST ARGUMENT AS A SUBARRAY
5060 C- AND THE SECOND AS AN ELEMENT OF THE ARRAY.
5070 C- DURING THE SEPCOMP THE TYPES OF THE
5080 C- ARGUMENTS TO THREE CHANGE. THE FIRST
5090 C- ARGUMENT BECOMES A VARIABLE AND THE SECOND
5100 C- AN ARRAY. THE FOLLOWING REFERENCE REMAINS
5110 C- VALID AND SUBROUTINE TWO NEED NOT BE
5120 C- RECOMPILED.
5130 CALL THREE (ARY (2), ARY (2))
5140 C- FOUR IS ADDED DURING THE SEPCOMP.
5150 CALL FOUR (ARY (1))
5160 END
5170
6000 SUBROUTINE THREE (A, B)
6300 DIMENSION A(2)
6310 INLIBRARY L
6400 END
6500
7000 SUBROUTINE FOUR (A)
7100 END

3957 6053003 1745


Compiler Control Options

The following example helps demonstrate the use of the INCLUDE CCO and
sepcomping. The original program compiled with MAKEHOST set contains three
INCLUDEs. Since NEW is set for the entire compile, the information that the compiler
gathers in order to perform a subsequent separate compilation is based on the
structure of the NEWSOURCE file.

1000 $ SET MAKEHOST NEW


2000 $ INCLUDE "INCLUDE/1."
3000 $ INCLUDE "INCLUDE/2."
4000 $ SET INCLNEW
5000 $ INCLUDE "INCLUDE/3."

The following listing of the NEWSOURCE file is the SOURCE file for sepcomping. It is
the file that is compatible with the HOST file produced from the MAKEHOST compile.
Notice that it contains two INCLUDEs and the actual records from INCLUDE/3.
INCLNEW was set when INCLUDE/3 was read, but reset when INCLUDE/1 and
INCLUDE/2 were read.

2000 $ INCLUDE "INCLUDE/1."


3000 $ INCLUDE "INCLUDE/2."
5000 SUBROUTINE FOUR (A)
5100 COMMON /R/ E, F
5200 PRINT *, A, E, F
5300 END
5400
5500 PROGRAM MAIN
5600 CALL ONE (A, B)
5700 CALL FIVE
5800 END

The following is a list of INCLUDE/1.

1000 BLOCKGLOBALS
2000 LIBRARY L
3000 END
4000
5000 BLOCKDATA
6000 IMPLICIT CHARACTER (C)
7000 COMMON /R/ A, B, D(10), E, F
8000 COMMON /C/ C1, C2, C3(10)
9000 DATA D /10*1/
10000 DATA C3 /10*"X"/
11000 END

The following is a list of INCLUDE/2.

1000 SUBROUTINE ONE (A, B)


2000 PRINT *, A, B
3000 END
4000

1746 3957 6053003


Compiler Control Options

5000 SUBROUTINE TWO


6000 INLIBRARY L
7000 END
8000
9000 REAL FUNCTION THREE (A)
10000 INLIBRARY L
11000 END

The following is a list of INCLUDE/3.

5000 SUBROUTINE FOUR (A)


5100 COMMON /R/ E, F
5200 PRINT *, A, E, F
5300 END
5400
5500 PROGRAM MAIN
5600 CALL ONE (A, B)
5700 CALL FIVE
5800 END

The following is a listing of the CARD file for the SEPCOMP. Note, as a result of
sepcomping ONE, TWO, THREE, and MAIN are recompiled.

0 $ SEPCOMP
3000 $ INCLUDE "INCLUDE/2/NEW."
5600 CALL ONE (A)

The following is a list of INCLUDE/2/NEW.

1000 SUBROUTINE ONE (A)


2000 PRINT *, A
3000 END
4000
5000 SUBROUTINE TWO
6000 INLIBRARY L
7000 END
8000
9000 REAL FUNCTION THREE (A)
10000 INLIBRARY L
11000 END

Other Features of Separate Compilation


1. During a separate compilation, the class of a global item can change. For example,
suppose on a previous compile "L" was declared to be a library. During a separate
compilation, "L" can become a function as long as during the compile or some
previous compile the declaration for "L" as a library and all the references to "L" as
a library have been removed. The same is true for an identifier that is a subroutine,
function, common block, external, block data subprogram, or main program.

3957 6053003 1747


Compiler Control Options

2. The type of a function can change during a separate compilation, as well as the
kind of elements in a common block (character versus noncharacter).
3. A program can become a library or vice versa during a separate compilation.
4. The type and number of arguments to a function or subroutine can change during
a separate compilation.
5. A program unit header can be moved to a location at a lesser sequence number
even if its declaration is not deleted on a previous separate compilation.
6. When doing a separate compilation, the HOST file is copied to the CODE file. If
there are syntax errors, the copying is superfluous. The copying of the HOST file is
delayed until it is known that the compile is free of errors. This delay saves
processor time in separate compilations in which there are syntax errors.
7. LINEINFO information is kept current during separate compilations.
8. It is not necessary to touch an environment in order to delete it. Any environments
in the SOURCE file that are not modified, but fall in a range where the DELETE CCO
is set, are deleted.
Example:
10 PROGRAM MAIN from SOURCE file
20 CALL ONE from SOURCE file
30 END from SOURCE file
40 $ SET DELETE from CARD file
50 SUBROUTINE ONE from SOURCE file
60 RETURN from SOURCE file
70 END from SOURCE file
80 $ POP DELETE from CARD file
90 SUBROUTINE ONE from CARD file
100 RETURN from CARD file
110 END from CARD file

In this example, the first declaration of subroutine ONE is deleted by the $DELETE
records.
9. It is no longer necessary for a program to contain a PROGRAM unit (main
program). The PROGRAM unit can be added during a separate compilation.
10. A program unit, which at one time had statistics gathered for it, can cease to have
statistics gathered. This is done by deleting the program unit through a sepcomp,
or by sepcomping in compiler control options.
11. Cross reference information is kept current during a separate compilation. When
the option MAKEHOST is set, and either the option XREF or XREFFILES is set, the
file XREFFILE is produced by the compilation. This file contains the necessary
information to keep cross reference information current during a subsequent
separate compilation. During a sepcomp, the file should be known as XREFFILE.

1748 3957 6053003


Compiler Control Options

Restrictions
1. The size of the common block is never reduced. If the overall size of a common
block is reduced during a separate compilation, the array allocated for the
common block is not.
2. One side effect caused by CODEFILEINIT in separate compilations is that
COMMON storage always retains the values from previous compilations. To zero
out a once-initialized area, specifically zero it out in the separate compilation patch.
3. A unit that exists for a program continues to exist for the program even if the FILE
declaration for the unit and all references to the unit have been deleted during a
separate compilation.
4. A FILE declaration for a unit cannot be relocated to a lesser sequence number
unless the FILE declaration was deleted on a previous separate compilation.
5. All symbolic file images must contain sequence field information consisting solely
of numeric data that is ascending and unique. Input from an INCLUDE file must
also be ascending and unique when the options NEW and INCLNEW are both set.
6. CCOs must be set explicitly. While sepcomping, a compiler control image must be
read for the CCOs that it contains in order to have an effect. The following are
exceptions:
a. The value of the SHARING option is retained for subsequent separate
compilations.
b. The value of the statistics output unit and time value for the STATISTICS
option are retained for subsequent separate compilations.
c. The value associated with LONGLIMIT is retained for subsequent separate
compilations. If while sepcomping the LONGLIMIT changes, all arrays at D2 are
made either segmented or long, based on the new value.
d. The value of CODEFILEINIT from the original MAKEHOST is retained. Any
reference to CODEFILEINIT in a separate compilation is ignored.
e. The value of BINDINFO from the original MAKEHOST is retained.
7. Some potential problems arise with the use of CCOs. No restrictions have been
placed on their usage; however, under certain circumstances they do not behave
the same as during a full compile. If these options are used across unit file
boundaries, they could cause the appearance of the NEWSOURCE to differ from
the actual information that the compiler saves for future sepcomping. For
example, with FULLSEPCOMP and SEQ, procedures could be resequenced in the
NEWSOURCE that were not actually recompiled. The information retained in the
CODE file about the sequence numbers for these procedures would be
inconsistent with the NEWSOURCE. As long as CCOs are in effect only within the
boundaries of a compiled environment, they behave correctly. DELETE is an
exception as noted in the other features section.
8. It is not possible to set MAKEHOST, SEPCOMP, or FULLSEPCOMP for a program
that has SEPARATE or LIBRARY set. A warning is issued stating that the option
may not be used.

3957 6053003 1749


Compiler Control Options

Delays in Error Reporting


Because sepcomping can radically change a given environment, certain errors having
to do with global references are delayed. These delays occur whether or not
MAKEHOST is set for the compilation. While compiling a program unit, the compiler
ensures that global references are consistent within that program unit. Violations
within a program unit generate syntax errors immediately; however, inconsistencies
between a global reference and the actual declaration for a global do not generate
syntax errors until the last program unit is compiled. The following example illustrates
the type of syntax errors that are now delayed.

100 SUBROUTINE ONE(D)


110 DOUBLE PRECISION D
120 CALL THREE (R)
130 END
140
150 SUBROUTINE TWO ()
160 CALL ONE(R)
170 CALL ONE(S)
180 END
190
200 PROGRAM MAIN
210 CALL THREE(R1,R2)
220 END

** ERROR; SUBROUTINE ONE AT 100 HAS BEEN INCORRECTLY


REFERENCED BY PROGRAM UNIT TWO AT 150: ARGUMENT #1
FOR SUBROUTINE ONE RESTRICTED TO TYPE DOUBLE

While compiling subroutine TWO, the compiler found that all of the global references
made were consistent within that program unit. ONE was treated as a subroutine that
took one argument, a variable of type real. After the last program unit is compiled, the
compiler checks that the view which each program unit has of a global is consistent
with the actual declaration for that global. The error message indicates that an
inconsistency was discovered. Messages that are produced as the result of an
inconsistency between a global reference and a declaration consist of two parts. The
first part indicates the name of the global declaration and the sequence number on
which it occurs (ONE AT 100), as well as the program unit that contains the
inconsistent reference or references (TWO AT 150). The next part of the message
describes the nature of the inconsistency.

Even though the reference to THREE at 120 is inconsistent with the reference to
THREE at 210, no message is produced. An error is produced only when the
inconsistency is within a program unit, when an actual declaration exists, or when
BINDINFO is set. If a declaration for THREE was added during a separate compilation,
any remaining inconsistency would generate a syntax error.

1750 3957 6053003


Compiler Control Options

Sample Compiles
The following examples demonstrate separate compilations through WFL and CANDE.
In the first two examples, the HOST, SOURCE, and CARD files are being label-equated
to the desired files. The first example is a WFL job deck and the second example is a
CANDE compile (CANDE continuation character = %). The third example, which is also
a CANDE compile, uses the default file names.

BEGIN JOB SEPCOMP;


COMPILE NEWHOST WITH FORTRAN77 LIBRARY;
COMPILER FILE HOST = HOSTFILE;
COMPILER FILE SOURCE = SOURCEFILE;
COMPILER FILE CARD ( KIND=DISK, TITLE=CARDFILE );
?
END JOB

COMPILE CARDFILE WITH FORTRAN77; %


C FILE HOST = HOSTFILE; %
C FILE SOURCE = SOURCEFILE

COMPILE CARDFILE WITH FORTRAN77

SEQ (Reset)
 SEQ `
 
 <sequence base option> 

`
 
 +  <sequence increment option> 

<sequence base option>

 
 
 /8\  <digit> 

<sequence increment option

 
 
 /8\  <digit> 

When the SEQ option is set (the option, SEQUENCE, is accepted as a synonym for
SEQ), new sequence numbers are assigned to the records placed in the listing and the
NEWSOURCE file. This option has effect only when LIST or NEW are set. The new
sequence numbers are determined by the current values of the <sequence base
option> and the <sequence increment option>.

3957 6053003 1751


Compiler Control Options

When this option is reset, the sequence numbers that appear on the output records
are identical to the sequence numbers on the corresponding records in the input file.

The <sequence base option> contains the sequence number that is to be assigned to
the next source language record when the SEQ option is set. After each record is
sequenced, the value of the <sequence base option> is increased by the value of the
<sequence increment option> or by the default increment of 1000.

The value of the <sequence increment option> is used to increment the <sequence
base option> or the default base of 1000 when records are being sequenced because
the SEQ option is set.

SEQERR (Reset)
The SEQERR option, when set, performs sequence number error checking on the
source input files. A sequence error condition exists when a sequence number is less
than or equal to the sequence number on the preceding card image. When such a
sequence error is found, an error is reported.

SHARING (DONTCARE)
 SHARING  =  PRIVATE 
 
 SHAREDBYALL 
 
 DONTCARE 
 
 SHAREDBYRUNUNIT 

The SHARING option is used in a library to specify how user programs share the
library. If sharing is PRIVATE, a separate instance of the library is started for each
program that declares the library. If sharing is SHAREDBYALL, all simultaneous users
share the same instance of the library. If sharing is DONTCARE, sharing is determined
by the MCP. If sharing is SHAREDBYRUNUNIT, then there is one instance of the library
for each stack from which the library is invoked. During a separate compilation, the
value from the previous compile is used unless the value is explicitly changed.

1752 3957 6053003


Compiler Control Options

STATISTICS (Reset)
The STATISTICS option format is as follows:

 STATISTICS 


 
   
   
 (  ) 
   
 UNIT  <U>   SET 
   
 =   RESET 
 
 TIME 
 
 FREQ 
 
 PT 
 
 ET 
 
 IO 

The STATISTICS option may be used to measure the frequency of execution of a


program unit and the amount of time spent in that program unit. Either processor
time, IO time, or elapsed time can be measured. If statistics are taken for a program
with no statistics arguments specified, output is directed to the printer backup file for
the task. The report produced includes timings that measure processor time and
frequencies. Only one time value is measured for a specific program. The value that is
used is the last one that is encountered during compilation.

The STATISTICS option is examined before the first executable statement in a


program unit is processed and, if the option is set at that time, statistics are gathered
for that program unit. This option may be altered at any time; however, only its status
at the time the first executable statement is encountered is applicable. The
STATISTICS option cannot be used in conjunction with the TADS, SEPARATE,
LIBRARY, AUTOBIND, or BINDINFO options. If STATISTICS is set when the program
sets TADS, SEPARATE, LIBRARY, or AUTOBIND, the STATISTICS option is reset by the
compiler.

When the program is terminated for any reason (including both normal and abnormal
EOT), the statistics are output to the diagnostic file for the task, unless UNIT=<U> is
specified. UNIT = <U> is the external unit specifier that determines the destination for
output. However, when the diagnostic file is a printer file and the print limit is
exceeded, no statistics are printed.

The external unit specifier may be changed at any time; however, all output is directed
to the unit in effect when the first executable statement of the last compiled program
unit is encountered. If the job is terminated abnormally and the external unit is a
remote file, some of the statistics output may be lost.

3957 6053003 1753


Compiler Control Options

The remaining arguments to the STATISTICS option determine what is to be included


in the statistics report. The status of TIME indicates whether the amount of time spent
in a program unit is to be measured and the status of FREQ determines whether the
number of times a program unit is executed is to be counted. Either of these
arguments can be SET or RESET. The default is SET. Once SET or RESET is specified, it
remains in effect until another SET or RESET is encountered. SET and RESET do not
apply to IO, PT, and ET. These arguments indicate which time value is measured: IO for
input/output, PT for processor, and ET for elapsed time. The default is processor time.
The time value may be changed at any time; however, the time value in effect when
the first executable statement of the last compiled program unit is encountered is the
time value that is used in the report.

In the following example, statistics output would be directed to unit 6 and the time
value is IO. Both timings and frequencies are gathered for MAIN; however, only
frequencies are measured for SUB2. No statistics are gathered for SUB1.

$SET STATISTICS
PROGRAM MAIN
...
END
SUBROUTINE SUB1
$RESET STATISTICS(UNIT=6 RESET TIME ET)
...
END
SUBROUTINE SUB2
$SET STATISTICS (IO)
...
END

If MAKEHOST is set, the statistics output unit and the time value used are retained for
subsequent separate compilations. The separate compilation may respecify the output
unit or time value to be used.

Program execution time increases substantially when statistics are collected,


especially with timings. The time added to a relatively small block of code as the result
of taking statistics could represent a substantial portion of time spent in that block.

STRINGS = ASCII (Reset)


Specifying the STRINGS = ASCII option is exactly equivalent to setting the ASCII
option. See the description of ASCII in this section.

SUMMARY (Reset)
The SUMMARY option generates a minimal compilation listing. When the SUMMARY
option is set and the LIST option is reset, the listing contains only compilation
"heading" and "trailer" information such as the number of images scanned, number of
errors, compilation times, and so on. This trailer information is also generated when
LIST is set.

1754 3957 6053003


Compiler Control Options

TADS (Reset)
 TADS `

 
 
` (  /1\  FREQUENCY  ) 
 
 /1\  REMOTE = <n> 

The TADS option is used to compile a program for use with the Test And Debug
System (TADS). This option must occur before the first line of source. It cannot be
used in conjunction with the MAKEHOST, SEPCOMP, FULLSEPCOMP, SEPARATE,
LIBRARY, AUTOBIND, or BINDINFO options. If TADS is set when the program sets
SEPARATE, LIBRARY, AUTOBIND, or a sepcomping option, the TADS option is reset by
the compiler.

The TADS option can be followed by (FREQUENCY) or by (REMOTE <n>) or both. If


both options are specified, they must be contained in one set of parentheses.

The FREQUENCY option allows TADS to determine the frequency and coverage
statistics, as detailed in the ClearPath Enterprise Servers FORTRAN77 Test and
Debug (TADS) System Programming Reference Manual. The REMOTE <n> option
attaches an external remote file, numbered <n> for TADS output. Only one such file
may be specified, and <n> must have a value between 0 and 99 inclusive. If <n> is not
in this range, the compiler reports an error.

TADS has priority over other forms of debugging aids including $SET STATISTICS,
$SET TRACE, and DEBUG. If any of these is encountered after TADS is requested, they
are ignored and a warning message is printed informing the user that only TADS
information is being collected. If TADS is requested after STATISTICS or TRACE, TADS
is turned on and STATISTICS and TRACE are turned off (with the same warning
message). The one exception to this rule is that the warning message is printed only
for the first DEBUG statement. All others are ignored, but no message is given. For
more information about TADS, see the ClearPath Enterprise Servers FORTRAN77
Test and Debug (TADS) System Programming Reference Manual.

TARGET (Default is installation defined)


The TARGET option is used to generate code that is meant to be used on a specific
computer system or group of systems. The generated code file may be used on all
machines specified in the option. Therefore, all machines on which this code file is to
be run should be specified with the TARGET option.

The format of the option is the following:

3957 6053003 1755


Compiler Control Options

 TARGET  <=>  <primary identifier> `

`
 
   ,  
   
 (  <secondary identifier>  ) 

<primary identifier>

 <target identifier> 

<secondary identifier>

 <target identifier> 

<target identifier>

 THIS 


 
 ALL 
 
 A17 
 
 A16 
 
 A15 
 
 A12 
 
 A10 
 
 A9 
 
 A6 
 
 A5 
 
 A4 
 
 A3 
 
 A2 
 
 A1 
 
 MICROA 
 
 B7900 
 
 B7000 
 
 LEVEL4 
 
 LEVEL2 
 
 LEVEL1 
 
 LEVEL0 

1756 3957 6053003


Compiler Control Options

The generated code file is optimized for the machines represented by the <primary
identifier>, subject to the compatibility constraints of the machines represented by the
<secondary identifiers>; for example, the code file is optimized for the <primary
identifier>, but no operator is generated that is not supported by all of the <secondary
identifiers>.

If the <target identifier> is a machine, then the target receives the characteristics for
that machine. If the <target identifier> is a LEVEL, then the target receives the most
common characteristics of the machines in that LEVEL.

THIS is a synonym for the <target identifier> of the machine on which the code file is
being compiled.

ALL indicates that the code file must be able to run on all currently supported
machines. Note that the code generated when TARGET=ALL changes as older
machines are dropped and/or new ones are added.

LEVEL0 is presently a synonym for ALL. B7000 is a synonym for the <target identifier>
B7900. LEVEL1 and LEVEL2 encompass the following <target identifiers>: MICROA,
A1, A2, A3, A4, A5, A6, A9, A10, A12, A15, and A17. LEVEL4 encompasses the A16
<target identifier>. Unless you specify a secondary <target identifier> other than A16
or LEVEL4, code files compiled with a primary <target identifier> of either A16 or
LEVEL4 may not run on machines other than the A16.

The TARGET option must be specified prior to the first declaration or statement in the
program. It must be the first option on the card image on which it appears.

The default value for this option is installation defined. Refer to the ClearPath
Enterprise Servers System Command Programming Reference Manual for more
information on the COMPILERTARGET command.

3957 6053003 1757


Compiler Control Options

TRACE (Reset)
The TRACE option format is as follows:

 TRACE `

`
 
    
     
 (  ) 
   
 /1\  UNIT  <u>   SET 
     
 /1\  COMPARE   =   RESET 
 
 DUMP 
 
 IO 
 
 ALL 
 
 CALL 
 
 AUXIO 
 
 ASSIGN 
 
 BRANCH 
 
 CONTINUE 

The TRACE option may be used to obtain a trace of a program flow in which sequence
numbers and labels of specified statements are output in execution order. This option
is examined before the first executable statement in a program unit is processed. To
obtain any output from the TRACE option, the option must be SET and a unit and some
other arguments must be specified. This option may be altered at any time; however,
only its status (Set or Reset) at the time when the first executable statement of a
given program unit is encountered is applicable within that program unit.

If the COMPARE argument is used, then instead of producing a program flow, the
TRACE option provides the ability to compare the current trace with a previous
program trace in order to detect deviations. Program dumps may be requested should
a mismatch occur.

In the railroad diagram for TRACE, <U> is an external unit specifier. If COMPARE=<U>
does not appear, output from the trace is directed to the unit designated by
UNIT=<U>. If COMPARE=<U> appears, trace comparison occurs and trace output
does not take place; instead, a record is read from the unit designated by
COMPARE=<U> and compared to what would have been the record output from the
correct trace. If the records are the same, then no action is taken. If they are not
identical, a message is output to the unit designated by UNIT=<U>.

1758 3957 6053003


Compiler Control Options

The argument DUMP determines the action taken if COMPARE is selected and a
mismatch occurs. The remaining arguments determine which statements should be
selected for the current trace. All arguments are RESET by default. Any of the
arguments may be SET or RESET. Once SET or RESET is specified, it remains in effect
until another SET or RESET is encountered. The arguments have the following effect
when set:

1. DUMP indicates that a program dump should occur if a comparison fails.


2. IO indicates tracing is desired on all input/output statements.
3. ALL indicates tracing is desired on all executable statements, including program
unit entries and exits.
4. CALL indicates tracing is desired on all subroutine entries and exits (intrinsic calls
are not traced).
5. AUXIO indicates tracing is desired on all auxiliary input/output statements.
6. ASSIGN indicates tracing is desired on all assignment statements.
7. BRANCH indicates tracing is desired on all statements that cause branching.
8. CONTINUE indicates tracing is desired on all CONTINUE statements.
The options for TRACE remain in effect until explicitly reset. Tracing or comparing may
be changed from program unit to program unit. In the following example tracing is
switched from trace output to comparing and back to trace output. The subprogram
MAIN outputs tracing information to unit 6 whenever a CALL statement is executed.
No tracing takes place in SUB1, since TRACE is reset. Input for comparing comes from
unit 7 when SUB2 executes. Information about mismatches goes to unit 6. In SUB3,
trace output to unit 6 resumes, no comparing takes place.

$ SET TRACE (UNIT=6 SET CALL)


PROGRAM MAIN
...
END
SUBROUTINE SUB1
$ RESET TRACE
...
END
SUBROUTINE SUB2
$ SET TRACE (COMPARE=7)
...
END
SUBROUTINE SUB3
$ SET TRACE (UNIT=6)
...
END

3957 6053003 1759


Compiler Control Options

User Options (Reset)


A user option is a Boolean option with its name specified by the user. Its name is
subject to the restrictions of a FORTRAN77 variable name with two restrictions:

1. The underscore ( _ ) is the only special character allowed.


2. A user option may not have the same name as any of the standard Compiler
Control Options.
There are a maximum of 768 user options.

V_GLOBALTEMPS (Set)
The V_GLOBALTEMPS option is used to control the placement of temporary arrays
created by the compiler when vectorization is being performed. It has no effect unless
vectorization is invoked.

When V_GLOBALTEMPS is set, all temporary arrays created by the compiler when
vectorization is being performed are global to the program and are shared among all
routines requiring them. When the option is reset, all temporary arrays are local to the
routine in which they are used. Typically, it is desirable to place them at D2, which is
default. However, for the case of code that is intended to be re-entrant (it is contained
in a library that is shared or it is a routine that will be processed off from an ALGOL
host to which it is bound) or if there is a need to conserve D2 stack space, it may be
desirable or even necessary to place temporary arrays at D3. Note that when the
temporaries are located at D3 (V_GLOBALTEMPS is reset), the actual location is
affected by the compiler control options HEAP, OWN, and OWNARRAYS.

V_REPORT
When the V_REPORT option and the LIST option are set for a source line, a report is
printed of the results of attempting to vectorize the statement on that line and data
dependencies, effecting vectorization, to other lines for which V_REPORT and LIST are
both set. All such reports for a subprogram are grouped together in a single
"vectorization report" printed after the last source line for a subprogram. A
vectorization report for a subprogram is only printed if at least one source line is
printed with a nonblank entry in column 30 (the vectorization result flag) and
V_REPORT is set for that line. For more information on vectorization reports, see
Section 19.

VARIABLETOARRAY (Reset)
Within a subprogram, when the first reference is made to a subroutine or function, the
compiler examines the state of VARIABLETOARRAY. If it is set, then for each
reference to that subroutine or function within the subprogram, the compiler treats
any actual arguments that are variables as single dimension arrays of length one,
where the element in the array has the value of the variable. A variable that is treated
as an array may be passed to a formal argument that is either an array or a variable
without producing a syntax error. For more information and examples, see the
description of the EXPRESSIONTOARRAY option in this section.

1760 3957 6053003


Compiler Control Options

VOID (Reset)
The VOID option limits source input. When VOID is set, all input from files CARD and
SOURCE, except CCIs in the CARD file, is ignored by the compiler. The ignored input is
neither listed nor included in the updated symbolic file, regardless of the states of LIST
and NEW. The VOID option may be reset only by a CCI in the CARD file.

WARNFATAL (Reset)
When the WARNFATAL option is set, errors that otherwise would have generated
warning messages are considered syntax errors. The old FORTRAN option, NOWARN,
is accepted as a synonym for the WARNFATAL option.

WARNSUPR (Reset)
The WARNSUPR option, when set, suppresses warning messages. The old FORTRAN
option, SUPRS, is accepted as a synonym for WARNSUPR, regardless of the state of
the CONVERT option.

XREF (Reset)
The XREF option outputs a cross reference of all identifiers used in a compiled
program. The LIST option need not be set to generate a cross reference listing. The
identifiers are arranged according to the EBCDIC collating sequence with lists of
sequence numbers of records on which the identifier appears. XREF may not be set or
reset after the first source statement in the program.

The XREF option may not be used when the SEPARATE option is set. If an attempt is
made to set both SEPARATE and XREF, a warning is issued and the XREF option is
ignored.

Note: Cross reference information may become distorted when overlapping or


non-ascending sequence numbers are introduced by using the INCLUDE compiler
control option. The sequence number for an item that is added as the result of an
include, references the line which is the INCLUDE unless the compiler control
options NEW and INCLNEW are set.

XREFFILES (Reset)
The XREFFILES option causes the appropriate files to be created and saved for
INTERACTIVEXREF. Refer to the ClearPath Enterprise Servers System Software
Operations Guide for more detailed INTERACTIVEXREF information. These files have
the following titles:

XREFFILES/<code file name>/REFS

XREFFILES/<code file name>/DECS

3957 6053003 1761


Compiler Control Options

<code file name> is the name of the code file the compiler is generating. XREFFILES
may not be set or reset after the first source statement in the program.

The XREFFILES option may not be used when the SEPARATE option is set. If an
attempt is made to set both SEPARATE and XREFFILES, a warning is issued and the
XREFFILES option is ignored.

If SYSTEM/EDITOR is used with a source file after cross reference files have been
generated for that file, the XREFFILES may be loaded by specifying LOAD X<code file
name>. Note that if the work file has been compiled through CANDE without including
a source or object file name in the COMPILE command, the <code file name> is of the
form CANDE/CODE<number>. A file directory search under CANDE or
XREFFILES/CANDE shows the name that was used.

1762 3957 6053003


Section 18
Libraries

Note: This entire section is a Unisys extension to the national standard.

A library is a program that provides a set of "entry points," in the form of subprograms,
files, or common blocks, that may be referenced by other programs called "user
programs." Libraries may be created with or referenced by FORTRAN77 programs.

The advantages of libraries include:

1. Extension of the SAVE data space that is available to a program. (Each library has
its own D2 stack cells available.)
2. Extension of the code space available to a program. (Each library has its own D1
space.)
3. Interlanguage connectivity. (For example, FORTRAN77 user programs can
reference ALGOL libraries, and ALGOL user programs can reference FORTRAN77
libraries.)
4. Simplification of program design, debugging, and maintenance. (Consolidating
logically related program units into a library makes programming easier and
program structure more visible.)

BLOCK GLOBALS Subprogram


A BLOCK GLOBALS subprogram is used for declaring libraries, export lists, import
lists, and files. Only one BLOCK GLOBALS subprogram is allowed in a FORTRAN77
program; it must precede all other FORTRAN77 source statements (other than FILE
statements).

The BLOCK GLOBALS subprogram is initiated by a BLOCK GLOBALS statement and


terminated by an END statement. The only statements allowed in this subprogram are
FILE, LIBRARY, EXPORT, and IMPORT statements.

In any given program, FILE statements may either immediately precede a program unit
or appear as the first statements in a BLOCK GLOBALS subprogram. See Section 8 for
the format of the FILE statement.

Creating Libraries
There are three constructs in FORTRAN77 used in creating libraries: the EXPORT
statement, the CALL FREEZE statement, and the compiler control option SHARING.

3957 6053003 181


Libraries

EXPORT Statement
The non-executable EXPORT statement is used to specify which subroutines,
functions, common blocks, and files are to be provided as entry points to the library
upon execution of the CALL FREEZE statement. EXPORT statements are used only in a
BLOCK GLOBALS subprogram.

The EXPORT statement format is as follows:

  , 
 
 EXPORT  (  <subroutine name>  ) 
   
 <function name>  # =  <string> &
 
 <common block designator> 
 
# <unit identifier> &

The subroutine or function name, common block designator, or file unit identifier is
known as an entry point designator. A common block designator must include slashes,
for example, /BLK/. A unit identifier must be an integer constant between 0 and 99
inclusive. The <string>, which must be bounded on the left and right by single or
double quotes, indicates the name by which the entry point is to be known to users of
the library. If a <string> is not specified, the exported item is known to users by the
name of its entry point designator.

Exported files need not be declared or referenced elsewhere in the library program,
since their appearance in the EXPORT statement is treated as an implicit declaration.
However, exported common blocks should appear in either a COMMON statement or
an IMPORT statement. If an exported common block is not declared elsewhere in the
program, a warning message is issued.

CALL FREEZE Statement


The executable statement CALL FREEZE changes the running program into a library
stack.

The CALL FREEZE statement format is the following:

 CALL FREEZE  (  TEMPORARY  ) 


 
 "TEMPORARY" 
 
 PERMANENT 
 
# "PERMANENT" &

If 'TEMPORARY' is specified, the library stack remains available only as long as at least
one user is referencing it. A temporary library that is no longer in use unfreezes and
resumes running as a regular program. If 'PERMANENT' is specified, the library stack
continues to exist even if no users are referencing it.

182 3957 6053003


Libraries

If the value of the SHARING compiler control option is either PRIVATE or


SHAREDBYRUNUNIT, the duration of the library program is unconditionally set to
'TEMPORARY' by the MCP.

SHARING Option
The SHARING compiler control option specifies the way in which programs may use a
given library simultaneously. The valid forms of the option are SHARING = PRIVATE,
SHARING = SHAREDBYALL, SHARING = DONTCARE, and SHARING =
SHAREDBYRUNUNIT. The default value for SHARING is DONTCARE.

If the value of SHARING is PRIVATE, then every user program uses a separate
instantiation (copy) of the library program. Any changes made to global items in the
library by the program unit invoking the library apply only to that particular user
program. This type of sharing is suitable for any application that, by its nature, services
only one user.

For libraries that are SHAREDBYALL, all simultaneous users share the same
instantiation of the library. Any changes made to global items in the library or by a
program unit that has invoked the library apply to all users of that library. This type of
sharing is suitable for applications that control access to a device or data base, or
applications that provide a collection of functions, such as a math function library.

The SHARING value DONTCARE is a synonym for SHAREDBYALL.

If the value of SHARING is SHAREDBYRUNUNIT, then a copy of the library is shared by


a user program and all the libraries to which that program is linked. This type of
sharing is suitable for applications that produce collected output or that access data
bases.

The following is an example of a FORTRAN77 program that creates a library.

$ SHARING = DONTCARE
BLOCK GLOBALS
EXPORT (SINE = SIN, COSIN)
END
REAL FUNCTION SINE (X)
REAL X
REAL Y
Y = X
C* PERFORM SINE CALCULATION...
. . . . .
SINE = Y
END
REAL FUNCTION COSIN (X)
REAL X
REAL Y
Y = X
C* PERFORM COSINE CALCULATION...
. . . . .

3957 6053003 183


Libraries

COSIN = Y
END
C* MAIN PROGRAM
CALL FREEZE (TEMPORARY)
END

Referencing Libraries
On the first executable reference to an entry point of a library, the user program is
suspended. The MCP automatically initiates the library program (if it has not already
been initiated) and sets up a linkage between the library and the user program. The
library program runs normally until it executes a freeze statement, which makes the
entry points available.

User programs access library entry points by using a LIBRARY statement together
with either of two constructs: the IN LIBRARY declaration or the IMPORT statement.
IN LIBRARY is used only with subroutines and functions; IMPORT is used with files
and common blocks as well as subprograms.

Each library used in a program must be declared in a LIBRARY statement. LIBRARY


statements must appear in the BLOCK GLOBALS subprogram.

The LIBRARY statement format is the following:

 LIBRARY  <library id> @



@&
 
   ,  
   
# (  /1\  TITLE=  <string>  ) &
 
 /1\  INTNAME=  <string> 
 
 /1\  LIBACCESS=  <string> 
 
 /1\  FUNCTIONNAME=  <string> 
 
# /1\  LIBPARAMETER=  <string> &

Specification of attributes such as TITLE or INTNAME is optional. Each <string> in an


attribute specification must be bounded by quotation marks. By default, the <library
id> is used for TITLE, FUNCTIONNAME, and INTNAME. If the INTNAME is given, but
the TITLE is not, the string given for the INTNAME is used for the TITLE. If the
INTNAME is given, but the FUNCTIONNAME is not, the string given for the INTNAME is
used for the FUNCTIONNAME.

Library Attributes
Libraries, like files, have attributes that can be set by a user program. The library
attributes TITLE, INTNAME, LIBPARAMETER, LIBACCESS, and FUNCTIONNAME take
the values of EBCDIC strings. These attributes have the following meanings:

184 3957 6053003


Libraries

TITLE the name of the library code file.


INTNAME the library code file's internal identifier.
LIBACCESS the means by which the library is accessed.
FUNCTIONNAME the system function name under which the library is
established as a system library.
LIBPARAMETER a way of transmitting information from the user
program to the selection procedures of libraries that
provide dynamic entry point linkage. An example of
using LIBPARAMETER is provided later in this section,
under the heading FORTRAN77 TO ALGOL MAPPING.

The library attributes TITLE, FUNCTIONNAME, and LIBPARAMETER may be set or


changed after the initial library declaration by using the CHANGE statement. The
change must be made prior to the first attempt to link to the library. Attempts to
change library attributes after the user program is linked to the library are ignored by
the MCP. In the CHANGE statement, the attribute value assigned to TITLE,
FUNCTIONNAME, or LIBPARAMETER may be either a character constant (string) or a
character variable. See Section 8 for further information on the CHANGE statement.

Examples:
LIBRARY LIB (LIBACCESS=BYTITLE,TITLE=OBJECT/F77/LIB)
LIBRARY LIB2 (LIBACCESS=BYFUNCTION,FUNCTIONNAME=F77LIB)
CHANGE (LIB2, FUNCTIONNAME=CHAR8)
(here, CHAR8 is declared CHARACTER*8 and is assigned
MYNEWLIB)

Library Access: 'BYTITLE', 'BYFUNCTION', and 'BYINITIATOR'


A library can be accessed by a user program by means of either its code file name or a
support function name. Support functions can be defined and installed by an
installation manager with the SL (System Library) command. For example, the
following two declarations specify the same library, assuming that the support
function assignment is valid:

(Installation command)
SL PLOTSUPPORT = *PLOTLIBRARY ON APPL

(Possible FORTRAN77 declarations)


LIBRARY PLOT (LIBACCESS = BYTITLE,
- TITLE = *PLOTLIBRARY ON APPL)
LIBRARY PLOT (LIBACCESS = BYFUNCTION,
- FUNCTIONNAME = PLOTSUPPORT)

3957 6053003 185


Libraries

LIBACCESS is an EBCDIC library attribute with the possible value 'BYTITLE',


'BYFUNCTION', or 'BYINITIATOR'. If LIBACCESS is not specified, 'BYTITLE' is the
default. The value 'BYTITLE' specifies that the TITLE attribute of the library is to be
used to find the library's code file. The value 'BYFUNCTION' indicates that the
FUNCTIONNAME is to be looked up in the MCP library function table, which is
maintained by the SL sytem command, and that the associated code file is to be used.
FUNCTIONNAME is an EBCDIC attribute that specifies the library's SLed function
name. The function name cannot contain special characters, such as '/' or '*', and it
cannot contain a usercode or an ON clause.

LIBACCESS = 'BYINITIATOR' is a request by a library program to import items from the


program (in this case, another library program) that caused it to initialize and freeze.
This creates a circular linkage from the library specifying 'BYINITIATOR' back to the
library that caused it to initialize. A library that requests 'BYINITIATOR' linkage back to
its initiator behaves as if 'BYTITLE' linkage had been requested and the code file title of
the initiating library was known and explicitly used. LIBACCESS = 'BYINITIATOR' may
be used only in a library.

An example of how 'BYINITIATOR' is used follows.

In file F77/BYINITIATOR/EXAMPLE:

C* A program that invokes the first library

BLOCK GLOBALS
LIBRARY MAINLN (TITLE=OBJECT/F77/MAINLN)
IMPORT FROM MAINLN (CONTRL)
END

PROGRAM START
CALL CONTRL
END

In file F77/MAINLN:

C* Library 1 -- F77/MAINLN

$ SHARING = SHAREDBYRUNUNIT
BLOCK GLOBALS
FILE 6 (KIND=DISK, PROTECTION=SAVE, TITLE=OUTPUT.)
LIBRARY GRAPH (TITLE=OBJECT/F77/GRAPH)
IMPORT FROM GRAPH (G1)
EXPORT (CONTRL, 6=OUTPUT)
END

SUBROUTINE CONTRL
WRITE (6, *) IN CONTRL
CALL G1
END

186 3957 6053003


Libraries

PROGRAM MAINLN
CALL FREEZE (TEMPORARY)
END

In file F77/GRAPH:

C* Library 2 -- F77/GRAPH
C* This graphics library will import a file for output
C* from the library that referenced it.

$ SHARING = SHAREDBYRUNUNIT
BLOCK GLOBALS
LIBRARY LIB1 (TITLE=DUMMY, LIBACCESS=BYINITIATOR)
IMPORT FROM LIB1 (OUTPUT=6)
EXPORT (G1)
END

SUBROUTINE G1
WRITE (6, *) IN G1 OF GRAPH
END

PROGRAM GRAPH
CALL FREEZE (TEMPORARY)
END

IN LIBRARY Statement
The IN LIBRARY statement is used within a subprogram declaration to indicate that
the subprogram is to be found in a library.

The IN LIBRARY statement format is as follows:

 IN LIBRARY  <library id> 


 
# (  ACTUALNAME=  <string>  ) &

The <library id> name must be declared in a LIBRARY statement within the BLOCK
GLOBALS subprogram. The <string>, which must be bounded by quotation marks,
indicates the actual name of the subprogram in the library.

The only other statements allowed in a subprogram that contains an IN LIBRARY


statement are type statements, DIMENSION statements, and EXTERNAL statements.
These statements must refer to the subprogram's arguments. If a formal argument of
the imported subprogram is a function or subroutine, the argument must be declared
as EXTERNAL.

The following is an example of a FORTRAN77 program that references the library


shown in CREATING LIBRARIES.

BLOCK GLOBALS
LIBRARY LIB (TITLE = OBJECT/MATHINTRINSICS)

3957 6053003 187


Libraries

END
REAL FUNCTION SIN (X)
REAL X
IN LIBRARY LIB
END
REAL FUNCTION COS (X)
REAL X
IN LIBRARY LIB (ACTUALNAME = COSIN)
END
C* MAIN PROGRAM
A = 3.1415927
WRITE (6, *) SIN(A), COS(A)
END

IMPORT Statement
As is the IN LIBRARY statement, the IMPORT statement is used to indicate that
subroutines and functions are found in a library. It may also be used to specify
common blocks and files that are to be imported from a library.

The IMPORT statement's syntax is as follows:

 IMPORT FROM  <library id> @

  , 
 
@ (  <subroutine name>  ) 
   
# <string>  = &  <function name> 
 
 <common block designator> 
 
# <unit identifier> &

The library from which a given item or items are to be imported is specified by the
<library id>. This library must be declared via a LIBRARY statement before any
IMPORT statement that uses it. As in the EXPORT statement, a <common block
designator> is an identifier delimited by slashes and a <unit identifier> is an integer
constant in the range 0 to 99. A <subroutine name> or <function name> within an
IMPORT statement is the name given to that subprogram by the IMPORTing program.

In some cases, a unit identifier, subprogram name, or common block designator in the
user program may not match the corresponding entry point designator in the library
program. In such a case, the user must specify a quoted <string> signifying the name
under which the entry point was exported by the library. For example, if library LIB
contains the statement EXPORT (6 = 'OUTPUT'), the user program can reference the
imported file as file number 1 by including the statement IMPORT FROM LIB ('OUTPUT'
= 1). Also, if LIB contains the statement EXPORT (SUB), and SUB is known in the user
program as PROC, the user program can include the statement IMPORT FROM LIB
('SUB' = PROC).

188 3957 6053003


Libraries

A subprogram that is IMPORTed is said to be implicitly declared. The number and


types of its arguments are not explicitly defined in the IMPORT statement; also, if the
subprogram is a function, the type of the value returned is not explicitly defined.
These specifications are derived from the rest of the program through usage. If the
subprogram is never referenced in the rest of the program, the subprogram is not
imported and an appropriate warning is issued. (Note that a reference to the "missing"
imported subprogram can later be SEPCOMPed in if MAKEHOST is set, or bound in if
BINDINFO is set.) If the subprogram appears in the rest of the program only in
EXTERNAL statements and argument lists, it is assumed to be a subroutine with no
arguments, and a warning is issued.

If an imported subprogram S is referenced with actual argument A or A(1), where A is


a REAL array, the corresponding formal argument in S may consist of either a real
array or a real variable. This is because A, or A(1), can be interpreted either as the array
row starting at index 1 or the single array element with index 1. If the subprogram is
called elsewhere with a variable, constant, or expression in the same argument list
position, the ambiguity is resolved: the formal argument must be a variable.
Otherwise, the formal argument is assumed to be of type real array and a warning is
issued. The same rules apply to any other array argument, subscripted or
unsubscripted.

Like subprograms, files and common blocks in the <import list> are implicitly declared
by the IMPORT statement. Imported files may not be explicitly declared via FILE
statements in the user program. Imported common blocks are accessed in
non-BLOCK GLOBALS subprograms via the appropriate COMMON statements. The
maximum size of an imported common block is its maximum size when it was
exported.

IMPORTed versus IN LIBRARY Subprograms


A summary of the major differences between the IMPORT method and the IN
LIBRARY method of importing subprograms follows:

IMPORT METHOD Subprograms are imported by means of the IMPORT


statement.
The problem of differing exported and imported
names is circumvented by means of the <string> =
<identifier> clause in the IMPORT statement.
Imported subprograms are declared by means of
the IMPORT statement.
The number and kinds of arguments in a
subprogram, as well as the type of value returned
by a function are determined by usage of the
subprogram throughout the rest of the program.

3957 6053003 189


Libraries

IN LIBRARY METHOD Subprograms are imported by means of the IN


LIBRARY statement.
The problem of differing exported and imported
names is circumvented by means of the
ACTUALNAME = <string> clause in the IN LIBRARY
statement.
Imported subprograms are declared by means of
the SUBROUTINE or FUNCTION statement together
with any formal argument specifications, and
followed by an IN LIBRARY statement and an END
statement.
The number and kinds of arguments in a
subprogram, as well as the type of value returned
by a function are determined by the SUBROUTINE or
FUNCTION statement and the type, DIMENSION, or
EXTERNAL declarations for the arguments.

Note: The IMPORT method is less verbose than the IN LIBRARY method, but the
IMPORT statement, in itself, gives no information about the nature of the imported
subprogram. The IMPORT method is much more context dependent while the IN
LIBRARY method is more straightforward and explicit. There is, however, a
symmetry between IMPORT statements and EXPORT statements, in that both are
used with the same classes of items: subprograms, common blocks, and files.
Common blocks and files cannot be imported with the IN LIBRARY method.

Example 1
The file RESULT, is created when the files SEARCH/SORT/USER and
SEARCH/SORT/LIBRARY are compiled and the former's object file is executed.

The file RESULT:

A (unsorted): 3 1 4 1 5 9 2 6 5 3
A (sorted) : 1 1 2 3 3 4 5 5 6 9
4 was found in A(6)

The file SEARCH/SORT/USER:

BLOCK GLOBALS
LIBRARY SSLIB (TITLE = OBJECT/SEARCH/SORT/LIBRARY)
IMPORT FROM SSLIB (SEARCH, SORT, 1)
END

C* Sort ordering: returns true if A >= B.

LOGICAL FUNCTION ORDER (A, B)


INTEGER A, B
ORDER = (A .GE. B)
END

1810 3957 6053003


Libraries

C* Beginning of main program...

LOGICAL ORDER
EXTERNAL ORDER
INTEGER SEARCH, TARGET, I, A(10)

DATA A / 3, 1, 4, 1, 5, 9, 2, 6, 5, 3 /

10 FORMAT (A13, 10(1X, I2))

C* Sort A[1...10] and print A[1...10] before and after sort.

WRITE (1, 10) A (unsorted):, A


CALL SORT (A, 1, 10, ORDER)
WRITE (1, 10) A (sorted) :, A

C* Search for 4 in sorted A[1...10]; print result.

TARGET = 4
I = SEARCH (TARGET, A, 1, 10)
IF (I .EQ. -1) THEN
WRITE (1, *) TARGET, was not found in A
ELSE
WRITE (1, *) TARGET, was found in A(, I, )
END IF
END

The file SEARCH/SORT/LIBRARY:

BLOCK GLOBALS
FILE 1 (KIND=DISK, TITLE=RESULT., NEWFILE=.TRUE.)
EXPORT (1, BUBBLE=SORT, LINEAR=SEARCH)
END

C* Swap the contents of the dummy integers A and B.

SUBROUTINE SWAP (A, B)


INTEGER A, B
INTEGER C
C = A
A = B
B = C
END % of SWAP routine

C* Bubble sort A[FIRST...LAST] in place in the ORDER provided.

SUBROUTINE BUBBLE (A, FIRST, LAST, ORDER)


INTEGER LAST, A(LAST), FIRST
LOGICAL ORDER
INTEGER I, J, TEMP

3957 6053003 1811


Libraries

DO 10 I = FIRST, LAST-1, 1
DO 20 J = LAST, I+1, -1
IF (.NOT. ORDER (A(J), A(J-1))) THEN
CALL SWAP (A(J), A(J-1))
END IF
20 CONTINUE
10 CONTINUE
END % of BUBBLE routine

C* Linear search for TARGET in A[FIRST...LAST]. Return the index C* into A of the first
such occurrence, or -1 if TARGET is not C* present.

INTEGER FUNCTION LINEAR (TARGET, A, FIRST, LAST)


INTEGER TARGET, A(LAST), FIRST
INTEGER I
LINEAR = -1
I = FIRST
30 IF (.NOT. ((I .GT. LAST) .OR. (LINEAR .NE. -1))) THEN
IF (TARGET .EQ. A(I)) THEN
LINEAR = I
ELSE
I = I + 1
END IF
GO TO 30
END IF
END % of LINEAR function

C* Main program...

CALL FREEZE (TEMPORARY)


END

Example 2
The following two FORTRAN77 programs (in files IMP and EXP) produce the following
output when IMP is run.

Output:

HELLO FROM EXPORTER


1.0 2.0
HELLO FROM IMPORTER
3.0 2.0

The file IMP:

BLOCK GLOBALS
LIBRARY LIB (TITLE=OBJECT/EXP)
IMPORT FROM LIB (/CMN/, OUTPUT=1)
END

1812 3957 6053003


Libraries

PROGRAM MAIN
COMMON /CMN/ A
A = 3
WRITE (1, *) HELLO FROM IMPORTER
END

The file EXP:

BLOCK GLOBALS
FILE 6 (KIND=REMOTE)
EXPORT (6=OUTPUT, /CMN/)
END
PROGRAM MAIN
COMMON /CMN/ B, C
B = 1
C = 2
WRITE (6, *) HELLO FROM EXPORTER
WRITE (6, *) B, C
CALL FREEZE (TEMPORARY)
WRITE (6, *) B, C
END

FORTRAN77 to ALGOL Mapping


When creating a FORTRAN77 program that accesses an ALGOL library, or a
FORTRAN77 library that is referenced by an ALGOL user program, it is important to be
aware of the way subprograms and their arguments "match up" in the two languages.
FORTRAN77 subroutines correspond to ALGOL untyped procedures and FORTRAN77
integer, real, logical, double precision, and complex functions correspond to ALGOL
procedures that are typed integer, real, Boolean, double, and complex, respectively. A
FORTRAN77 character function corresponds to an ALGOL untyped procedure that has
two initial formal arguments: an EBCDIC array declared with a [*] lower bound, and an
integer variable. The integer maps onto the character function's length, and the
EBCDIC array contents map onto the character function's value.

Table 18-1 describes the mapping of FORTRAN77 subprogram arguments onto ALGOL
subprogram arguments:

Table 181. FORTRAN77 to ALGOL Subprogram Mapping

FORTRAN77 argument Corresponding ALGOL argument


Integer variable Integer variable
Real variable Real variable
Logical variable Boolean variable
Double precision variable Double variable
Complex variable Complex variable

3957 6053003 1813


Libraries

Table 181. FORTRAN77 to ALGOL Subprogram Mapping

Character variable EBCDIC array [*] and integer variable (1)


Integer array Integer array [*] (2)
Real array Real array [*] (2)
Logical array Boolean array [*] (2)
Double precision array none (3)
Complex array none (3)
Character array EBCDIC array [*] and integer variable (1)

Notes for the table:


1. FORTRAN77 character variables are stored in a data pool. When passing a
character variable or character array, FORTRAN77 seems to be passing a single
argument, but in reality it is passing three: the pool or array descriptor, the offset,
and the length of the character entity. The first two arguments map onto an
ALGOL EBCDIC array with a [*] lower bound, and the third argument (the length)
onto an integer variable. The following example allows storing into a FORTRAN77
character entity using ALGOL:
(FORTRAN77)
CHARACTER*80 LINE
.....
CALL BLNK (LINE)

(ALGOL)

PROCEDURE BLNK(LINE,LNGTH);
VALUE LNGTH;
EBCDIC ARRAY LINE[*];
INTEGER LNGTH;
BEGIN
REPLACE LINE[0] BY "" FOR LNGTH;
END;

Note that a subscript of [0], not [*], should be used in any executable ALGOL
statement that accesses the beginning of the character entity. Also no attempt
should be made to store into the character entity beyond the length that is passed
as an argument.

1814 3957 6053003


Libraries

2. All FORTRAN77 arrays are implemented as one-dimensional arrays. Therefore, only


one-dimensional ALGOL arrays (or array rows) can be passed between ALGOL and
FORTRAN77. When a FORTRAN77 array is passed to an ALGOL array, the ALGOL
array should be declared with an asterisk (*) for the lower bound. The FORTRAN77
subscript value used to evaluate the actual parameter corresponds to the ALGOL
subscript value of zero. For example, if a FORTRAN77 user program contains the
statement CALL PROC (A(5)), and PROC is declared in the ALGOL library with
formal argument REAL ARRAY X[*], then A(5) corresponds to X[0]. The
FORTRAN77 array's lower bound, which is usually 1, is used if the FORTRAN77
subscript is not specified. Now consider the reverse situation: An ALGOL user
program passes an array to a subprogram in a FORTRAN77 library. In this case,
the array must be declared in ALGOL with a 0 (zero) lower bound (or * bound if the
array is a formal argument in the ALGOL program unit). The specified or default
FORTRAN77 lower bound corresponds to ALGOL's zero lower bound.
3. FORTRAN77 double precision and complex arrays are represented with single
precision data descriptors and therefore, normally, cannot be mapped to double or
complex arrays in other languages. However, if the compiler control option
DOUBLEARRAYS is set, such mapping may be possible. Refer to DOUBLEARRAYS
in Section 17.
In FORTRAN77, variable arguments are passed by value-result and array arguments
are passed by reference. FORTRAN77 variables can be passed to ALGOL by name
variables and vice versa. In ALGOL, variable formal arguments can also be declared to
be by value, meaning that any changes to the variable within the subprogram itself
have no effect on the actual argument to the subprogram. Note that a FORTRAN77
program cannot pass an actual argument to an ALGOL formal argument that is
declared to be by value. (Exception: A formal argument declared in ALGOL for the
purpose of mapping onto the length of a FORTRAN77 character entity can be declared
as a by value integer variable.)

Example
When the code file for INITIATE/CIRCULAR/LIB is executed, the following is output:

ENTERING PROCEDURE PROC...


ENTERING SUBROUTINE SUB...
VAL = 0.0 VAR = 2.0

The file INITIATE/CIRCULAR/LIB:

BLOCK GLOBALS
LIBRARY F77LIB (TITLE=OBJECT/F77/LIB)
END

SUBROUTINE ENTER
IN LIBRARY F77LIB
END

CALL ENTER
END

3957 6053003 1815


Libraries

The file F77/LIB:

BLOCK GLOBALS
LIBRARY ALGLIB (TITLE=OBJECT/ALGOL/LIB)
EXPORT (SUB, ENTER)
END

SUBROUTINE PROC (A, B)


REAL A, B
IN LIBRARY ALGLIB
END

SUBROUTINE SUB (X, Y)


REAL X, Y
PRINT *, ENTERING SUBROUTINE SUB...
X = 1.0
Y = 2.0
END

SUBROUTINE ENTER
CALL PROC (VAL, VAR)
PRINT *, VAL = , VAL, VAR = , VAR
END

CALL FREEZE (TEMPORARY)


END

The file ALGOL/LIB:

BEGIN
LIBRARY F77LIB (TITLE="OBJECT/F77/LIB.");
PROCEDURE SUB (X, Y);
VALUE X; REAL X, Y;
LIBRARY F77LIB;
FILE OUT (KIND=REMOTE);
PROCEDURE PROC (A, B);
REAL A, B;
BEGIN
WRITE (OUT, //, "ENTERING PROCEDURE PROC...");
A := 0;
B := 0;
% Note that since the first argument to SUB has been
% declared to be by value, the following line has no
% effect on the value of A.
SUB (A, B);
END;
EXPORT PROC;
FREEZE (TEMPORARY);
END.

1816 3957 6053003


Libraries

In addition to using subprogram arguments, FORTRAN77 can pass information to an


ALGOL library through the use of the LIBPARAMETER attribute. This attribute permits
dynamic linkage of the user program to a library program, allowing the library program
to determine at link time which library task the user program will be linked to. The
library program must provide a selection procedure that accepts the LIBPARAMETER
attribute as an argument. Based on the value of LIBPARAMETER, the selection
procedure selects and initiates a library task. The selection procedure must also
accept, as a second argument, a procedure. This procedure, which is provided by the
MCP to verify that the library task is valid and complete, must be called before the
selection procedure is exited. The MCP calls the selection procedure at link time. Only
libraries written in ALGOL can provide entry points dynamically.

The following is an example of a FORTRAN77 program that references an ALGOL


library and passes a selection parameter using LIBPARAMETER. The information
needed by the library is found in the character string supplied for the LIBPARAMETER
attribute. The value of the job's station or priority, as appropriate, is returned by
procedure TV.

FORTRAN77 user program:

BLOCK GLOBALS
LIBRARY TASK (TITLE=OBJECT/ALGOL/LIB)
END
REAL FUNCTION TV ()
IN LIBRARY TASK
END
CHARACTER*12 CONT
READ (5, FMT=(A12)) CONT
CHANGE (TASK, LIBPARAMETER=CONT)
WRITE (6, 900) CONT, ABS(TV())
900 FORMAT (2X, A12, IS : , F5.0)
END

ALGOL library referenced by FORTRAN77 program:

BEGIN
TASK LIB1TASK, LIB2TASK;
PROCEDURE DYNLIB1;
BEGIN
REAL PROCEDURE TV;
BEGIN
TV := MYSELF.STATION;
END;
EXPORT TV;
FREEZE (TEMPORARY);
END; % DYNLIB1
PROCEDURE DYNLIB2;
BEGIN
REAL PROCEDURE TV;
BEGIN

3957 6053003 1817


Libraries

TV := MYSELF.PRIORITY;
END;
EXPORT TV;
FREEZE (TEMPORARY);
END; % DYNLIB2
PROCEDURE SELECTIONPROC (LIBPARAMETER, NAMINGPROC);
VALUE LIBPARAMETER;
STRING LIBPARAMETER;
PROCEDURE NAMINGPROC (LIBTASK);
TASK LIBTASK; FORMAL;

BEGIN
IF LIBPARAMETER = "STATION LSN " THEN
BEGIN
IF LIB1TASK.STATUS NEQ VALUE(FROZEN) THEN
PROCESS DYNLIB1 [LIB1TASK];
NAMINGPROC (LIB1TASK);
END
ELSE
IF LIBPARAMETER = "PRIORITY " THEN
BEGIN
IF LIB2TASK.STATUS NEQ VALUE(FROZEN) THEN
PROCESS DYNLIB2 [LIB2TASK];
NAMINGPROC (LIB2TASK);
END;
END; % SELECTIONPROC
REAL PROCEDURE TV;
BY CALLING SELECTIONPROC;
EXPORT TV;
FREEZE (TEMPORARY);
END.

1818 3957 6053003


Section 19
Vectorization

Note: This entire section is a Unisys extension to the national standard.

The main objective of the FORTRAN77 features provided for MCP/AS (Extended)
machines is to recognize that multiple iterations of an operation can be performed in
one instruction; this process is called vectorization. In FORTRAN77, a vector is a
series of elements of an array. The elements need not be adjacent, but must occur at
constant intervals.

Vectorizing Statements
Executing a vector operator is equivalent to one instruction performing the operations
on all of the elements, which takes multiple iterations of a conventional FORTRAN DO
loop.

Example
DO 10 I=1,10
10 A(I) = B(I) + C(I)

For the previous conventional loop statement, either of the following statements can
be performed before, after, or at the same time as the other:

A(1) = B(1) + C(1)


A(2) = B(2) + C(2)

The results are the same. Therefore, the statement can be vectorized. However, not
all statements can be legally vectorized.

Criteria for Loop Vectorization


FORTRAN77 does not attempt to vectorize all loops. Only statements in innermost
nested DO loops are candidates for vectorization. Statements in loops formed by IF
and GO TO statements are not considered.

Example
This loop is not considered for vectorization:

20 JLOC = CHAIN(JOFF+JLOC)
IF (VALUES(JOFF+JLOC).NE.ITEM) GO TO 20

3957 6053003 191


Vectorization

As a rule, programs using linked lists as data structures do not vectorize well since
multiple iterations of loops of linked lists cannot be done in parallel. The compiler must
do each iteration of a loop to determine which array element to access in the next
iteration. In the previous example, JLOC is an index into array CHAIN to get the next
value of JLOC, therefore preventing evaluation of multiple iterations of the loop.

Although the compiler attempts vectorization for DO loops, the loops must meet the
following criteria for their statements to be candidates for vectorization:

The DO variable must be an integer variable


The DO variable must not be assigned within the body of the DO loop
The value of the increment must not be zero
The DO variable must not appear in an EQUIVALENCE statement
The loop cannot contain the following statements:
GO TO in any form
CALL statement with an alternate return specifier
PAUSE, STOP, or RETURN
ENTRY
Arithmetic IF
Namelist I/O statement
DEBUG
The VECTOR argument of the OPTIMIZE compiler control option and the OPTIMIZE
compiler control option itself must both be set at the time the DO statement is
encountered
The loop cannot contain a loop that violates any of these criteria
For a DO loop that meets all the criteria, FORTRAN77 attempts to vectorize its
statements.

Criteria for Vectorization of Loop Statements


FORTRAN77 only attempts to vectorize the assignment statements of a DO loop for
which OPTIMIZE (EXPRORDER) is set at the time the statement is encountered.

The vectorization process attempts to maintain the original expression order.


However, if a change in the expression order or increasing the precision of
calculations results in better vectorization, the change is made. A change is more likely
to be made for complicated expressions. To help prevent expression reordering
during vectorization, use the simplest possible expressions when preparing FORTRAN
source.

192 3957 6053003


Vectorization

FORTRAN77 only vectorizes assignments to REAL, DOUBLE PRECISION, or INTEGER


variables. Assignments to INTEGER variables must be done in a scalar loop; therefore,
REAL variables should be used instead of INTEGER variables if there is a choice
between the two. Non-arithmetic subexpressions on the right side of an assignment
may or may not be handled by the vectorizer (by putting such subexpressions in a
scalar loop).

A statement may not be vectorized if the compiler can determine that the vectorized
code is not likely to be as fast as standard code. When in doubt, vectorized code is
produced because it is easier to turn off vectorization than to force it on. Various
factors influence this decision, including:

Constant versus variable loop bounds


The complexity of expressions in the statement
The number of non-vectorizable operators in the statement. Vectorizable
operators are: add, subtract, multiply, divide, negation, absolute value, convert to
real, convert to double, and square.

Dependence Theory
Dependence theory is necessary for restructuring programs to increase vectorization.

As stated previously, a statement is vectorized if the result of executing the


vectorized statement is the same as the result of executing the original DO loop one
iteration at a time. The concept of dependence theory determines this by relating the
definitions and instances of variables in the DO loop statements to ensure that the
vectorized statement defines and uses variables in the same order as the original
program.

Definition of Dependence
A dependence exists between two statements, S1 and S2, if S1 must be executed
before S2 to preserve the semantic relationship between the two statements in the
original program.

Data dependence and control dependence completely define the necessary execution
order of statements in a DO loop. When vectorization does not violate a dependence,
the statement can be executed using vector operators.

Data Dependence
Data dependence ensures that variables are used and defined in the proper order.

S1 is data-dependent to S2 if any of the following types of dependence exists


between the two statements:

Flow dependence
S1 is flow-dependent to S2 if S1 defines a variable that is used by S2.

3957 6053003 193


Vectorization

Example
S1: X =
S2: = X

Antidependence
S1 is antidependent to S2 if S1 uses a variable that is defined by S2.

Example
S1: = X
S2: X =

Output dependence
S1 is output-dependent to S2 if S1 defines a variable that is also defined by S2.

Example
S1: X =
S2: X =

The three types of data dependence fully relate the necessary ordering of statements
based on the definition and use of variables. If one of them exists in a FORTRAN
program, the vectorizer must preserve that dependence in the vectorized code.

Control Dependence
Control dependence ensures that a statement is executed in the vectorized program
only if it is executed in the original program.

S1 is said to be control-dependent to S2 if the execution of S1 determines whether S2


is executed or branched around.

Example
S1: IF (A(I) .GT. 0.0) GO TO 10
S2: B(I) = C(I) + T
10 CONTINUE

In this example, there is no data dependence between S1 and S2, since data
dependence requires both statements to reference the same variable. However, the
execution of S1 can cause S2 to be skipped; S1 must be executed before S2.
Therefore, there is a control dependence from S1 to S2.

Dependence and the Vectorizer


The vectorizer must not violate any dependence in the original program when it
vectorizes statements. However, it can rearrange the execution order of statements
to improve the speed of generated code. Therefore, the statements can appear in the
generated code in a different order than they appear in the source program.

194 3957 6053003


Vectorization

The following examples show how dependence is used to determine whether


statements can be vectorized.

Example 1
DO 60 I = 1,N
A(I) = B(I) + C(I)
D(I) = A(I) * 0.5
60 CONTINUE

Listing the variables that are defined and used by the first two iterations of the loop in
Example 1 allows the dependences that the vectorizer detects to be seen easily.

First iteration: A(1) = B(1) + C(1)

*
*
*
+,,,,,,-
*
*
*
V

D(1) = A(1) * 0.5

Second iteration: A(2) = B(2) + C(2)


*
*
*
+,,,,,,-
*
*
*
V
D(2) = A(2) * 0.5

On the first iteration, A(1) is defined by the first statement and used by the second
statement in the loop. Therefore, there is a flow dependence from the first statement
to the second. The flow dependence is also shown by the definition and use of A(2) in
the second iteration. As long as the first statement is executed before the
corresponding iteration of the second statement, the values of array A that are used
by the second statement are correct. No dependence is violated and the statement
can be vectorized.

The following order of the statements from the first two iterations is legal:

A(1) = B(1) + C(1)


A(2) = B(2) + C(2)

D(1) = A(1) * 0.5


D(2) = A(2) * 0.5

3957 6053003 195


Vectorization

A(1) and A(2) are defined before they are used by the second statement. Since the
variables are defined and used in the same order that they were defined and used in
the original program, the new ordering is legal. The result of executing the statements
are the same. Therefore, the dependence for Example 1 shows that the statements
can be vectorized as long as the first statement is executed before the second
statement.

Example 2
DO 70 I = 2,N
A(I) = B(I-1) + C(I)
B(I) = A(I) * 0.5
70 CONTINUE

Listing the variables that are defined and used by the first two iterations of the loop in
Example 2 allows the dependences that the vectorizer detects to be seen easily.

First iteration: A(2) = B(1) + C(2)

*
*
*
+,,,,,,-
*
*
*
V

B(2) = A(2) * 0.5

*
*
*
+,,,,,,-
*
*
*
V

Second iteration: A(3) = B(2) + C(3)


*
*
*
+,,,,,,-
*
*
*
V
B(3) = A(3) * 0.5

196 3957 6053003


Vectorization

On the first iteration, A(2) is defined by the first statement and used by the second
statement in the loop. Therefore, there is a flow dependence from the first statement
to the second. On the first iteration, B(2) is defined by the second statement. On the
second iteration, this new value of B(2) is used by the first statement. Therefore, there
is a flow dependence from the second statement to the first. It is impossible to
rearrange these statements to execute multiple iterations of one statement before
the other statement without violating one of the dependences.

These two statements have a cycle of dependences between them. In such cases,
the statements in the cycle cannot be vectorized. The statements and dependences
that form an unvectorizable cycle are called a strongly connected component. The
statements must be treated as a single unit during execution, with one iteration of all
the statements in the strongly connected component being done before the next
iteration is started. It is not possible to do multiple iterations of any of the statements.

If the statements are rearranged to execute more than one iteration of the first
statement before executing the second, the previous value of B(2) is used in the
second iteration. This violates the flow dependence from the second statement to the
first. Rearranging the statements to execute the second statement before the first
violates the flow dependence from the first statement to the second. Since there is no
way to rearrange the statements to do multiple iterations of one statement before the
other, the statements cannot be vectorized. The vectorizer cannot generate vector
code for the statements in Example 2.

Rewriting Loops for Vectorization


Sometimes the program source must be changed to help the compiler vectorize
FORTRAN statements. Some loops are unvectorizable due to a cycle of dependences.
Rewrite them to break the dependence cycle and permit vectorization.

Breaking an Antidependence
Antidependences can be broken by saving the value of a variable before redefining it.
Breaking antidependences is the place to start rewriting loops whose statements
form a strongly connected component.

Example
DO 90 I = 1,N
A(I) = B(I)
90 B(I) = A(I+1)

Looking at the dependences for the first two loop iterations of this example shows
the cycle.

3957 6053003 197


Vectorization

First iteration: A(1) = B(1)

*
*
*
4,,,,,,5
*
*
*
V

B(1) = A(2)

*
*
*
4,,,,,,5
*
*
*
V
Second iteration: A(2) = B(2)

*
*
*
4,,,,,,5
*
*
*
V

B(2) = A(3)

The antidependences exist as follows:

From the use of B(1) in the first statement to the definition of B(1) in the second
statement, both on the first iteration
From the use of A(2) in the second statement on the first iteration to the definition
of A(2) in the first statement on the second iteration
Therefore, these statements form a strongly connected component and cannot be
vectorized. However, an antidependence indicates that a previous value of a variable
must be used before that variable can assume a new value. Do this by saving the
previous value in another variable.

Rewrite the example as follows:

DO 90 I = 1,N
T(I) = A(I+1)
A(I) = B(I)
90 B(I) = T(I)

Since the array T is used to save off the values of the array A before they are changed,
the cycle of dependences is now broken and the statements vectorize. The vectorizer
detects dependences as if the first two iterations were as follows:

198 3957 6053003


Vectorization

4,,,,,,,,,,,,,,,-
* *
* *
*
First iteration: T(1) = A(2) *
*
* *
* *
4,,,,,,,,,,,,,,,,5 *
* *
* *
* A(1) = B(1) *
* *
* * *
* * *
* 4,,,,,,5 4,,,,,,,5
* * *
* * *
* V V
*
* B(1) = T(1)
*
*
*
Second iteration: * T(2) = A(3)
*
* *
* *
+,,,,,,,,- +,,,,,,,,,,,,,,-
* *
* *
V *
*
A(2) = B(2) *
*
* *
* *
4,,,,,,5 4,,,,,,,5
* *
* *
V V

B(2) = T(2)

The vectorizer can now rearrange the statements to do multiple iterations without
violating the dependences generated for the rewritten loop, as follows:

T(1) = A(2)
T(2) = A(3)

A(1) = B(1)
A(2) = B(2)

B(1) = T(1)
B(2) = T(2)

3957 6053003 199


Vectorization

Separating Vectorizable Statements from


Unvectorizable Statements
In the previous examples, either all or none of the statements in the loop vectorize.
Loops often contain some statements that can vectorize and others that must remain
scalar. The vectorizer can group statements that vectorize into loops that are separate
from those containing statements that must remain scalar.

Example
DO 100 I = 3,10
B(I) = C(I) * D(I)
100 A(I) = A(I-2) + B(I)

The first statement defines B(I) and the second statement uses B(I), causing a flow
dependence from the first statement to the second. Since there is no dependence
back to the first statement from the second, no dependence cycle includes the first
statement. Therefore, multiple iterations of the first statement can execute in parallel.

The second statement has a flow dependence from its first iteration to its third
iteration, as follows:

The first iteration defines A(3).


The third iteration uses A(3).
Since it is in a cycle of dependences, this statement cannot be vectorized.

The vectorizer treats this loop as if written as two loops, as follows:

DO 101 I = 3,10
101 B(I) = C(I) * D(I)

DO 102 I = 3,10
102 A(I) = A(I-2) + B(I)

The first statement is vectorized and the second is not.

Subscript Expressions and the Vectorizer


In the examples presented in this section up to now, it has been easy to see which
elements of an array are being defined and used. In the following cases, it may not be
as easy to see which elements of the array are being accessed:

unknown array value


equivalenced array
array reference as a subscript
increment of zero
variable number of iterations

1910 3957 6053003


Vectorization

Unknown Array Value


Subscripts are often complicated and ambiguous. It is sometimes impossible to
determine which element of an array is being referenced without more information
about the variables that appear in array subscripts.

Example
DO 110 I = 1,N
B(I) = A(J)
A(I) = C(I) * D(I)
110 CONTINUE

Without further information about the value of variable J in the previous example, the
vectorizer cannot determine the relationship between A(J) and A(I). The following are
the two possible relationships:

If J = N+1, no dependence exists since the second statement never defines A(N+1)
If J = 1, an antidependence exists from the first statement to the second
statement since the first statement uses A(1) before the second statement
defines A(1). A flow dependence also exists from the first iteration of the second
statement to the second iteration of the first statement, since the first statement
uses A(1) on every iteration of the loop.
If the compiler cannot determine the relationship between two references, it assumes
worst-case dependences. In Example 1, if the compiler knows nothing about the value
of J, it assumes both the flow dependence and antidependence exist. Assumptions
like these force the vectorizer to include dependences that may not actually exist.

When writing code to be vectorized, make sure that subscript expressions do not
force the compiler to include worst-case dependences. Use the IVDEP Compiler
Control Option to inform FORTRAN77 that no ambiguous subscript expressions cause
a dependence.

Equivalenced Array
If the vectorizer cannot determine which storage location is being referenced on each
iteration, the compiler must include worst-case dependences, as explained for
unknown array values. The same problem can appear in other forms, such as
equivalenced arrays. When an EQUIVALENCE statement contains arrays, the vectorizer
can have trouble determining whether there is a real dependence or not. The compiler
often makes worst case assumptions about references to arrays that are
equivalenced.

3957 6053003 1911


Vectorization

Array Reference as a Subscript


The vectorizer must make worst-case assumptions when arrays with array elements
are used in the subscript expressions on both sides of an assignment statement. Use
the IVDEP compiler control option to force vectorization if no dependence actually
exists.

Example
C This example uses an array reference as the subscript
C for another array reference.

DO 112 I = 1,N
112 A(K(I)) = A(K(I))+B(I)

The values of successive elements of the array, represented by successive iterations


of K(I) in the previous example, are unknown and can be any of the following:

All the same value


Different values
Ordered
Scattered
Since the vectorizer cannot determine this relationship, it must make worst case
assumptions.

Increment of Zero
When an increment can be zero, the vectorizer must assume that all instances of the
array subscript reference the same storage location. This forces the statements in the
loop to remain scalar.

Example
This example uses a value that is possibly zero for JINC, which is the increment for a
variable in an array subscript expression:

J = JSTART
DO 113 I = 1,N
A(J) = A(J) + B(J)
113 J = J + JINC

The vectorizer can vectorize the loop in the previous example if the loop is rewritten
to push the increment into the DO statement, as follows:

DO 113 J = JSTART,JSTART+N*JINC,JINC
113 A(J) = A(J) + B(J)

The definition of the DO statement requires that the increment be a nonzero value.
The vectorizer can use this extra information to determine that it is legal to vectorize
this statement.

1912 3957 6053003


Vectorization

Variable Number of Iterations


If the distance between possible uses and definitions of the same element is not the
same for all loop iterations, the statement cannot be vectorized.

Example
DO 115 I = J,K
115 A(I) = A(I-L(I)) + B(I)

The distance between uses and definitions depends on the values of vector L(I). Since
L(I) changes on each iteration, there is no constant iteration distance between
references to the same array element. Therefore, this statement does not vectorize
and must remain scalar.

Special Vectorization Cases


FORTRAN77 can vectorize some statements that are not vectorizable according to the
rules of dependence theory. The vectorizer recognizes these cases and generates
special reduction vector operators for them.

Sum Reductions
Sum reductions are the most common special case of vectorization. FORTRAN77 can
vectorize linear (summation), linear absolute value (summation, absolute), and
quadratic (dot product) sum reductions.

Example 1
DO 140 ISUM = 1,N
140 S = S + A(ISUM)

Example 2
DO 150 ISUM = 1,N
150 S = A(ISUM) - S

Example 3
DO 160 ISUM = 1,N
160 S = S + A(ISUM) * B(ISUM)

Example 4
DO 170 ISUM = 1,N
170 S = S + ABS(A(ISUM))

3957 6053003 1913


Vectorization

Minimum, Maximum, and Maximum Absolute Value Reductions


Minimum, maximum, and maximum absolute value reductions also take advantage of
special vector operators.

Example 1
DO 160 I = 1,N
160 AMIN = MIN (AMIN, A(I))

Example 2
DO 170 I = 1,N
170 AMAX = MAX (AMAX, A(I))

Example 3
DO 180 I = 1,N
170 AMAX = MAX (AMAX, ABS(A(I)))

Using Compiler Control Options to Influence


Vectorization
The FORTRAN77 vectorizer attempts to vectorize as many statements as possible,
with the following limitations:

It does not consider possible precision differences generated by reduction or


recurrence code, except as dictated by the DIVIDE argument of the OPTIMIZE CCO
Some consideration is given to the speed of the generated code; however, in
some cases, unvectorized code may be faster.
It does not always have an overall view of the program and can be forced to make
erroneous assumptions about the values that variables make take. For example,
given a variable that can contain only positive values and that the vectorizer is not
aware of this restriction. The vectorizer could generate dependences that could
never occur since the variable used in a subscript expression is always greater
than zero.
Vectorized code may behave differently than nonvectorized code if nonvectorized
code does not conform to certain ANSI specifications. In particular, branching into
a DO loop or using hidden aliasing can produce unpredictable vectorized code.
(The NOALIAS CCO can influence the later effect.)
Various compiler control options influence the vectorizer by supplying information that
it would not otherwise have. The DIVIDE, EXPRORDER, NOALIAS, and VECTOR
arguments of the OPTIMIZE CCO, as well as the HEAP, IVDEP, OWN, OWNARRAYS,
and V_GLOBALTEMPS CCOs apply to vectorization.

Note that the value of each of the following options at the DO statement is used by
the vectorizer throughout the loop: HEAP, IVDEP, OWN, OWNARRAYS, and
V_GLOBALTEMPS.

1914 3957 6053003


Vectorization

Enable Vectorization
Vectorization does not occur unless both the OPTIMIZE CCO and its VECTOR argument
are both set and the TARGET of the compile is an MCP/AS (Extended) machine.

For further information on TARGET, see the TARGET compiler control option in Section
17.

FORTRAN77 attempts to vectorize statements of a DO loop if the previous conditions


permit vectorization at the time the DO statement is encountered and OPTIMIZE
(EXPRORDER) is set for the statement to be vectorized.

If it is determined that a DO loop should not be vectorized, vectorization can be


inhibited by RESETting the VECTOR argument for that DO loop; for example, it is
causing a difference in the results due to the way in which the statements of the DO
loop were reordered.

Ignore Potential Aliases


If both the OPTIMIZE CCO and its NOALIAS argument are set, the vectorizer assumes
that there is no hidden aliasing of formal arguments, items in common, or
equivalenced items and that array subscripts are within the declared bounds of the
array. Note that the NOALIAS argument is set by default.

Hidden aliasing is the use of a storage location by different variables that is not
declared in an equivalence statement in the local subprogram. Hidden aliasing can
occur because actual arguments are declared in a common block and the same
common block is also declared in the called subroutine or because two actual
arguments are the same item. It can also occur if an array in common is indexed
beyond its declared bound, therefore accessing adjacent common block members.
Hidden aliasing is also when the value of any subscript used to reference an array is
not within the declared bounds for its dimension of the array. Note that these run-time
activities are disallowed by the ANSI standard.

Vector Temporaries
The V_GLOBALTEMPS option is used to indicate to the vectorizer whether or not a
temporary array should be put at D2 or D3. Typically, temporary arrays are put at D2,
which is the default. However, for the case of code that is intended to be re-entrant (it
is contained in a library that is shared or it is a routine that is processed off from an
ALGOL host to which it is bound) or if there is a need to conserve D2 stack space, it
may be desirable or necessary to place temporaries at D3. Note that when the
temporaries are located at D3 (V_GLOBALTEMPS is reset), the actual location is
affected by the compiler control options HEAP, OWN, and OWNARRAYS.

3957 6053003 1915


Vectorization

Ignoring Dependencies
When the vectorizer encounters variables with unknown values in subscript
expressions, it is often forced to make worst-case assumptions and generate
dependences that stop vectorization. If it is known that these unknown variables can
never have a value that would prevent vectorization, use the IVDEP (Ignore Vector
DEPendences) CCO to inform the vectorizer that it can ignore all dependences in DO
loops encountered while this option is set.

Example
DO 10 I = J,K
A(I) = B(L)
B(I) = A(I) + C(I)
10 CONTINUE

The relationship between references B(L) and B(I) is ambiguous to the vectorizer. B(L)
could use an element before that element is defined by B(I). It could use an element
before and after B(I) defines it. The two references can be completely unrelated with
B(I) never referring to the same element as B(L). This ambiguity forces the vectorizer
to make worst-case assumptions. However, if the IVDEP CCO is set when the DO
statement in this example is compiled, the compiler ignores all ambiguous
subscripting problems in the DO loop defined by the DO statement and ignores the
possibility of a dependence existing. The loop vectorizes. Be careful when using the
IVDEP directive since FORTRAN77 can ignore a dependence that actually exists; this
could cause unexpected program results. Be certain that there is no dependence
between references in the loop.

Note: IVDEP only applies to the next DO loop encountered and all statements and
DO loops nested within that DO loop.

Example
$$ SET IVDEP
DO 10 ...
DO 20 ...
.
.
.
20 CONTINUE
10 CONTINUE
DO 30 ...
DO 40 ...
.
.
.
40 CONTINUE
30 CONTINUE

In this example, IVDEP applies to the DO 10 and DO 20 loops, but not to the Do 30 and
DO 40 loops.

1916 3957 6053003


Vectorization

Improving Program Performance


The generation of efficient vectorized code can be affected by several programming
practices. To avoid inadvertently degrading program performance, be aware of those
constructs that hinder vectorization and those that can improve it.

Scalar Variables That Are Used Before Defined


Scalar variables used in a DO loop and later defined in the loop prevent vectorization.

Example
T = 0.0
DO 10 I = 1,100
S = A(I) * B(I)
C(I) = S + T
10 T = S

In the previous loop, variable T is used before it is defined. Rewriting the loop allows
vectorization, as follows:

C(1) = A(1) * B(1)


DO 10 I = 2,100
10 C(I) = A(I) * B(I) + A(I-1) * B(I-1)

If variables S and T are used later in the program, the values they would have had at
loop exit can be assigned outside the loop. Even though the rewritten loop requires
more memory references than the original loop, the vectorization of the loop
significantly speeds up its execution.

Avoid Short Loops


There is a certain amount of start-up time before a vector operator begins issuing
results. When the number of elements in a vector is very small, perhaps two or three
elements, it may be better to stop the vectorization of the loop by resetting the
VECTOR argument of the OPTIMIZE CCO or to unroll the short loop.

Example
DO 10 I = 1,100
C(I) = 0.0
DO 20 J = 1,2
20 C(I) = C(I) + A(J) * B(I,J)
10 CONTINUE

After unrolling the inner loop in this example, the statement vectorizes on the outer
loop, as follows:

DO 10 I = 1,100
C(I) = A(1) * B(I,1) + A(2) * B(I,2)
10 CONTINUE

3957 6053003 1917


Vectorization

If the short loop is nested inside other DO loops, you can reorder the loops to achieve
better performance.

Use Single Precision Variables


If single precision variables provide all the precision necessary, use them instead of
double precision. Since the ClearPath Enterprise Server has 48-bit words, it provides
additional precision over machines with 32-bit words.

Order Loops for Optimal Performance


The order in which nested DO loops are written can significantly impact execution
performance. The main goal to consider when ordering nested DO loops is to place
loops with longer iteration counts inside very short loops. FORTRAN77 does not
perform loop interchange as part of its automatic vectorization capabilities.

There is a start-up time for each vector operator before any results are available. If the
vectorized loop has only two or three elements, it may be faster to leave the loop
scalar. If the vectorized loop is nested within other longer loops, it may be possible to
rewrite the loop to permit vectorization on these longer loops.

Example
DO 10 I = 1,1000
DO 10 J = 1,3
10 A(J,I) = A(J,I) + B(J,I)

The inner loop contains only three iterations. The vectors generated by vectorizing this
inner loop contain only three elements, which is not an efficient use of the vector
operators. Reorder these loops to allow vectorization on the much longer outer loop.

DO 10 J = 1,3
DO 10 I = 1,1000
10 A(J,I) = A(J,I) + B(J,I)

Vectorization Results in Program Listings


To help determine which statements vectorized and as an aid to further vectorization,
FORTRAN77 prints vectorization messages in the source listing for each subroutine.
The information in the source is printed whenever a source listing is printed. The
special section after the source listing is printed when the V_REPORT compiler control
option is set for one or more lines with a vectorization result flag.

Vectorization Result Flags


The result of attempting to vectorize a statement is summarized in a single character
flag in column 30 of the program listing (the LIST CCO must be set for the statement).
If there is no character in column 30, no attempt was made to vectorize the
statement. The characters and their meanings are:

1918 3957 6053003


Vectorization

Characte Meaning
r
V Statement was completely vectorized with one or more vector
operators.
P Statement was partially vectorized with a combination of vector
operators and DO loops.
D Statement was not vectorized because it is in a cycle of
dependencies.
N Statement was not vectorized.
U Statement was not vectorized because of one or more
unvectorizable operators or data.
X Statement limits or prevents vectorization of loops in which it is
enclosed. If a DO loop cannot be vectorized because of such a
statement, this character also appears at the DO statement and none
of the loop's statements were considered for vectorization.
E A compiler error prevents vectorization of this statement. This letter
indicates that the compiler failed an internal check; the error should
be reported to Unisys.

Vectorization result flags generally appear on lines whose statements were


considered for vectorization; the absence of a flag indicates the statement was not a
candidate for vectorization. (The criteria for loop and statement vectorization are
explained in this section.) Flags such as 'X' and 'N' may also appear at a DO statement;
these indicate that vectorization was not considered for any of the loop's enclosed
statements.

The following sample program listing shows examples of the vectorization result
flags. Note that the listing was compressed and truncated to display the fields of
interest.

$ SET LIST OPTIMIZE V_REPORT 00000300


PROGRAM VECTORIZATION_RESULTS_PRINTOUT 00000400
00000500
COMMON // A, B 00000600
DIMENSION A(100), B(100), C(100), D(100) 00000700
DOUBLE PRECISION D_OF_R, D_OF_I 00000800
EQUIVALENCE (R, D_OF_R), (I, D_OF_I) 00000900
NAMELIST /A_NAMELIST/ A_NAMELIST_VAR 00001000
00001100
N = 100 00001200
00001300
! Mixed vectorized and not 00001400
00001500
DO 1 I = 1, N 00001600
V B(I) = A(I) + 1. 00001700
D WRITE *, B(I) 00001800
1 CONTINUE 00001900

3957 6053003 1919


Vectorization

00002000
DO 2 I = 1, N-1 00002100
V B(I+1) = A(I) + 1. 00002200
D B(I+1) = B(I) + 1. 00002300
V B(I) = A(I+1) + 1. 00002400
D B(I+1) = A(I+1) + 1. 00002500
2 CONTINUE 00002600
00002700
! OPTIMIZE CCO effects 00002800
00002900
$ SET OPTIMIZE (RESET NOALIAS) 00003000
DO 3 I = 1, N 00003100
D B(I) = A(I) + 1. 00003200
3 CONTINUE 00003300
$ SET OPTIMIZE (SET NOALIAS) 00003400
00003500
$ SET OPTIMIZE (RESET EXPRORDER) 00003600
DO 4 I = 1, N 00003700

N B(I) = A(I) + 1. 00003800


4 CONTINUE 00003900
$ SET OPTIMIZE (SET EXPRORDER) 00004000
00004100
! Unvectorizable DO loop headers 00004200
00004300
X DO 5 I = 1, N, 0 00004400
B(I) = A(I) + 1. 00004500
5 CONTINUE 00004600
00004700
X DO 6 R = 1, 100 00004800
B(R) = A(R) + 1. 00004900
6 CONTINUE 00005000
00005100
! Minimum vector lengths 00005200
00005300
N DO 7 I = 1, 3 00005400
B(I) = A(I) + 1. 00005500
7 CONTINUE 00005600
00005700
DO 8 I = 1, 5 00005800
V B(I) = A(I) + 1. 00005900
8 CONTINUE 00006000
00006100
DO 9 I = 1, 5 00006200
N B(I) = A(I) + B(I)**2 00006300
9 CONTINUE 00006400
00006500
DO 10 I = 1, 6 00006600
V B(I) = A(I) + B(I)**2 00006700

1920 3957 6053003


Vectorization

10 CONTINUE 00006800
00006900
! Vectorizable? recurrences 00007000
00007100
DO 11 I = 1, N 00007200
V R = R + A(I) 00007300
11 CONTINUE 00007400
00007500
DO 12 I = 1, N 00007600
N R = D_OF_R + A(I) 00007700
12 CONTINUE 00007800
00007900
DO 13 I = 1, N 00008000
V R = R + I 00008100
13 CONTINUE 00008200
00008300

DO 14 I = 1, N 00008400
N R = R + D_OF_I 00008500
14 CONTINUE 00008600
00008700
! Loop killer statements 00008800
00008900
X DO 15 I = 1, N 00009000
X IF (I .EQ. 5) GOTO 99 00009100
B(I) = A(I) + 1. 00009200
15 CONTINUE 00009300
99 CONTINUE 00009400
00009500
X DO 16 I = 1, N 00009600
X DEBUG PROGRAMDUMP 00009700
B(I) = A(I) + 1. 00009800
16 CONTINUE 00009900
00010000
X DO 17 I = 1, N 00010100
B(I) = A(I) + 1. 00010200
X WRITE A_NAMELIST 00010300
17 CONTINUE 00010400
00010500
X DO 18 I = 1, N 00010600
B(I) = A(I) + 1. 00010700
X I = 5 00010800
18 CONTINUE 00010900
00011000
! Calls can cause LCV assignments 00011100
00011200
DO 19 J = 1, N 00011300
X CALL KILLER (J) 00011400
DO 19 I = 1, N 00011500

3957 6053003 1921


Vectorization

V C(I) = D(I) + 1. 00011600


19 CONTINUE 00011700
00011800
DO 20 J = 1, N 00011900
X DO 20 I = 1, N 00012000
X CALL KILLER (I) 00012100
C(I) = D(I) + 1. 00012200
20 CONTINUE 00012300
00012400
DO 21 J = 1, N 00012500
DO 21 I = 1, N 00012600
D CALL KILLER ((I)) 00012700
V C(I) = D(I) + 1. 00012800
21 CONTINUE 00012900
00013000

! Partial Vectorization 00013100


00013200
DO 22 I = 1, N 00013300
U B(I) = SIN (A(I)) 00013400
22 CONTINUE 00013500
00013600
DO 23 I = 1, N 00013700
P B(I) = SIN (A(I) + 2.) 00013800
23 CONTINUE 00013900
00014000
DO 24 I = 1, N 00014100
U B(I) = SIN (A(I) + SIN (A(I))) 00014200
24 CONTINUE 00014300
00014400
END 00014500
SUBROUTINE KILLER (I) 00014600
WRITE *, I 00014700
END 00014800
00014900

Vectorization Report
Additional vectorization information may be printed by specifying the V_REPORT CCO.
For all statements with both V_REPORT and LIST set, additional information is printed
in a separate report section after the last line of the subroutine. The report is only
printed if at least one printed line has a nonblank vectorization result flag (in column
30).

There are two sections of the report. The first section gives more detail for each line
in the program listing with a vectorization result flag. The second section lists the
dependencies found or assumed by the compiler, effecting vectorization, between
statements with both V_REPORT and LIST set.

1922 3957 6053003


Vectorization

For every source program line printed with a vectorization result flag, a line is printed
in the first section. Each line begins with the sequence number of the flagged line (as
printed on the source printout line), followed by a colon, followed by an explanation
for the flag. Note that flagged source lines with a nonsequential series of 'sequence
numbers' can still be matched to lines in the report section because the order of flags
is maintained; that is, the fifth flag in the subroutine listing matches the fifth
explanation in the vectorization report for the subroutine.

The second section of the report is a list of dependencies that may have effected
vectorization. An entry is made of all such dependencies occurring between
statements that both have both V_REPORT and LIST set. There are four columns:
'From', 'To', 'Type', and 'Carried by'. These show: the statement from which the
dependency flows, the statement to which the dependency flows, the type of the
dependency ('flow', 'anti', 'output', 'I/O', and 'call'), and the variables, common blocks,
or equivalence groups which create the dependency. Flow, anti, and output
dependencies are described in this section. I/O and call dependencies are assumed
between I/O statements and between subprogram (subroutine or function) calls to
assure that such statements are executed in the original order to preserve their side
effects.

The variables named in the 'Carried by' column may be simple variables or array
names. If the dependency is carried by a common block or equivalence group, that
name appears first followed by the one or two variables involved in parentheses.
Compiler-supplied names start with a '.': unnamed common is called '.BLNK.', and
equivalence groups have names like '.EQ001'. If there is no name associated with the
dependency carrier, '.noname.' is printed.

For the first occurrence of the vectorization report only, explanations of the two
sections of the report itself are printed.

The following is an example of a vectorization report. The report applies to the


previous printout example; it would normally appear between the first END statement
and the first SUBROUTINE statement.

The printout was compressed and reformatted to display in this manual. Also, the
report explanations are not shown.

========================================================================

V E C T O R I Z A T I O N R E P O R T

00001700: Completely vectorized with 1 vector operator.


00001800: Statement is in a cycle of dependencies.
00002200: Completely vectorized with 1 vector operator.
00002300: Statement is in a cycle of dependencies.
00002400: Completely vectorized with 1 vector operator.
00002500: Statement is in a cycle of dependencies.
00003200: Statement is in a cycle of dependencies.
00003800: The EXPRORDER argument to the OPTIMIZE compiler control
option is reset for this statement.
00004400: Loop control variable is incremented by 0.

3957 6053003 1923


Vectorization

00004800: Loop control variable is not an integer variable.

00005400: Loops with 3 or fewer iterations are not vectorized.


00005900: Completely vectorized with 1 vector operator.
00006300: The number of vector operators which would be generated by
this statement compares unfavorably with the number of
iterations of its enclosing loop.
00006700: Completely vectorized with 2 vector operators.
00007300: Completely vectorized with 1 vector operator.
00007700: A partial or ambiguous recurrence variable reference (from
COMMON or EQUIVALENCE effects) prevents vectorization.
00008100: Completely vectorized with 1 vector operator.
00008500: A partial or ambiguous loop control variable reference (from
COMMON or EQUIVALENCE effects) prevents vectorization.
00009000: A control statement (other than logical IF, block IF, and DO)
prevents vectorization of its enclosing loop.
00009100: A control statement (other than logical IF, block IF, and DO)
prevents vectorization of its enclosing loop.
00009600: A DEBUG statement prevents vectorization of its enclosing
loop.
00009700: A DEBUG statement prevents vectorization of its enclosing
loop.
00010100: An I/O statement containing a NAMELIST prevents vectorization
of its enclosing loop.
00010300: An I/O statement containing a NAMELIST prevents vectorization
of its enclosing loop.
00010600: Loop control variable is, or could be, assigned.
00010800: Loop control variable is, or could be, assigned.
00011400: Loop control variable is, or could be, assigned.
00011600: Completely vectorized with 1 vector operator.
00012000: Loop control variable is, or could be, assigned.
00012100: Loop control variable is, or could be, assigned.
00012700: Statement is in a cycle of dependencies.
00012800: Completely vectorized with 1 vector operator.
00013400: No vectorizable expressions in this statement.
00013800: Partially vectorized with 1 scalar loop and 1 vector operator.
00014200: More than one scalar loop would have had to be created to
vectorize this statement.

From To Type Carried by


------- -------- ------ ----------
00001800 00001800 I/O
00001700 00001800 flow .BLNK. (B)
00002200 00002300 output .BLNK. (B)
00002200 00002300 flow .BLNK. (B)
00002200 00002400 output .BLNK. (B)
00002200 00002500 output .BLNK. (B)
00002300 00002300 flow .BLNK. (B)
00002300 00002400 output .BLNK. (B)

1924 3957 6053003


Vectorization

00002300 00002500 output .BLNK. (B)


00002300 00002400 anti .BLNK. (B)
00002500 00002300 flow .BLNK. (B)
00002500 00002400 output .BLNK. (B)
00003200 00003200 flow .BLNK. (B, A)
00012700 00012700 call
00012700 00012700 flow .BLNK.

========================================================================

Basic Linear Algebra Subprograms


The Basic Linear Algebra Subprograms (BLAS) were originally described by C.L.
Lawson, R.J. Hanson, D.R. Kincaid, and F.T. Krogh in the paper "Basic linear algebra
subprograms for Fortran usage", published in ACM Transactions on Mathematical
Software, 1979:5, pages 308-371.

When the OPTIMIZE option and its BLAS argument are both set and the TARGET of
the compile is an MCP/AS (Extended) machine, the compiler recognizes the following
BLAS as intrinsics and vector operators are emitted instead of a call on the
user-supplied subprogram.

The BLAS recognized when OPTIMIZE(BLAS) is set are ISET, SSET, DSET, ICOPY,
SCOPY, DCOPY, SSCAL, DSCAL, SVCAL, DVCAL, SADD, DADD, SSUB, DSUB, SAXPY,
DAXPY, SDOT, DDOT, DSDOT, SDSDOT, ISUM, SSUM, DSUM, SASUM, DASUM, IIMIN,
ISMIN, IDMIN, IIMAX, ISMAX, IDMAX, ISAMAX, and IDAMAX. In the discussion of each
of the BLAS, N is the number of elements of the vectors that are affected by the
subprogram, INCX is the increment value for the vector X, and INCY is the increment
value for the vector Y. If the increment value is positive, the elements of the vector
that are affected are: 1, 1+INC, 1+INC*2, 1+INC*3, ..., 1+INC*(N-1), where INC is the
increment. If the increment value is negative, the elements of the vector that are
affected are: 1-(N-1)*INC, 1-(N-2)*INC, ..., 1, where INC is the increment. If the number of
elements is zero, the subprogram returns without affecting any elements of the
vector and if the subprogram is a function, a zero is returned.

SET Subroutines
The SET subroutines set the specified locations of the vector X to the value of the
variable A, that is, X(I)=A where I is the indices of the specified locations of X.
FORTRAN77 recognizes the following SET subroutines:

ISET
SUBROUTINE ISET (N, A, X, INCX)
INTEGER N, A, X(1), INCX

SSET
SUBROUTINE SSET (N, A, X, INCX)
INTEGER N, INCX
REAL A, X(1)

3957 6053003 1925


Vectorization

DSET
SUBROUTINE DSET (N, A, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION A, X(1)

COPY Subroutines
The COPY subroutines copy the specified locations of the vector X to the specified
locations of the vector Y, that is, Y(I)=X(J) where I is the indices of the specified
locations of Y and J is the indices of the specified locations of X. FORTRAN77
recognizes the following COPY subroutines:

ICOPY
SUBROUTINE ICOPY (N, X, INCX, Y, INCY)
INTEGER N, X(1), INCX, Y(1), INCY

SCOPY
SUBROUTINE SCOPY (N, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL X(1), Y(1)

DCOPY
SUBROUTINE DCOPY (N, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
DOUBLE PRECISION X(1), Y(1)

SCAL Subroutines
The SCAL subroutines scale the specified locations of the vector X by the value of the
variable A, that is, X(I)=A*X(I) where I is the indices of the specified locations of X.
FORTRAN77 recognizes the following SCAL subroutines:

SSCAL
SUBROUTINE SSCAL (N, A, X, INCX)
INTEGER N, INCX
REAL A, X(1)

DSCAL
SUBROUTINE DSCAL (N, A, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION A, X(1)

1926 3957 6053003


Vectorization

VCAL Subroutines
The VCAL subroutines set the specified locations of the vector Y to the values
obtaining by scaling the specified locations of the vector X by the value of the variable
A, that is, Y(I)=A*X(J) where I is the indices of the specified locations of Y and J is the
indices of the specified locations of X. FORTRAN77 recognizes the following VCAL
subroutines:

SVCAL
SUBROUTINE SVCAL (N, A, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL A, X(1), Y(1)

DVCAL
SUBROUTINE DVCAL (N, A, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
DOUBLE PRECISION A, X(1), Y(1)

ADD Subroutines
The ADD subroutines add the variable A to the specified locations of the vector X, that
is, X(I)=X(I)+A where I is the indices of the specified locations of X. FORTRAN77
recognizes the following ADD subroutines:

SADD
SUBROUTINE SADD (N, A, X, INCX)
INTEGER N, INCX
REAL A, X(1)

DADD
SUBROUTINE DADD (N, A, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION A, X(1)

SUB Subroutines
The SUB subroutines subtract the specified locations of the vector X from the variable
A, that is, X(I)=A-X(I) where I is the indices of the specified locations of X. FORTRAN77
recognizes the following SUB subroutines:

SSUB
SUBROUTINE SSUB (N, A, X, INCX)
INTEGER N, INCX
REAL A, X(1)

3957 6053003 1927


Vectorization

DSUB
SUBROUTINE DSUB (N, A, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION A, X(1)

AXPY Subroutines
The AXPY subroutines set the specified locations of the vector Y to the values
obtaining by scaling the specified locations of the vector X by the value of the variable
A and adding that to the specified locations of the vector Y, that is, Y(I)=A*X(J)+Y(I)
where I is the indices of the specified locations of Y and J is the indices of the
specified locations of X. FORTRAN77 recognizes the following AXPY subroutines:

SAXPY
SUBROUTINE SAXPY (N, A, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL A, X(1), Y(1)

DAXPY
SUBROUTINE DAXPY (N, A, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
DOUBLE PRECISION A, X(1), Y(1)

DOT Functions
The DOT functions perform the inner product of the specified locations of the vector X
and the specified locations of the vector Y, that is, the summation of Y(I)*X(J) where I
is the indices of the specified locations of Y and J is the indices of the specified
locations of X. FORTRAN77 recognizes the following DOT functions:

SDOT
REAL FUNCTION SDOT (N, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL X(1), Y(1)

DDOT
DOUBLE PRECISION FUNCTION DDOT (N, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
DOUBLE PRECISION X(1), Y(1)

DSDOT Function
The DSDOT function performs the inner product of the specified locations of the
vector X and the specified locations of the vector Y using double precision arithmetic,
that is, the summation of DBLE(Y(I))*DBLE(X(J)) where I is the indices of the specified
locations of Y and J is the indices of the specified locations of X.

1928 3957 6053003


Vectorization

DSDOT
DOUBLE PRECISION FUNCTION DSDOT (N, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL X(1), Y(1)

SDSDOT Function
The SDSDOT function returns the sum of the variable A and the inner product of the
specified locations of the vector X and the specified locations of the vector Y (the
inner product is performed using double precision arithmetic), that is, A + the
summation of DBLE(Y(I))*DBLE(X(J)) where I is the indices of the specified locations of
Y and J is the indices of the specified locations of X.

SDSDOT
REAL FUNCTION SDSDOT (N, A, X, INCX, Y, INCY)
INTEGER N, INCX, INCY
REAL A, X(1), Y(1)

SUM Functions
The SUM functions return the sum of the specified locations of the vector X, that is,
the summation of X(I) where I is the indices of the specified locations of X.
FORTRAN77 recognizes the following SUM functions:

ISUM
INTEGER FUNCTION ISUM (N, X, INCX)
INTEGER N, X(1), INCX

SSUM
REAL FUNCTION SSUM (N, X, INCX)
INTEGER N, INCX
REAL X(1)

DSUM
DOUBLE PRECISION FUNCTION DSUM (N, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION X(1)

ASUM Functions
The ASUM functions return the sum of the absolute value of the specified locations of
the vector X, that is, the summation of ABS(X(I)) where I is the indices of the specified
locations of X. FORTRAN77 recognizes the following ASUM functions:

3957 6053003 1929


Vectorization

SASUM
REAL FUNCTION SASUM (N, X, INCX)
INTEGER N, INCX
REAL X(1)

DASUM
DOUBLE PRECISION FUNCTION DASUM (N, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION X(1)

MIN Index Functions


The MIN Index functions return the index of the minimum value of the specified
locations of the vector X, that is, the smallest value of I such that X(I) is the minimum
value of the specified locations of X. FORTRAN77 recognizes the following MIN Index
functions:

IIMIN
INTEGER FUNCTION IIMIN (N, X, INCX)
INTEGER N, X(1), INCX

ISMIN
INTEGER FUNCTION ISMIN (N, X, INCX)
INTEGER N, INCX
REAL X(1)

IDMIN
INTEGER FUNCTION IDMIN (N, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION X(1)

MAX Index Functions


The MAX Index functions return the index of the maximum value of the specified
locations of the vector X, that is, the smallest value of I such that X(I) is the maximum
value of the specified locations of X. FORTRAN77 recognizes the following MAX Index
functions:

IIMAX
INTEGER FUNCTION IIMAX (N, X, INCX)
INTEGER N, X(1), INCX

ISMAX
INTEGER FUNCTION ISMAX (N, X, INCX)
INTEGER N, INCX
REAL X(1)

1930 3957 6053003


Vectorization

IDMAX
INTEGER FUNCTION IDMAX (N, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION X(1)

AMAX Index Functions


The AMAX Index functions return the index of the maximum absolute value of the
specified locations of the vector X, that is, the smallest value of I such that ABS(X(I)) is
the maximum absolute value of the specified locations of X. FORTRAN77 recognizes
the following MAX Index functions:

ISAMAX
INTEGER FUNCTION ISAMAX (N, X, INCX)
INTEGER N, INCX
REAL X(1)

IDAMAX
INTEGER FUNCTION IDAMAX (N, X, INCX)
INTEGER N, INCX
DOUBLE PRECISION X(1)

3957 6053003 1931


Vectorization

1932 3957 6053003


Appendix A
Railroad Diagrams

Railroad diagrams graphically represent the syntax of software commands.

The railroad diagrams are traversed left to right or in the direction of arrowhead.
Adherence to the limits illustrated by bridges produces a syntactically valid statement.
Continuation from one line of a diagram to another is represented by a right arrow (>)
appearing at the end of the current line and the beginning of the next line. The
complete syntax diagram is terminated by a vertical bar (|).

Items contained in angle brackets (< >) are syntactic variables that are defined in the
manual or are information that the user is required to supply.

Uppercase items not enclosed in angle brackets must appear literally (or as
abbreviated).

Example
 /4\ , 

 A RAILROAD DIAGRAM CONSISTS OF  <bridges> #



$ <loops> (

$ <optional items> (



- <required items> 0


# AND IS TERMINATED BY A VERTICAL BAR OR PERCENT (

The following are some of the syntactically valid constructs that may be generated
from the preceding diagram:

A railroad diagram consists of <bridges> and is terminated by a vertical bar or


percent.
A railroad diagram consists of <optional items> and is terminated by a vertical bar
or percent.
A railroad diagram consists of <bridges>, <loops>, and is terminated by a vertical
bar or percent.
A railroad diagram consists of <optional items>, <required items>, <bridges>,
<loops> and is terminated by a vertical bar or percent.

3957 6053003 A1
Railroad Diagrams

Railroad Components
<required items>
No alternate path through the railroad diagram exists for required items or required
punctuation.

Example
 REQUIRED ITEM  . (

<optional items>
Items shown as a vertical list indicate that the user may make a choice of the items
specified. An empty path through the list allows the optional item to be absent.

Example
 REQUIRED ITEM (

$ <optional item 1> (



- <optional item 2> 0


The following valid constructs may be generated from the preceding diagram:
REQUIRED ITEM
REQUIRED ITEM <optional item 1>
REQUIRED ITEM <optional item 2>

<loops>
A loop is a recurrent path through a railroad diagram and has the following general
format:

  <bridges>  <return character> 



 <object of loop> (

Example
 /1\ , 

 <optional item 1> (



- <optional item 2> 0

The following are some of the valid constructs that may be generated from the
preceding diagram:

<optional item 1>


<optional item 2>,<optional item 1>
<optional item 2>,<optional item 2>

The loop must be traversed in the direction in which the arrowhead points; the limits
specified by the bridges cannot be exceeded.

A2 3957 6053003
Railroad Diagrams

<bridges>
A bridge illustrates the minimum or maximum number of times a path may be
traversed in a railroad diagram.

Two forms of bridges exist:

/n\ where n is an integer that specifies the maximum number of times that the
path may be traversed.
/n*\ where n is an integer that specifies the maximum number of times that the
path may be traversed. The asterisk indicates that the path must be
traversed at least once.
Example
 /2\ , 

 <optional item 1> (



-/2*\ <optional item 2> 0

The loop may be traversed a maximum of two times and the path for <optional item
2> must be traversed at least once but no more than twice.

The following are some of the valid constructs that may be generated from the
preceding diagram:

<optional item 1,<optional item 2>


<optional item 2>,<optional item 2>,<optional item 1>
<optional item 2>

3957 6053003 A3
Railroad Diagrams

A4 3957 6053003
Appendix B
Comparison of FORTRAN/FORTRAN77
Compilers for Unisys A Series
Systems

Source Input Format


Lines
1. An asterisk (*) may be used to designate a comment in FORTRAN77 in place of the
"C". In addition to percent (%), an exclamation point (!) may be used to indicate a
trailing comment.
2. FORTRAN77 restricts the number of continuation lines to 99. No restriction exists
in the old compiler.
3. The old compiler permits multiple statements to appear on a single line if the
statements are separated by a semicolon (;). FORTRAN77 does not permit this.

Statement Ordering
1. In FORTRAN77, data statements must follow specification statements. In the old
compiler data statements may be interspersed with specification statements if
subsequent specification statements do not affect the elements appearing in the
data statement (for example, attempting to change the type of a variable after
assigning an initial value to it).
2. In FORTRAN77, statement function statements must appear after specification
statements and before the first executable statement. In the old compiler the
statement function definition may appear anywhere, as long as it is not referenced
before it is defined.
3. In FORTRAN77, specification statements that specify the symbolic name of a
constant must precede the PARAMETER statement that defines the constant
name. Additionally, the PARAMETER statement must precede all statements using
symbolic names that are defined in the PARAMETER statement. Note that there is
no PARAMETER statement in the old compiler.

3957 6053003 B1
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

New Statements
Block IF ... ELSE IF ... ELSE ... END IF Statements
The IF-THEN-ELSE statement has been included in FORTRAN77. Each IF block must
end with an END IF statement, and branches into an IF block, ELSE IF block, or ELSE
block are prohibited. Otherwise, the IF-THEN-ELSE functions as it does in ALGOL.

INTRINSIC Statement
The INTRINSIC statement allows the passing of intrinsic functions as actual
arguments. A symbolic name must not appear in both an INTRINSIC statement and an
EXTERNAL statement in the same program unit.

PARAMETER Statement
The PARAMETER statement is used to associate a symbolic name with a constant.
Normal type rules apply. Only one assignment per symbolic name in a program unit is
permitted. No implicit or explicit type change is permitted to the symbolic name after
it has appeared in the PARAMETER statement.

PROGRAM Statement
The PROGRAM statement allows association of a symbolic name with the main
program. If the PROGRAM statement appears, it must be the first statement of the
main program. It cannot be the same as the name of an external procedure, block data
subprogram, local name or common block of the same executable program.

SAVE Statement
1. The SAVE statement prevents the specified entities from becoming undefined as
the result of execution of a RETURN or END statement in a subprogram. The
following items are affected by a SAVE statement: variables, arrays, common
block name (enclosed in slashes). A SAVE statement without a list specifies that all
allowed items in that program unit are to be SAVEd.
2. An individual element of a common block may not be specified in a SAVE
statement.

Format
Run-time Formatting
FORTRAN77 allows run time formats to be character variables, character arrays, and
character expressions, in addition to non-character arrays.

B2 3957 6053003
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

A Editing
When using the A edit descriptor with non-character list elements, FORTRAN77 allows
six characters to be stored in word for all non-character types, except INTEGER. For an
INTEGER, only the right-most four characters of the word may contain character data.
Old FORTRAN determined the number of characters per word from the CHARS
compiler control option, regardless of the data type of the list element.

B Editing
1. FORTRAN77 B editing is valid on input only for I, F, E, D, and G edit descriptors and
specifies the interpretation of embedded blanks for subsequent edit descriptors.
2. BN => Blanks are ignored, the input is right justified in its field. A field of all blanks
is interpreted as a zero.
3. BZ => All blanks in succeeding numeric fields are treated as zeros.

Colon Editing
Provides the facility to terminate format control on exhaustion of the input/output list.

G Editing
1. Old FORTRAN allows the G edit descriptor to be used with REAL, INTEGER, or
DOUBLE PRECISION list elements. FORTRAN77 extends this to incorporate
LOGICAL list elements.
2. With the LOGICAL list element (Gw.d) the field occupies w positions, and is edited
with an Lw edit descriptor.

Integer Editing
The I format descriptor is extended in FORTRAN77 to permit specification of a
minimum number of digits that are required to be displayed on output. The form is
Iw.m; the optional m applies to output only and specifies the required number of
digits. 'm' must be less than w. Unsigned output is always produced. If m is zero, and
the value of the data is zero then the field is unconditionally output as blanks.

L Editing
1. New permissible form: the left-most character of the first item may be preceded
by a '.' (for example, '.TRUE', '.TR').
2. The list item is now restricted to type LOGICAL on both input and output. Old
FORTRAN permitted list items of types other than LOGICAL.

Numeric Editing
The interpretation of non-leading blanks is determined by a combination of the "BLANK
=" specifier given when the file was connected, and the BZ or BN blank control in
effect, if any.

3957 6053003 B3
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Positional Editing
1. The TL and TR edit descriptors have been added to FORTRAN77. TL indicates a
skip to the left (backward) the specified number of characters before transmitting.
TR means skip forward.
2. There is no distinction between TRc and nX formats in FORTRAN77. In the old
compiler the X format acts as a TRc descriptor on input, but on output it BLANKS
the specified number of characters. Note that in the old compiler it does not just
skip.

S Editing
1. The S edit descriptor is an addition to FORTRAN77. It controls optional plus signs
in subsequent numeric output fields (I, F, D, E, G).
2. S => The compiler determines the use of the sign.
3. SP => All subsequent positions that may have an optional plus sign must have it.
4. SS => Inhibits the optional plus.

Unavailable Edit Descriptors


The following edit descriptors are not available in FORTRAN77: C, U, V.

Specification Statements
DIMENSION Statement
1. Dimensions of actual arrays may be specified by integer constant expressions.
The old compiler restricts dimension bound declarations to constants.
2. Arrays of type CHARACTER are allowed.

EQUIVALENCE Statement
1. In FORTRAN77, if array elements appear in EQUIVALENCE statements, the number
of subscript expressions must equal the number of declared dimensions.
2. CHARACTER entities may be EQUIVALENCed to CHARACTER entities only.
Although there was no character data type in the old language, the old compiler
does allow Hollerith data to be stored into any data type, and therefore to be
equivalent to numeric data types. The FORTRAN77 compiler enforces the
segregation of character and non-character data types in equivalence groups.

COMMON Statement
If a character array or character variable appears in a common block, then all entities in
that common block must be of type character.

B4 3957 6053003
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Type Statements
CHARACTER Type-statement
1. CHARACTER is a new data type intended to provide the capability to manipulate
character data.
2. The CHARACTER data type applies to arrays, variables and FUNCTION names
(including statement functions).
3. A length specification may specify the length (number of characters) of a character
variable, character array element, or a character function. If a length is not
specified, then the default length of 1 is applied. The length specification is an
integer constant expression; an asterisk (*) may be used if the entity is a dummy
argument or a function.
4. The character assignment statement allows assignment of character values.
Assignment into an entity of smaller size results in truncation from the right.
Assignment into an entity of larger size results in left justification with blank fill.
5. Character substrings are contiguous portions of character data and are made up of
character variables or character array elements.
6. Operations on character data include concatenation of character strings,
substrings, character variables, character array element references, character
constants, and character function references.
7. Character entities may be incorporated in EQUIVALENCE, COMMON, and DATA
statements. Character entities may be equivalent only to other character entities.
Similarly, if a character variable or character array is in a common block, then all of
the entities of the common block must be of type character.

IMPLICIT Statement
FORTRAN77 permits more than one IMPLICIT statement per program unit. The old
compiler allows only one.

EXTERNAL Statement
FORTRAN77 permits a block-data subprogram name to appear in an EXTERNAL
statement. The old compiler does not.

Control Statements
Assigned GO TO Statements
1. The variable representing the label must be defined via an ASSIGN statement in
the same program unit for the FORTRAN77 compiler. In the old compiler, the
ASSIGN could take place outside of the program unit in which the GO TO
appeared.
2. In the old compiler, the optional label list is used for documentation purposes only.
The FORTRAN77 compiler specifies that if the statement label list is present, only
statement labels contained in the label list may be assigned to the variable.

3957 6053003 B5
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

DO Statement
1. An optional comma is now permitted after the terminal statement label, for
example DO 10, I = 1,10.
2. In FORTRAN77, the DO variable may be double precision, with conversion
performed as required. The initial, terminal, and incremental arguments may be
double precision arithmetic expressions. The old compiler restricts the DO variable
and arguments to single precision.
3. In FORTRAN77, the iteration count is tested before execution of any statement
within the range of the DO-loop. Note that the range of the DO-loop is not
necessarily executed at least one time, as it is in the old compiler (the old compiler
performs incrementation processing at the end of the loop). The FORTRAN77
compiler initiates the old FORTRAN DO-loop code when the CONVERT option is
set.
4. The DO variable may not be explicitly redefined within the range of the DO in
FORTRAN77. The old compiler allowed the user to change the value of the
DO-variable within the loop, and for that to affect the number of times the loop
was executed.
5. Transfer of control into the range of the DO-loop is not permitted in FORTRAN77.
The old language allowed what was generally referred to as the "extended range
of the DO" in that the user could branch out of the DO, perform some work, and
then branch back into the DO. The FORTRAN77 compiler does not restrict this;
however, the results are undefined.

STOP Statement
A character constant may be substituted for the integer constant following the STOP
statement.

PAUSE Statement
A character constant may be substituted for the integer constant following the PAUSE
statement.

END Statement
1. An END statement may not be continued in FORTRAN77. In the old compiler an
END statement was treated like any other statement.
2. In FORTRAN77 no other statement may have an initial line that appears to be an
END statement. In the old compiler if the word "END" appears on an initial line,
followed by a continuation line consisting of an assignment to "END", no syntax
error is given.

DATA Statement
In FORTRAN77, the constant list may include names of constants.

B6 3957 6053003
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Subprograms
Block Data
1. In FORTRAN77, block data subprograms may have an optional symbolic name.
The old language does not permit named block data subprograms.
2. FORTRAN77 permits more than one block data subprogram to appear in an
executable program; however, there may only be one unnamed block data
subprogram per executable program. The old compiler permits more than one.
3. In FORTRAN77, the same named common block may not appear in more than one
block data subprogram. The old compiler permits this.

Entry
1. In FORTRAN77, an entry statement may not appear within the bounds of a block IF
or a DO statement. The old compiler permits an entry point to appear with a DO
statement.
2. Like normal functions, entry points are not required to have arguments in
FORTRAN77. An empty pair of parentheses is used to signify this case.
3. In FORTRAN77, a function or entry point may be of type character. There was no
character data type in the old language.
4. In a function, a variable name that is the same as an entry name may not precede
the appearance of that entry name in an entry statement. The old compiler permits
this.
5. In FORTRAN77, executable statements referencing dummy arguments may
appear only after definition of those dummy arguments; that is, a dummy
argument unique to an entry point may not appear in any statement prior to the
entry point (including statement function definitions). In the old compiler, dummy
arguments to entry points may appear at any point in the program unit. The main
use of this feature is in statement functions defined prior to the entry statement.
Note that this prohibits the use of unique entry point arguments unless the entry
point appears prior to the definition of the statement function.
6. In FORTRAN77, if a dummy argument appears in an executable statement, it is
valid to execute the statement only if the argument is a dummy argument of the
procedure name currently being referenced. In other words, the valid scope of the
dummy argument is the entry point through which the subprogram was entered.
The old compiler allows a reference to the "alien" argument and uses a (default)
value of zero for it.

Functions
1. Intrinsic Functions
a. Generic names have been added to FORTRAN77 to ease referencing intrinsic
functions. When a generic name is used in place of a specific name, the type
of the result returned is determined from the type of the arguments. If
multiple arguments are permitted, then all of the arguments must be of the
same type.

3957 6053003 B7
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

b. The following intrinsic functions have changed in FORTRAN77:


(1) CMPLX may have one or two arguments of the same type. In the old
compiler two arguments are required.
(2) ICHAR has been added (convert character to integer).
(3) CHAR has been added (convert integer to character).
(4) The specific name DINT has been added for truncation of double precision
arguments.
(5) The generic name ANINT (ANINT, DNINT) has been added for the
conversion to the nearest number. Likewise, NINT (NINT, IDNINT) has been
added for conversion to the nearest integer.
(6) The specific name DDIM has been added for the positive difference
between double precision arguments. DPROD returns the double precision
product of two real arguments.
(7) LEN has been added to return the length of a character entity, and INDEX
is added to locate the position of a substring within a string.
(8) The ARCSINE intrinsic name has been changed from ARSIN to ASIN;
ARCOS has been changed to ACOS.
c. A procedure that has the same name as an intrinsic is not recognized as an
external procedure unless it appears in an EXTERNAL statement in the
program unit in which it is being referenced. The old compiler will, in some
circumstances, use the external procedure instead of the intrinsic when there
is a name conflict.
2. Statement Functions
a. FORTRAN77 requires that statement function statements appear only
between the specification statements and the first executable statement. The
old compiler permits statement function statements to appear before any
specification statements, or anywhere within the executable statements, as
long as it is not referenced before it is declared.
b. As in the case of functions, the dummy argument list is now optional in
FORTRAN77 (the empty parentheses are required).
c. Statement function statements may be of type character in FORTRAN77.
3. External Functions
a. External functions need not have arguments in FORTRAN77. The dummy
argument list in this case consists of an empty pair of parentheses.
b. Character dummy arguments and character functions are allowed in
FORTRAN77.
c. In the old compiler, an alternate return is permitted to appear in a function
subprogram. This is not allowed in FORTRAN77.

B8 3957 6053003
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Subroutines
1. In FORTRAN77 an empty set of parentheses may be used in the specification and
calling statement if no arguments are specified.
2. Character dummy arguments are permitted in FORTRAN77.

Character Arguments
1. The length of actual character arguments must be equal to, or greater than, the
length of the dummy argument. Actual arguments are left justified, with truncation
performed as required.
2. The length restriction for character arrays applies to the entire array, not to each
array element. It is necessary only to ensure that the total size of the array is less
than or equal to the actual array.

Input/Output
Files
1. File designators from 0-99 are permitted in FORTRAN77. The old compiler did not
allow file 0.
2. In the old compiler file designators other than 5, 6, or 7 defaulted to tape. The
FORTRAN77 default for these files is disk.
3. In FORTRAN77, if a mnemonic appears in an attribute assignment clause it must
be in quotation marks or apostrophes.

Result Clauses
1. There is no specific "DATA" action specifier in FORTRAN77. The new "IOSTAT"
specifier handles this function.
2. What is referred to as the "result descriptor" in the old language is now handled by
means of an "IOSTAT" specifier. The system-specified information formerly
returned by "RESULT" is now transformed into a nonspecific integer result code.
The IOSTAT specifier may be used in all auxiliary I/O statements. The old compiler
restricts its use to READ and WRITE statements.
3. In FORTRAN77 error branches may be specified in all of the auxiliary I/O
statements. In the old compiler they are permitted only for READ and WRITE
statements.

I/O Statements
1. READ and WRITE
a. In FORTRAN77, the form "n=r", where n is the file designator, and r is the
record designator, is not permitted. The form where "=" is replaced by "'" is
permitted.
b. In FORTRAN77, the unit specifier for internal I/O may be of type character only.
The old compiler permitted the internal file to be a real or integer array.

3957 6053003 B9
Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

c. Only formatted I/O is permitted for an internal file in FORTRAN77. In the old
compiler unformatted I/O could be accomplished to an internal file (array).
d. Internal files in FORTRAN77 have different record properties than those in the
old language, since they contain different data types.
2. Auxiliary I/O Statements
a. In FORTRAN77, all pointer-valued attributes must be mapped to entities of
type character. The old compiler specified that these items map to real or
integer arrays. It also specified that attribute mnemonics appear in any valid
attribute assignment if they are enclosed in quotation marks.
b. In the FORTRAN77 FILE statement, all mnemonics must be enclosed in
quotation marks.
c. In general FORTRAN77 has added language-specific attributes to set and
extract file properties. The most significant of these is "BLANK", which is used
to control the significance of blank characters in numeric formatted input
fields.
d. There is no PURGE or LOCK statement in FORTRAN77. An equivalent of the
PURGE statement is CLOSE(<unit id>,STATUS="DELETE"). The equivalent of
LOCK is CLOSE(<unit id>,STATUS="KEEP").
e. FORTRAN77 specifies that an attempt to use a different title to open an
already opened file has the effect of closing the first file before the open
statement (that is, there has been no explicit close). This was not permitted in
the old compiler.
f. The BLANK attribute may be changed by means of an OPEN statement on a
file that is already in the open state. In the old compiler, a file that has already
been opened may not be opened.
g. FORTRAN77 permits an OPEN on an already open file if all of the file attributes
are the same as the attributes currently in effect. An OPEN of an already open
file in the old compiler is not permitted.
h. FORTRAN77 does not permit the "<file>=<rec>" form of file and record
specifier in the FIND statement.
i. In FORTRAN77, the default state of a file, if no CLOSE statement appears, is as
if a CLOSE with STATUS="KEEP" had been executed (unless SCRATCH was
specified when the file was opened). The old compiler will scratch the file.
j. In FORTRAN77, a backspace is permitted to position a file after the last record
if the prior operation was an Endfile. In the old compiler, a backspace after an
Endfile causes an end-of-file error.

Separate Compilation
FORTRAN77 has a generalized separate compilation facility. Any program unit may be
modified, added, deleted or moved.

B10 3957 6053003


Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Binding
Binding of FORTRAN77 programs is allowed only if the compiler control option
BINDINFO has been set. When AUTOBIND is set along with SEPARATE or LIBRARY, all
program units, including any main program, are treated as separate subprograms; the
host program must come from outside the source file.

Libraries
Libraries can be invoked and written in both FORTRAN 77 and old FORTRAN. In
FORTRAN77, the argument in the CALL FREEZE statement must appear in single or
double quotes.

Zip
The ZIP statement (independent process) is not available in FORTRAN77.

Compiler Control Statements


The following options are not available in FORTRAN77:

CHARS

GRAPH

INSTALLATION

MONITOR

NEWSEGMENT

NOBINDINFO

OPT

PRINTER

READER

SEGS

TIME

Compiler Files
1. The secondary input file in FORTRAN77 has been changed from TAPE to SOURCE.
2. The internal file name of the updated symbol file produced when both the NEW
and MERGE options are set is NEWSOURCE in FORTRAN77. The name is
NEWTAPE in the old compiler.

3957 6053003 B11


Comparison of FORTRAN/FORTRAN77 Compilers for Unisys A Series Systems

Optimization
The FORTRAN77 compiler performs extensive local (statement level) optimization by
default. There is a global optimization option, and the local optimization that is
performed is not under user control.

Debugging Aids
The syntax of the DEBUG statements differ from old FORTRAN. See Section 14 for the
FORTRAN77 syntax. FORTRAN77 supports debugging using the Test and Debug
System (TADS). Refer to Section 17 for more information on TADS.

B12 3957 6053003


Appendix C
Error Messages

The error messages contained in this appendix are normal compiler output messages
that occur when the FORTRAN77 compiler detects an error in program code. These
errors are listed in alphabetic order, with special characters, symbols, and numbers
preceding the usual alphabetic sequence.

$ INCLUDE NESTED DEEPER THAN <number> LEVELS.


An INCLUDE statement may be in included statements. It will cause new statements
to be included. However, there is a limit to how many sets of statements may be
included at one time. This limit is 5. All INCLUDE statements must be removed from
the fifth level INCLUDE.

'IMPLICIT NONE' MUST PRECEDE ALL OTHER SPECIFICATION


STATEMENTS.
The IMPLICIT NONE statement must precede all statements that define variables.

'IN LIBRARY' STATEMENT NOT PERMITTED HERE.


The IN LIBRARY statement must appear immediately after the declaration of an item.
It may not appear anywhere else.

<class>'<name>' APPEARS ON THE LEFT SIDE OF AN ASSIGNMENT


STATEMENT. THIS IS AN EXTENSION OF THE ANSI X3.9 -- 1978 FORTRAN
STANDARD.
Assignable intrinsic functions and assignable statement functions are extensions to
the ANSI standard.

<class> <name> AT <number> HAS BEEN INCORRECTLY REFERENCED BY


PROGRAM UNIT <name> AT <number>.
This message is a prefix for other messages that explain the reference in error.
Further explanation is available with that message.

<class>'<name>' CANNOT APPEAR ON THE LEFT SIDE OF AN


ASSIGNMENT STATEMENT.
Only the following may be assigned:

A variable, substring, or array element


The BITS, IBITS, or ISOL functions with a variable or array element as the first
argument

3957 6053003 C1
Error Messages

A statement function that expands to one of these


For more information on assignment statements and assignable functions, see Section
12 in this manual.

<class>'<name>' CANNOT APPEAR ON THE LEFT SIDE OF AN


ASSIGNMENT STATEMENT UNLESS THE FIRST ARGUMENT OF THE
INTRINSIC FUNCTION IS A VARIABLE OR SUBSCRIPTED VARIABLE.
An intrinsic function or a statement function expanded to an intrinsic function whose
first argument is not a variable or subscripted variable cannot appear on the left side
of an assignment.

<class> <name> PREVIOUSLY DECLARED AS <class>.


An attempt was made to declare the identifier in a way incompatible with its previous
use. This declaration cannot follow the previous definition.

<name> HAS A CLASS OF <class> AND THEREFORE CANNOT BE


SPECIFIED AS EXTERNAL.
Only subroutines, functions, and block data subprograms may be specified in an
EXTERNAL statement.

<name> HAS ALREADY BEEN SPECIFIED AS COMMON.


The item is already in a COMMON statement. An item can only appear in one
COMMON statement.

<name> IS A <class>, BUT MUST BE <class> IN THIS CONTEXT.


The identifier has previously been defined to be a specific class, but is then used
where a specific class of a different kind is required.

THE DUMMY ARGUMENT <name> IS NOT ALLOWED IN THIS CONTEXT.


The dummy argument for a subprogram identifies an item passed from the calling
program. It may not be defined in the subprogram in a way that might conflict with its
original definition. It may not appear in an EQUIVALENCE, PARAMETER, SAVE,
INTRINSIC, DATA, or COMMON statement, except as a common block name.

<name> IS AN UNDECLARED ARRAY OR A FUNCTION CALL APPEARS


OUT OF CONTEXT.
A subscripted item appears on the left side of an assignment, but is not defined as an
array and cannot be a statement function definition. If it is an array reference, correct
the declaration of the array. If it is a statement function definition, it must appear
before any executable statements and the name of the statement function must be
unique.

<name> IS NOT A RECOGNIZED INTRINSIC FUNCTION.


The name defined on an INTRINSIC statement must be a function name that is intrinsic
to the compiler. This name is not known. Refer to Section 12 in this manual for a list of
intrinsic routines.

C2 3957 6053003
Error Messages

<name> IS OF CLASS <class> AND MAY NOT BE GIVEN AN INITIAL


VALUE.
The identifier has already been defined with a class (for example, it is a function) that
cannot be assigned an initial value in a TYPE statement.

<name> IS OF TYPE <class>, WHICH IS NOT ALLOWED IN A COMMON


BLOCK.
Only variables and arrays are allowed in a COMMON statement.

<name> IS OF TYPE <type>, BUT MUST BE OF TYPE <type> IN THIS


CONTEXT.
The name has been previously defined to be of a different type. It cannot be used with
two different types.

<name> MUST BE A LIBRARY.


The IN LIBRARY statement must contain the library name that contains the reference.
Libraries are defined with the LIBRARY statement in a BLOCK GLOBALS subprogram.
For more information, see Section 18 in this manual.

<name> TAKES <number> ARGUMENTS, NOT <number>.


The subprogram must be called with the exact number of arguments with which it is
defined.

<name> USED AS A DUMMY ARGUMENT TO SUBPROGRAM (OR ENTRY)


<name> IS AN ADJUSTABLE ARRAY. THE <word> MUST BE IN COMMON
OR PASSED AS A DUMMY ARGUMENT TO THE SAME SUBPROGRAM (OR
ENTRY).
When an array bounds is determined by a variable, that variable must be an argument
to the subprogram that defines the array. It must be passed as either a dummy
argument or in COMMON.

<name> WAS PREVIOUSLY EXPORTED.


This item has already appeared on an EXPORT statement. It cannot be redefined.

<name> WAS PREVIOUSLY IMPORTED.


This item has already appeared on an IMPORT statement. It cannot be redefined.

<statement> NOT PERMITTED IN A MAIN PROGRAM.


The ENTRY and RETURN statements may only appear in subprograms. They have no
purpose in the main program.

<string> <word> HAS BEEN TRUNCATED. THE <number> LEFTMOST HEX


DIGITS WERE RETAINED.
A hexadecimal string represented a number too large for this use. The rightmost
characters are truncated.

3957 6053003 C3
Error Messages

<string> CONSTANTS MUST BE LESS THAN OR EQUAL TO <number>


CHARACTERS.
String constants may be up to 255 characters and hexadecimal constants may be up
to 24 characters.

<string> DECLARATION MUST OCCUR IN A BLOCK GLOBALS


SUBPROGRAM.
The EXPORT, IMPORT, and LIBRARY statements may only appear in a BLOCK
GLOBALS subprogram. For more information, see Section 18 in this manual.

<string> HAS ALREADY BEEN SET.


The parameter in the LIBRARY statement has already been specified. It cannot be
specified twice.

<string> IN THE PROGRAM UNIT <name> CONTAINS MORE THAN


<number> ITEMS, WHICH IS THE MAXIMUM NUMBER THAT TADS
SUPPORTS. THIS ONLY AFFECTS THE 'GROUPS' OPTION OF THE
'DISPLAY' COMMAND, WHICH DISPLAYS A MAXIMUM NUMBER OF
<number> ITEMS.
An EQUIVALENCE group or COMMON block contains more items than TADS can
handle in a DISPLAY group.

<string> IS AN EXTENSION OF THE ANSI X3.9 -- 1978 FORTRAN


STANDARD.
The ANSI option is set and the feature flagged is an extension to the standard.

<string> IS AN INVALID OBJECT CODE TARGET. CODE WILL BE


PRODUCED FOR TARGET 'ALL'.
The target machine specified on the TARGET compiler control option is not recognized
by the system or the compiler and MCP are of incompatible versions. For more
information on the TARGET compiler control option, see Section 17 in this manual.

<string> IS NOT A VALID LIBRARY ATTRIBUTE.


The valid attributes on a LIBRARY statement are TITLE, INTNAME, LIBACCESS,
FUNCTIONNAME, and LIBPARAMETER. The only valid attribute on an IN LIBRARY
statement is ACTUALNAME. For more information, see Section 18 in this manual.

<string> IS NOT A VALID MODIFIER TO THIS DEBUG STATEMENT.


An invalid clause has been used on a DEBUG statement. Valid clauses for DEBUG
DUMP are LABELS, FREQ, and VARS; for DEBUG MONITOR, VARS. For more
information on debugging, see Section 14 in this manual.

<string> IS NOT A VALID OPTION FOR AN INTERACTIVE COMPILE --


OPTION IGNORED.
Some options may not be used for an interactive compilation. They imply additional
processing will be performed that cannot be done for interactive compilations.

C4 3957 6053003
Error Messages

<string> IS NOT A VALID OPTION FOR DEBUG PROGRAMDUMP.


The option does not exist or is in the wrong format. Section 14 of this manual details
the available options.

<string> LIBRARY ATTRIBUTE MAY NOT BE CHANGED.


The LIBACCESS and INTNAME attributes of a library cannot be altered in a CHANGE
statement. They must be declared when the library is first declared in the BLOCK
GLOBALS routine. For more information, see Section 18 in this manual.

<string> PARAMETER, PARAMETER IGNORED.


A compiler control option was specified with an unknown parameter. Check the
parameter for correct spelling. For more information on compiler control options, see
Section 17 in this manual.

<string> PART OF COMPLEX CONSTANT CONVERTED FROM DOUBLE


PRECISION TO REAL.
The real and imaginary parts of complex constants are stored as numbers of type real.
Double precision numbers are converted to real.

<string> THAT CONTAINS THE <type> <class> <name> HAS BEEN MADE
INTO A LONG ARRAY BECAUSE IT WILL CAUSE AN ODD OFFSET THAT
WILL OVERLAP A SEGMENT BOUNDARY. IF THIS CAUSES A
PERFORMANCE PROBLEM, THE DATA AREA SHOULD BE REMAPPED TO
ELIMINATE THE ODD OFFSET.
A COMMON block or EQUIVALENCE area will span multiple segments when the item
named is added. The item is either DOUBLE PRECISION or COMPLEX and the second
word does not fit in the segment. The area is made LONG to contain the item. A single
precision item added before the item in error will start the item in a new segment.

<string>, WHICH HAS BEEN MADE INTO A LONG ARRAY, EXCEEDS THE
SYSTEM LIMIT OF 65535 WORDS FOR A LONG ARRAY. REMAP THE DATA
AREA TO ELIMINATE THE ODD OFFSET DESCRIBED ABOVE AND
RECOMPILE.
A previous message described that the data area (COMMON block or EQUIVALENCE
group) was made into a long array because a double precision variable caused an odd
offset that would overlap a segment boundary. To eliminate this error, the data area
must be remapped so that no double precision item whose first word is offset an odd
number of words from the beginning of the data area spans a segment boundary. (It is
sufficient to remap the area so that all double precision items are offset an even
number of words from the beginning of the data area.) Alternately, the data area may
be made smaller by assuring that all declarations of the data area consume less than
65536 words; possibly by splitting the data area into two or more areas.

<string>'S LIBRARY STATEMENT MUST PRECEDE ITS IMPORT


STATEMENT.
The library used in the IMPORT statement has not been defined. It must be defined in
a LIBRARY statement before it appears on an IMPORT statement.

3957 6053003 C5
Error Messages

<text> BOUND FOR <name> MUST BE INTEGER.


The upper and lower bounds for an array, if not variable, must be specified with
integer constants. A bounds for this array was either not an integer or not constant.

<text> HAS ALREADY BEEN SPECIFIED AS IMPLICIT.


A letter may only be specified once in an IMPLICIT statement. If two ranges overlap,
the first letter duplicated is indicated in this error message.

<text> STATEMENT IS IMPROPERLY NESTED.


The control statement has bad form. This may be because there was more than one
ELSE or END IF statement for an IF statement, there was no END IF statement for an
IF, a DO statement references a non-existent label, or multiple DO statements have
overlapping ranges.

<type> IS NOT A LEGAL TYPE FOR AN IF EXPRESSION.


An arithmetic IF of the form: IF( expression ) label,label,label was used with a
non-arithmetic expression. This form of the IF statement must use an arithmetic
expression.

<word> CANNOT APPEAR IN THE CONTEXT OF AN EXPRESSION.


The identifier cannot have a single value and so cannot be in an expression. For
example, an array identifier without a subscript cannot be in an expression.

<word> CANNOT BE NEGATED.


Only arithmetic types (real, integer, double, and complex) can be arithmetically
negated (with + or -). Logical negation is done with the .NOT. operator.

<word> HAS BEEN TRUNCATED. THE <number> LEFTMOST CHARACTERS


WERE RETAINED.
An arithmetic variable is limited in the number of characters it may contain. The
number is 4 for integer, 6 for real and logical, and 12 for double precision and complex
types. If the character string being assigned exceeds the number of characters the
variable may contain, the rightmost characters are truncated.

<word> IN AN ILLEGAL PRIMARY IN A CHARACTER EXPRESSION.


Only character type items may be concatenated.

<word> IS AN ILLEGAL PRIMARY IN A CHARACTER RELATIONAL


EXPRESSION.
The identifier is the wrong type (such as complex) for a character expression.

<word> IS AN ILLEGAL PRIMARY IN AN ARITHMETIC EXPRESSION.


The identifier does not have a numeric type. Only integer, real, double precision, and
complex are allowed in arithmetic expressions.

C6 3957 6053003
Error Messages

<word> IS AN ILLEGAL PRIMARY IN A LOGICAL EXPRESSION.


The identifier appears in a logical expression, but is not of type logical.

<word> IS AN ILLEGAL PRIMARY IN THIS ARITHMETIC RELATIONAL


EXPRESSION.
Arithmetic types (real, integer, double, and complex) may be compared only to
arithmetic types (with the exception of double to complex) and character types may
be compared only to character types. This comparison is between an arithmetic and a
character, a double and a complex, or with a logical type (logical types must use logical
operators).

<word> USED AS DUMMY ARGUMENT <number> OF PROCEDURE <name>


IS IN CONFLICT WITH A PREVIOUS USAGE.
The argument used differs from the way it was used earlier. Calls to subprograms
must be consistent in their use of arguments.

<word> USED AS DUMMY ARGUMENT <number> OF PROCEDURE <name>


IS IN CONFLICT WITH A PREVIOUS USAGE. IF THE DUMMY ARGUMENT IS
ALTERED BY THE PROCEDURE THEN THERE IS A POSSIBILITY THE
ACTUAL ARGUMENT COULD BE CORRUPTED.
The type of the dummy argument to the procedure does not match the type of the
actual argument. If the dummy argument is changed, the actual argument will be
changed to a value of the wrong type.

A CALL ON FREEZE CAN ONLY OCCUR IN THE MAIN PROGRAM.


Only a main program can call the FREEZE intrinsic. Subprograms cannot be made into
libraries, only complete programs. For more information on libraries, see Section 18 in
this manual.

A COMPILER ERROR AT LINE <number> BECAUSE OF AN UNEXPECTED


ERROR RETURN FROM AN ATTRIBUTE HANDLING CALL. RETURNED
ERROR NUMBER: <number>.
This error should be reported to Unisys. Please include the returned error number in
your description.

A COMPILER ERROR HAS PREVENTED THE USE OF SCALAR


OPTIMIZATION AFTER VECTOR OPTIMIZATION WAS COMPLETE. THE
EFFECT IS THE SAME AS IF THE "OPTIMIZE" COMPILER CONTROL OPTION,
SUBOPTION "LOOPS" WAS RESET FOR THE SUBROUTINE. PLEASE
CONTACT A UNISYS REPRESENTATIVE REGARDING THIS COMPILER
ERROR.
This is a compiler error that can only occur if both vectorization and loop optimization
are being performed. The error should be reported to Unisys.

3957 6053003 C7
Error Messages

A compiler resouce has been exhausted while attempting to vectorize


this loop. Vectorization will not be performed on this loop. To allow the
loop to be vectorized, reduce the complexity of the FORTRAN source or
contact Unisys to report the problem (reference # <number>).
A COMPLEX RELATION MAY ONLY USE .EQ. OR .NE.
Complex numbers may only be compared for equality or non-equality. Other
comparisons must be done on the real and imaginary parts separately.

A CONSTANT IS NOT PERMITTED TO APPEAR ON THE RIGHT SIDE OF


THIS ATTRIBUTE STATEMENT.
An INQUIRE statement retrieves the value of the file attribute and stores it in the
variable specified. Since a constant was specified it is impossible to store the value.

A CONTROL INFORMATION LIST MAY NOT CONTAIN BOTH A RECORD


AND END SPECIFIER.
The record specifier indicates that a specific record is to be read. If this record cannot
be found, an error is returned. There is no end of file when reading a specific record.

A control statement (other than logical if, block if, and do) prevents
vectorization of its enclosing loop.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

A DEBUG statement prevents vectorization of its enclosing loop.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

A DEFINED STATEMENT FUNCTION MAY HAVE NO MORE THAN


<number> ARGUMENTS.
When the DEFINEDSTMTFUN compiler control option is true, a statement function
cannot have more than 255 arguments.

A DIMENSION BOUND EXPRESSION MAY ONLY CONTAIN CONSTANTS,


SYMBOLIC NAMES OF CONSTANTS, AND SIMPLE VARIABLES OF TYPE
INTEGER. THE DECLARATION FOR <NAME> IS INVALID.
When an expression is used to define the bounds if an array, the expression must use
integer constants and variables. A bound must be an integer.

A DO VARIABLE MUST BE A SIMPLE VARIABLE OF TYPE INTEGER, REAL,


OR DOUBLE PRECISION.
The control variable in a DO statement is the wrong type. For more information, see
Section 7 in this manual.

C8 3957 6053003
Error Messages

A DOLLAR CARD THAT BEGINS WITH THE OPTION '<string>' IS ONLY


USED WHILE INCLUDING.
The COPYBEGIN and COPYEND compiler control options are only used while including
source with the INCLUDE option. They have no use elsewhere and are ignored. For
more information on these compiler control options, see Section 17 in this manual.

A DUMMY ARGUMENT MAY APPEAR ONCE IN THIS LIST.


A list of arguments for a subprogram defines a set of unique items. The same name
cannot appear twice in the argument list.

A FORMAT STATEMENT MUST END WITH A ")".


The last character in the FORMAT statement must be a matched right parenthesis.

A FREEZE STATEMENT IS NOT ALLOWED WHEN THE FREEZEANDGO


OPTION IS SET.
If the FREEZEANDGO compiler control option is set, the program is already frozen. A
call on the FREEZE intrinsic is not permitted.

A LABEL MUST BE A POSITIVE INTEGER CONSTANT NOT GREATER THAN


FIVE DIGITS.
The compiler expects a statement label, but the item specified is in the incorrect
format for a label.

A minor logic error in the compiler occurred while attempting to


vectorize this statement. Please contact Unisys regarding this error.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

A NON-HEXADECIMAL DIGIT WAS ENCOUNTERED IN THIS


HEXADECIMAL CONSTANT.
Hexadecimal constants use base 16. The 16 digits allowed are 0-9 and A-F (for 10-15).
A character other than 0-9,A-F was found in a hexadecimal constant.

A NON-ZERO INTEGER CONSTANT IS REQUIRED IN THIS CONTEXT.


The syntax requires a non-zero integer constant. This may be in a substring reference
on an EQUIVALENCE statement or in the exponent part of an edit specifier in a
FORMAT specification.

A partial or ambiguous loop control variable reference (from common or


equivalence effects) prevents vectorization.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

A partial or ambiguous recurrence variable reference (from common or


equivalence effects) prevents vectorization.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

3957 6053003 C9
Error Messages

A RECORD NUMBER IS NOT PERMITTED TO APPEAR WITH NAMELIST


FORMATTING.
NAMELIST formatting is designed to relate records with variables rather than with
record numbers. It is not available for use with record numbers. For more information
on NAMELIST formatting, see Section 10 in this manual.

A serious logic error in the compiler has occurred. Please contact


Unisys.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

A SOURCE FILE WITH 'SEPARATE', 'LIBRARY', OR 'AUTOBIND' SET MAY


NOT SET MAKEHOST, SEPCOMP, OR FULLSEPCOMP. THE MAKEHOST,
SEPCOMP, OR FULLSEPCOMP OPTION WILL BE IGNORED.
The SEPARATE, LIBRARY, or AUTOBIND options are incompatible with the separate
compilation facility. The options used for the separate compilation facility, MAKEHOST,
SEPCOMP, and FULLSEPCOMP will be ignored.

A SPECIFIER MAY ONLY APPEAR WITHOUT THE '<spec> =' PART AS THE
FIRST OR SECOND ITEM IN THE CONTROL INFORMATION LIST.
Items in the control information list may be specified by 'Spec = value' or by its
position in the list. The first position is reserved for the unit number and the second
position for the format specification. All other items must be specified with the 'Spec
= value' form to identify them.

A SPECIFIER OF TYPE <type> IS REQUIRED IN THIS CONTEXT -- THIS


SPECIFIER IS OF TYPE <type>.
The syntax requires a variable or expression of a particular type; the wrong type has
been specified.

A SYMBOLIC NAME OF A CONSTANT, WHEN USED AS A FORMAT


IDENTIFIER, MAY ONLY BE A CHARACTER CONSTANT EXPRESSION.
A constant defined in a PARAMETER statement and used in a FORMAT specification
as a character expression had no value other than a character value. Make sure the
value of the constant is appropriate for its use.

A UNIT OR COMPARE UNIT APPEARED THAT DID NOT HAVE A UNIT


NUMBER BETWEEN 0 AND 99; THAT UNIT WAS IGNORED.
The unit identifier for the TADS and STATISTICS option specify where their output is
sent. Valid unit identifiers are files with numbers from 0 to 99.

A UNIT OR COMPARE UNIT SPECIFICATION APPEARED MORE THAN


ONCE OR WAS NOT FIRST IN THE LIST OF PARAMETERS; THAT
SPECIFICATION WAS IGNORED.
The format of the STATISTICS option requires that the UNIT specification always be
the first parameter. For more information, see Section 17 in this manual.

C10 3957 6053003


Error Messages

A VALID UNIT SPECIFIER IS REQUIRED TO APPEAR IN THE CONTROL


INFORMATION LIST.
The unit specifier identifies the file to be referenced. It must be specified for this
input/output statement.

A VARIABLE LENGTH FOR TYPE <type> IS NOT ALLOWED.


A length specification of * (asterisk) may only be used for character items.

ACTUAL ARGUMENT #<number> FOR SUBROUTINE <name> MUST BE


<class>.
The actual argument passed to a subprogram must match the class of the dummy
argument defined. The argument used when calling the subprogram does not match.

ACTUAL ARGUMENT # <number> MAY NOT BE OF TYPE <type> <class>.


The argument for the intrinsic routine is incorrect. It does not match what is expected
for this routine. For more information on intrinsic routines, see Section 12 in this
manual.

ACTUAL ARGUMENT FOR SUBROUTINE <name> MUST BE <class> OR


<class>.
The actual argument passed to a subprogram must be compatible with the dummy
argument defined to the subprogram. The actual argument used when calling the
subprogram must be one of the two classes specified.

ACTUAL ARGUMENT FOR SUBROUTINE <name> MUST BE A LABEL


BECAUSE DUMMY ARGUMENT #<number> IS OF THE FORM '*'.
The asterisk (*) in a subroutine argument specifies an alternate return specifier. The
argument passed for the alternate return specifier is a label prefixed by the asterisk (*)
or ampersand (&) character; for example, *99.

ACTUAL ARGUMENTS OF TYPE CHARACTER CANNOT INVOLVE THE


CONCATENATION OF ELEMENTS OF STAR LENGTH.
Character expressions of variable length cannot be handled by the compiler as actual
arguments. The result would have a length unknown at compile time.

ACTUAL ARRAY DECLARATOR <name> CANNOT HAVE A STAR BOUND.


Only a dummy argument in a subprogram can have a variable length. This identifier is
not a dummy argument.

ALL SUBSTRING EXPRESSIONS MUST BE TYPE INTEGER. THIS IS TYPE


<type>.
Each substring specified a starting position and ending position. The positions must be
integer values.

3957 6053003 C11


Error Messages

ALTERNATE RETURNS ARE NOT PERMITTED FROM FUNCTIONS.


An integer number on the RETURN statement specifies which alternate return
argument has the label of the next statement to be executed. Only subroutines may
use alternate return specifiers. Function names appear as variables in the program and
are assigned the value of the function. It must return where it was called, an alternate
return is not allowed.

AN ASTERISK APPEARING IN A UNIT SPECIFIER INDICATES FORMATTED


SEQUENTIAL I/O. A FORMAT SPECIFIER IS REQUIRED AND A RECORD
NUMBER MAY NOT APPEAR.
The asterisk (*) specified for the unit specifier indicates unit 5 for input and unit 6 for
output. These units are predefined for formatted sequential I/O. They must have a
format and cannot have a record number (which indicates direct I/O).

AN ASTERISK IS NOT A VALID VALUE FOR THE SPECIFIER <string>.


The specifier (URGENT, IOSTAT, or SUBFILE) in a control information list of an
input/output statement must have a value; asterisk (*) cannot be used.

AN END SPECIFIER IS NOT PERMITTED TO APPEAR IN A WRITE


STATEMENT.
The end specifier in the control information list directs control when reading past the
end of the file. It has no use for writing records. An error occurs if an attempt is made
to write to a non-existent location.

AN ERROR WAS ENCOUNTERED WHILE READING THE 'HOST' FILE.


To do a separate compilation, an original compilation must be done with the
MAKEHOST option set. The code file produced is read during the separate
compilation. This file could not be read. Check the file and recompile with MAKEHOST
set if necessary.

AN EXPRESSION IS NOT PERMITTED TO APPEAR ON THE RIGHT SIDE OF


THIS ATTRIBUTE ASSIGNMENT.
An INQUIRE statement retrieves the value of the file attribute and stores it in the
variable specified. Since an expression was specified, it is impossible to store the
value.

AN EXPRESSION OF TYPE <type> IS NOT ALLOWED IN THIS CONTEXT.


The expressions used to control the loop must be of type integer, real, or double
precision.

AN I/O ERROR OCCURRED WHILE ATTEMPTING TO READ SEPCOMP


INFORMATION FROM THE CODE FILE -- COMPILATION ABORTED.
To do a separate compilation, an original compilation must be done with the
MAKEHOST option set. The code file produced is read during the separate
compilation. An I/O error occurred while trying to read this file. Check the file and
recompile with MAKEHOST set if necessary.

C12 3957 6053003


Error Messages

AN I/O LIST MAY NOT BE PRESENT WHEN NAMELIST FORMATTING IS


SPECIFIED.
The NAMELIST statement describes which variables are processed by the I/O
statement. No other variables may be specified. For more information on NAMELIST
formatting, see Section 10 in this manual.

An I/O statement containing a NAMELIST prevents vectorization of its


enclosing loop.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

AN IDENTIFIER USED FOR THE FORMAT MAY BE A VARIABLE OF TYPE


INTEGER OR CHARACTER, AN ARRAY OF ANY TYPE, OR THE SYMBOLIC
NAME OF A CONSTANT (PARAMETER) OF TYPE CHARACTER OR
INTEGER. <name> IS A <type> <class>.
The format for the I/O statement is contained in either a character string or in a
FORMAT statement. An integer identifier or constant identifies the statement label of
a FORMAT statement. A character string or array contains the format specification.

AN INTEGER CONSTANT EXPRESSION IS REQUIRED IN THIS CONTEXT.


The expression used to identify the subscript or substring in an EQUIVALENCE
statement must be an integer constant expression. To do the required storage
assignment, the expression must be known during compilation.

AN OPERAND OF TYPE <type> CANNOT BE RAISED TO A <type> POWER.


A double precision number cannot be raised to a complex power and a complex
number cannot be raised to a double precision power.

AN UNKNOWN FORMAT ERROR OCCURRED. THE ERROR NUMBER


RETURNED FROM THE ENCODER WAS <number>.
An error has occurred in a FORMAT specification. Although the FORMAT specification
is not correct, the compiler cannot specify the exact problem. A trouble report may be
submitted to Unisys for clarification.

ARGUMENT 1 MUST BE A CHARACTER CONSTANT OR BE OF TYPE REAL


OR INTEGER.
The first argument of the intrinsic routine is of the wrong type.

ARGUMENT 1 MUST BE A REAL OR INTEGER CONSTANT EXPRESSION.


The argument for the CTIME intrinsics specifies which value, of any one of a number
of system data values, is to be returned.

ARGUMENT 1 MUST BE A VARIABLE OR ARRAY ELEMENT OF TYPE


INTEGER OR REAL.
The argument for the fault handling routines is set to indicate whether or not the fault
has occurred. This indicator is an integer value and the argument must be integer or
real.

3957 6053003 C13


Error Messages

ARGUMENT 1 MUST BE OF TYPE LOGICAL, REAL, OR INTEGER.


This intrinsic routine may only be used for logical, real, and integer expressions.

ARGUMENT 1 MUST BE OF TYPE REAL, DOUBLE, INTEGER, COMPLEX, OR


LOGICAL.
The CHARS intrinsic converts an arithmetic expression to a character string. The first
argument must be an arithmetic expression.

ARGUMENT 3 MUST BE A POSITIVE INTEGER.


The third argument specifies the number of bits affected by the bit manipulation
routine. This number must be a positive integer.

ARGUMENT 4 MUST BE A VARIABLE OR ARRAY ELEMENT.


The destination of a bit move with the MVBITS intrinsic must be a variable or one
element of an array.

ARGUMENT 4 MUST BE OF TYPE LOGICAL, REAL, OR INTEGER.


The destination of a bit move with the MVBITS intrinsic must be a variable or one
element of an array.

ARGUMENTS 2 AND 3 MUST BE OF TYPE INTEGER.


The second and third arguments of an ISOL intrinsic represent a starting but position,
which is an integer from 47 to 0, and a length in number of bits from 0 to 48.

ARGUMENT # <number>, array to variable mismatch is an extension of


the ANSI X3.9 -- 1978 FORTRAN standard.
An actual argument in a subprogram reference is an array and is passed to a dummy
argument that is a variable. The first element of the array is passed. This is an
extension to the ANSI standard.

ARGUMENT #<number> CONVERTED FROM DOUBLE PRECISION TO REAL.


A constant with more significant digits than can be contained in a real item is assumed
to be double precision. When a number of this type is passed to a real argument some
precision is lost.

ARGUMENT # <number> FOR SUBROUTINE <name> IS IN CONFLICT WITH


A PREVIOUS USAGE. IF THIS ARGUMENT IS ALTERED BY THE
SUBROUTINE, THEN THERE IS A POSSIBILITY THE ACTUAL ARGUMENT
COULD BE CORRUPTED.
The subroutine was previously called with a different type for this argument. If the
subroutine changes the value of the argument, the wrong type of value may be used.

ARGUMENT #<number> FOR SUBROUTINE <name> RESTRICTED TO TYPE


<type>.
The actual argument passed to a subroutine must be compatible with the dummy
argument defined to the subprogram. The actual argument is of a different type than
the dummy argument.

C14 3957 6053003


Error Messages

ARGUMENT #<number> OF IMPORTED SUBPROGRAM <name> IS


AMBIGUOUS. THE ARGUMENT TYPE WILL BE FIXED AS ARRAY.
The dummy argument list was not defined for the imported subprogram. Because it is
referenced with an array argument, it is assumed that the dummy argument should be
an array. This warning states that this assumption has been made. A more explicit
definition of the subprogram dummy argument list may be made with the IN LIBRARY
statement. For more information, see Section 18 in this manual.

ARGUMENT # <number>, <type> TO <type> MISMATCH, CORRUPTION


COULD RESULT.
The actual argument is of type integer and the dummy argument is of type real. If the
dummy argument is changed in the subroutine, the real value will be passed back to
the calling program, which will reference the value as an integer. Treating a real value
as an integer could result in corruption.

ARGUMENT # <number> TO <name> AT <string>, ARRAY TO VARIABLE


MISMATCH IS AN EXTENSION OF THE ANSI X3.9 -- 1978 FORTRAN
STANDARD.
An actual argument in a subprogram reference is an array and is passed to a dummy
argument that is a variable. The first element of the array is passed. This is an
extension to the ANSI standard.

ARGUMENT FOR VALUE MUST BE A CHARACTER CONSTANT.


The VALUE intrinsic routine returns a numeric value corresponding to a file attribute
mnemonic. That mnemonic must be specified with a character constant.

ARGUMENT LIMIT EXCEEDED FOR DUMMY ARGUMENT SUBPROGRAM


<name>.
When a subprogram is passed as a dummy argument, the length of the argument list
it may have is limited. This limit has been exceeded. Reduce the number of arguments
used or use COMMON.

ARGUMENT NUMBER <number> OF THIS INTRINSIC FUNCTION MUST BE


IN THE RANGE OF <number> TO <number>.
The intrinsic functions that manipulate bits identify bits as 0 (rightmost) to 47
(leftmost) and can process up to 48 bits. The numbers that identify bits must be
appropriate. For more information on intrinsic functions, see Section 12 in this manual.

ARRAYS APPEARING IN A NAMELIST STATEMENT MUST BE OF


CONSTANT BOUNDS. <name> HAS VARIABLE BOUNDS.
An array with variable bounds may not be in a NAMELIST, declare the array with
constant bounds. Note also that dummy arguments may not appear in a NAMELIST.

ASSERT FAILED AT COMPILER SEQ = <number> WHILE PROCESSING :


<string>.
An internal consistency check failed while compiling. The compiler could not process
the source code. Simplifying the code may solve the problem. A trouble report may be
submitted to Unisys concerning the problem.

3957 6053003 C15


Error Messages

BAD CARD TYPE.


The input card is in a format unrecognizable by the compiler. The expected format is
described in Section 1 of this manual.

BINDER INPUT STATEMENTS AND BINDER CONTROL IMAGES ARE


IGNORED WHEN AUTOBIND IS SET.
Binder input statements are passed to the Binder program when the AUTOBIND
compiler control option is set. If it is not set, these statements are ignored. Set the
AUTOBIND option to pass these statements to the Binder. For more information on
the AUTOBIND compiler control option, see Section 17 in this manual.

BLOCK GLOBALS MUST APPEAR FIRST IN THE PROGRAM.


The BLOCK GLOBALS subprogram must precede all other source statements (other
than FILE statements).

BOTH THE INCLUDE IMAGE AND INCLUDED RECORDS WILL APPEAR IN


THE NEWSOURCE FILE.
This warning indicates that the actual INCLUDE option image and all records that it
brings in will both appear in the new source file. Both the NEW and INCLNEW options
have been set and there is a dollar sign in column 2 of the INCLUDE image.

CANNOT PRODUCE TADS INFORMATION BECAUSE OF LARGE SIZE OF


PROGRAM.
The TADS information produced for a program is stored in areas of memory whose
size cannot exceed that which can be processed by the machine. That size has been
exceeded.

CANNOT SAVE AN INDIVIDUAL COMMON ELEMENT, <name>.


The SAVE statement cannot retain the value of an individual item in a COMMON block,
the entire COMMON block must be SAVEd. Use SAVE /common-block-name/.

CHARACTER <name> EXCEEDS THE LIMIT OF <string> CHARACTERS.


The number of characters that may be contained in one item is based on the type of
machine. That limit has been exceeded. Split the item between several character
items. See the description of the TYPE statement in Section 5 of this manual for
further information on the maximum length of a character variable.

CHARACTER LENGTH FOR <name> CONFLICTS WITH A PREVIOUS USAGE.


A function is defined as type character with a length that differs from that implied by
its use or definition where it is called.

CHARACTER LENGTH OF <name> FIXED AS <number>.


The item is a function that returns a fixed length character string. It cannot be
referenced with a different length than it was declared as having.

C16 3957 6053003


Error Messages

CHARACTER STRING IS TOO LONG FOR VARIABLE TYPE. INTEGER, REAL,


AND DOUBLE PRECISION VARIABLES CAN ONLY COMPARE TO STRINGS
THAT ARE A MAXIMUM OF 4, 6, AND 12 CHARACTERS LONG,
RESPECTIVELY.
A numeric variable is being compared to a character string. The length of the string
must be less than or equal to the number of characters that can be contained in the
numeric variable. That number is 4 for an integer, 6 for a real, and 12 for a double
precision variable.

CHARACTER STRINGS CANNOT HAVE A LENGTH OF ZERO.


A character string that contains no characters cannot be used.

CHARACTERS LOST CONVERTING TO STANDARD FORM.


Input is entered in free-form format and information is lost. Only 66 characters may be
entered on a line. Reduce the number of characters entered on the line.

CLASS OF <name> FIXED AS <class>.


The variable already exists. It has previously been defined for a different use.

CLASS OF <name> IS <class>, WHICH IS NOT ALLOWED IN THIS


CONTEXT.
The identifier has previously been defined for a use that is inconsistent with this
context. This class of item cannot be used in this statement.

CLASS OF <string> MUST BE <class>.


The identifier is used where a specific class is required; however, it has not been
defined to be that class.

CODE.AREASIZE TOO SMALL FOR PROGRAM.


An error occurred while writing the code file to disk. Try again with a larger
specification for areasize.

COMMA EXPECTED.
Two edit descriptors in the FORMAT specification were not separated by a comma.

COMMA EXPECTED.
A comma was expected in the TARGET.

COMMON ELEMENT <name> ILLEGAL IN THIS CONTEXT.


An item cannot be defined as both an argument to the routine and in a COMMON
statement. Either remove one of the references or use different names.

COMPILER ERROR (<number>).


An error has occurred in the internal processing of the compiler. This error may
disappear if the complexity of the program is reduced. A trouble report may be
submitted to Unisys to resolve the problem.

3957 6053003 C17


Error Messages

COMPILER ERROR -- BAD VOP (<number>) IN EXPR TREE.


An error has occurred in the internal processing of the compiler. An internal operator
appeared that is not defined. A trouble report may be submitted to Unisys to resolve
the problem.

Completely vectorized with <number> vector operator<text>.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

COMPLEX CONSTANTS CAN ONLY BE FORMED FROM INTEGER OR REAL


CONSTANTS.
The format for a complex constant is (constant, constant) where both constants are
integer or real. The first constant is the real part and the second constant is the
imaginary part. The complex constant specified contains values that are either not
integer or real, or not constants.

CONSTANT TOO LARGE <block>.


The maximum integer constant absolute value allowed is 549755813887.

DATA STATEMENTS MUST APPEAR AFTER THE SPECIFICATION


STATEMENTS.
All specification statements must appear before the first DATA statement. DATA
statements may appear anywhere after the specification statements.

DECIMAL FIELD NOT COMPATIBLE WITH FIELD WIDTH.


The number of digits to be in the fractional part of a FORMAT specification is larger
than the width of the field. The format uses w.d where w is the width for the entire
field and d is the number of decimal digits. The value for d must not exceed the value
for w.

DEFINED STATEMENT FUNCTIONS ARE AN EXTENSION TO THE ANSI


X3.9 -- 1978 FORTRAN STANDARD.
This message appears at the first statement function at which the compiler control
options DEFINEDSTMTFUN and ANSI are set. It warns that the program source is in
violation of the ANSI standard by using the defined statement function feature.

DISPLACEMENT TOO HIGH FOR CURRENT LEVEL.


A branch is being made to code that is beyond the range of the branch. Any branch
may only go to code within a certain (large) number of instructions. Reorder or
modularize the code to allow the branch.

C18 3957 6053003


Error Messages

DUE TO THE LARGE NUMBER OF DATA ITEMS IN THIS PROGRAM, THE


COMMON AND EQUIVALENCE GROUP INFORMATION HAS NOT BEEN
INCLUDED WITH THE TADS INFORMATION. ALL FEATURES OF TADS CAN
STILL BE USED EXCEPT FOR THE 'GROUPS' OPTION OF THE 'DISPLAY'
COMMAND.
The internal TADS tables are not large enough to handle the number of variables in the
program.

DUE TO THE NUMBER OF SIGNIFICANT DIGITS, SOME PRECISION MAY BE


LOST.
The machine can only process 11 digits for single precision and 23 digits for double
precision. If more digits than this are entered for a number, the least significant digits
are lost.

DUMMY ARGUMENT <name> IS NOT CALLBYREFERENCE DUE TO A


CONFLICT WITH THE OPTION VARIABLETOARRAY.
The options CALLBYREFERENCE and VARIABLETOARRAY cannot both apply to a given
dummy argument. For more details, see Section 17 in this manual.

DUMMY ARGUMENT <name> MAY NOT BE SPECIFIED AS <class>.


An attempt was made to define a dummy argument in a way inconsistent with its use
as an argument, for example, as a statement function. Use a different name for this
purpose.

DUMMY ARGUMENT <name> WAS PREVIOUSLY TYPED <type>, WHICH


CONFLICTS WITH THE PRESENT TYPING.
Once the type for a dummy argument is defined, it cannot be changed.

ELEMENTS OF <name> COMMON BLOCK MUST BE ALL OF CHARACTER


TYPE OR ALL NON-CHARACTER TYPE -- <name> VIOLATES THIS.
A common block must be all character items or all non-character items, they cannot
be mixed.

EMPTY EDITING SPECIFICATION.


A repeat count was not followed by an edit descriptor to be repeated. Add the
missing descriptor to the FORMAT specification.

EMPTY FILE.
An end-of-file was encountered when trying to read the file. Check the source file to
find where the records exist.

ENTRY STATEMENTS MAY NOT APPEAR WITHIN IF BLOCKS, ELSE


BLOCKS, ELSEIF BLOCKS, OR DO LOOPS.
An ENTRY statement allows control to begin with the statement immediately
following the entry. If this is inside a block, the correct conditions for the block have
not been established.

3957 6053003 C19


Error Messages

EQUAL SIGN REQUIRED FOR THIS COMPILER CONTROL IMAGE OPTION.


The correct format for the option is OPTION = Value. An appropriate value must be
used for the option.

EQUIVALENCED ARRAY <name> REQUIRES CONSTANT BOUNDS.


When an array is defined in an EQUIVALENCE statement, its upper bound and lower
bound (if any) must be constants, not expressions.

EQUIVALENCED ELEMENT <name> ILLEGAL IN THIS CONTEXT.


The item is being defined in a way that is incompatible with its previous definition in an
EQUIVALENCE statement.

EQUIVALENCE ITEM <name> IN THE EQUIVALENCE GROUP AT <string>


CAUSED COMMON TO BE EXTENDED BACKWARDS.
When an array element is equivalenced to an item in COMMON, the entire array is
entered in the common block. The item must appear in the common block such that
there is enough space for the elements in the array that appear before the
equivalenced item. For example, the first item in a common block cannot be
equivalenced to the second element of an array. The first element in the array could
not be brought into the common block.

ERROR IN HOLLERITH CHARACTER COUNT.


The character count in an H edit descriptor in a FORMAT specification is incorrect.
The count must be greater than 0 and no longer than the end of the FORMAT
specification.

EXCEEDS ANSI FORTRAN77 RESTRICTIONS FOR THIS EDIT PHRASE.


The edit descriptor in a FORMAT specification is an addition to the ANSI standard.

EXTERNAL <class> <name> HAS BEEN INCORRECTLY REFERENCED BY


PROGRAM UNIT <name> AT <number>:
An external item has been referenced in a manner inconsistent with previous
references. This message appears as a prefix, immediately followed by a more
detailed description of the error. This message only appears if the BINDINFO compiler
control option is set.

FILE ATTRIBUTES MAY ONLY BE ASSIGNED CONSTANT VALUES.


The file attribute set in the FILE statement may only be set to a constant value. Use
the CHANGE statement to dynamically set file attributes.

FILE STATEMENTS APPEARING OUTSIDE A BLOCK GLOBALS


SUBPROGRAM MUST NOT APPEAR WITHIN ANY PROGRAM UNIT AND
ANY BLOCK GLOBALS DECLARATION MUST PRECEDE ALL OTHER
PROGRAM UNITS: <name> DECLARED AT <number> VIOLATES THIS
RULE.
FILE statements must appear in specific locations when performing separate
compilations.

C20 3957 6053003


Error Messages

FILES CAN BE DECLARED ONLY OUTSIDE A PROGRAM UNIT OR AT


BEGINNING OF BLOCK GLOBALS BLOCK.
The FILE statement may only appear before any other statements, just after a BLOCK
GLOBALS statement, or just after an END statement.

FOR ARRAY <name> '*' BOUND MUST BE THE LAST SUBSCRIPT.


When an array has multiple dimensions and variable bounds, the variable bound must
be the last subscript in the definition.

FOR ARRAY <name> UPPER BOUND MUST BE GREATER THAN OR EQUAL


TO THE LOWER BOUND.
The value specified for the lower bound is larger than the value for the upper bound.
Arrays must go from a lower number to a larger number.

FOR STATEMENT FUNCTION <name> ACTUAL ARGUMENT NUMBER


<number> MUST BE OF TYPE <type>.
The actual argument used for the statement function is incorrect. It is of the wrong
type or class. Correct the argument or statement function definition.

FUNCTION <name> HAS A LABEL DUMMY ARGUMENT, WHICH IS NOT


ALLOWED.
An alternate return specifier, indicated by an asterisk (*) in the argument list, is not
allowed for functions. Only subroutines may have alternate return specifiers.

GLOBAL ITEM <name> may not appear as an element of a NAMELIST list


when SEPARATE is set.
The item cannot appear on a NAMELIST statement when the SEPARATE compiler
control option is set. NAMELIST processing cannot handle a global item defined in a
separately compiled file.

ID <name> MUST BE A COMMON BLOCK ID.


The identifier between the slashes is not a common block name. Variables and arrays
to be saved do not appear between slashes in a SAVE statement.

IDENTIFIERS ARE RESTRICTED TO <number> CHARACTERS; TRUNCATED


TO <name>.
Identifiers may only be a certain length. If they are longer, they are truncated. The
default for the length is 31 characters, but may be changed with the IDLEN compiler
control option.

ILLEGAL CONVERSION OF <word> TO TYPE <type>.


An assignment from an item or expression of one type to an item of an incompatible
type cannot be performed.

3957 6053003 C21


Error Messages

ILLEGAL FORMAT STATEMENT: CHARACTERS FOLLOW LAST MATCHED


RIGHT PARENTHESIS.
The FORMAT statement either has more right parentheses than left parentheses or
has characters after the last right parenthesis.

ILLEGAL SYNTAX IN FILE NAME ON $ INCLUDE CARD.


The file name on the INCLUDE compiler control option conforms to system syntax and
is enclosed in quotation marks (").

IMPLICIT RANGE FROM <text> TO <text> IS NOT IN CORRECT ORDER.


The range of letters in an IMPLICIT statement is from the lower letter to the higher
letter in alphabetical order. These letters were not in order. Note that '$' appears after
'Z'.

IMPLICIT SPECIFICATION CANNOT BE MORE THAN ONE CHARACTER.


The IMPLICIT statement allows types to be assigned to identifiers based on the first
letter of their names. Only the first letter applies, so only one letter may be specified
in the IMPLICIT statement. A range of letters is specified by letter - letter.

IMPLICIT STATEMENTS WITH A TYPE SPECIFICATION MUST PRECEDE ALL


OTHER STATEMENTS, EXCEPT PARAMETER STATEMENTS, AND CANNOT
BE USED WHEN AN 'IMPLICIT NONE' STATEMENT HAS ALREADY
APPEARED IN THE PROGRAM UNIT.
The IMPLICIT statement defines default types for variables and should appear at the
beginning of the program.

IMPLIED-DO LOOPS IN A DEBUG MONITOR STATEMENT ARE NOT


IMPLEMENTED YET, THE ENTIRE ARRAY WILL BE MONITORED.
The DEBUG MONITOR statement cannot handle implied-DO loops for arrays.

IN A SUBSTRING REFERENCE <class> <name> MUST BE TYPE


CHARACTER, BUT IS TYPE <type>.
Substrings may only be done on character identifiers.

IN PROGRAM UNIT '<name>' THE COMMON BLOCK '<name>' HAS NO


ELEMENTS ASSOCIATED WITH IT.
A common block was defined with no elements.

IN PROGRAM UNIT <name>, IN THE DATA STATEMENT STARTING AT


<sequence-number>, THE ENTRY <name> IS IN A COMMON BLOCK AND
MAY ONLY HAVE INITIAL VALUES ASSIGNED IN A MAIN PROGRAM OR A
BLOCK DATA SUBPROGRAM.
Items that are in common may only be initialized in the main program or a block data
subprogram. They may not appear on DATA statements in a subprogram.

C22 3957 6053003


Error Messages

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE IS AN ILLEGAL TYPE
CONVERSION (<name>).
The variable in the DATA statement is being given a value of the wrong type. Use the
correct type of constant for the variable.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE IS AN IMPLIED-DO CONTROL
EXPRESSION THAT COULD NOT BE EVALUATED (<name>).
The DATA statement uses an implied-DO that contains expressions that are not
constant or of the wrong type. The form of the implied-DO requires that each
expression resolve to an integer constant.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THE ENTRY <name> IS A DUMMY
ARGUMENT AND MAY NOT BE GIVEN AN INITIAL VALUE.
A dummy argument gets its value when the subprogram is called. It cannot be given
an initial value in a TYPE or DATA statement.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THE ENTRY <name> IS IN A COMMON
BLOCK AND MAY NOT HAVE INITIAL VALUES ASSIGNED WHEN BOTH
SEPARATE AND CODEFILEINIT ARE SET.
When the CODEFILEINIT compiler control option is set, items in COMMON retain their
values from previous compilations. When SEPARATE is set, each subprogram is a
separate compilation. If they are both set, it is impossible for the code to properly
initialize values in COMMON. For more information on the CODEFILEINIT and
SEPARATE compiler control options, see Section 17 in this manual.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <number>, THE LAST ARRAY WAS PADDED WITH ZEROS.
The CONVERT option was set and an array was initialized with fewer values than exist
in the array. In FORTRAN77, there must be a value for each item in the array. In old
FORTRAN, the array is padded with zeros.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE ARE TOO FEW CONSTANTS IN
THE VALUE LIST.
The constants in the TYPE or DATA statement are assigned in order of appearance to
the variables listed. There are more variables than constants, so some variables are
not assigned initial values.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE ARE TOO MANY CONSTANTS
IN THE VALUE LIST.
The constants in the TYPE or DATA statement are assigned in order of appearance to
the variables listed. There are more constants than variables, so some constants are
not assigned.

3957 6053003 C23


Error Messages

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE IS AN IMPLIED-DO LOOP
CONTROL EXPRESSION THAT IS NOT OF TYPE INTEGER (<name>).
Implied-DO loops on DATA statements must use integer variables and integer
expressions to specify the subscripts of the array. Use an integer variable for the
control variable.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE IS A LENGTH MISMATCH
BETWEEN A CHARACTER ENTITY (<name>) AND A HEXADECIMAL
STRING.
A hexadecimal string was used to initialize a character variable. Two digits in a
hexadecimal string comprise one character. The number of digits in the hexadecimal
string should be twice the number of characters.

IN PROGRAM UNIT <name>, IN THE INITIAL VALUE STATEMENT


STARTING AT <sequence-number>, THERE IS A SUBSTRING EXPRESSION
THAT COULD NOT BE EVALUATED AT COMPILE TIME (<name>).
Initial values are assigned to variables at the beginning of the program. They are
assigned from constants. Substrings that define initial value constants must be known
at the beginning of the program; only constants may be used in the substring
expression.

IN STATEMENT FUNCTION '<name>', ACTUAL ARGUMENT NUMBER


<number> MUST BE AN ARRAY NAME DECLARED WITH THE SAME TYPE
AND NUMBER OF DIMENSIONS AS THE CORRESPONDING DUMMY
ARGUMENT.
An actual argument of an invocation of a statement function whose declaration has an
array name in the same dummy argument position must be an array name that
matches the dummy1 argument's type and rank.

IN THE EQUIVALENCE GROUP AT <string>, <class> <name> IS AN ILLEGAL


ELEMENT.
Only variables and arrays may be used in EQUIVALENCE statements. For more
information, see Section 4 in this manual.

INPUT OR OUTPUT TO AN INTERNAL FILE MAY ONLY BE DONE USING


SEQUENTIAL ACCESS FORMATTED INPUT/OUTPUT. EITHER NO FORMAT
WAS SPECIFIED, LIST- DIRECTED FORMATTING WAS SPECIFIED, OR A
RECORD NUMBER WAS SPECIFIED.
Internal input/output occurs when formatted data is transferred to memory. There
must be a format specification and no record number exists.

INTEGER CONSTANT EXPECTED.


The field width and decimal specification (if any) in a FORMAT specification are integer
numbers. Only integer constants may be used.

C24 3957 6053003


Error Messages

INTEGER TOO LARGE -- TRUNCATED TO 65535.


The field widths and repeat specifications in a FORMAT specification are limited to
65535. Break the number into multiple specifications.

INTERNAL LIMIT EXCEEDED -- COMPILATION ABORTED; ARRAY, <text>


EXCEEDS MAXIMUM ARRAY SIZE.
An overflow has occurred on an internal data area. The compiler cannot handle the
number of data items required for the procedure. Try breaking the procedure into
multiple parts and recompiling.

INTERNAL LIMIT EXCEEDED -- COMPILATION ABORTED; INDEX FOR


ARRAY '<text>' IS <number> -- ARRAY WILL NOT BE RESIZED.
An overflow has occurred on an internal data area. No more items may be entered into
the area and it cannot be expanded. Try simplifying the program and recompiling.

INVALID BOOLEAN EXPRESSION USED TO SET OPTION. FALSE WILL BE


USED.
Only a Boolean option <option expression> may be used to set a <Boolean option>.
For more information on <option phrase>, see Section 17 in this manual.

INVALID ELEMENT IN FREQ PORTION OF A DEBUG DUMP STATEMENT.


The FREQ clause in the DEBUG DUMP statement may only contain a frequency
condition (an integer) or bounds condition (an integer variable with a range). The
format used is incorrect. For more information on debugging, see Section 14 in this
manual.

INVALID REPEAT FACTOR.


The repeat factor in a FORMAT specification is either too large (4095 is the maximum),
0, or repeats an item that cannot be repeated.

INVALID OPTION SETTING -- <string> -- COMPILER OPTIONS CAN ONLY


BE SET TO STATE OF ANOTHER COMPILER OPTION.
A compiler option that may only be set or reset cannot be given a different value. It
may only be set, reset, or set to the same state as another compiler option that may
only be set or reset. Check the value to which the option is being set.

INVALID SEQUENCE NUMBER SPECIFICATION ON $INCLUDE CARD, =


<number>.
The $INCLUDE option allows a range of lines to be included. The range is specified by
sequence numbers of the form: first to last. The sequence number is not specified in
sequence number format.

INVALID STRING.
The string used for the FORMAT specification cannot be understood. Refer to Section
9 of this manual for a description of FORMAT specification strings.

3957 6053003 C25


Error Messages

INVALID UNIT.
An invalid unit identifier is specified in the DEBUG DUMP statement. It must be a unit
number, variable name, or an asterisk.

LABEL ON A CONTINUATION CARD IS IGNORED.


Characters appearing before the continuation indicator are assumed to be the label.
The label cannot appear on a continuation line, it must be on the initial line being
continued.

LENGTH SPECIFICATION IGNORED. TYPE SPECIFICATION INTERPRETED


AS <type>.
The length specification applies to character types, although double precision may be
specified by using a length of 8 or 16. The length specification is otherwise ignored.

LIST DIRECTED I/O ('*' FORMAT) MAY NOT APPEAR WITH A RECORD
NUMBER.
A format specification must be used when writing a record to a specific location on
the file.

Loop control variable is incremented by 0.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

Loop control variable is not an integer variable.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

Loop control variable is or could be assigned.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

Loops with three or fewer iterations are not vectorized.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

MAXIMUM NUMBER OF LIBRARIES EXCEEDED.


Up to 24 libraries may be referenced from a single program.

MISSING DECIMAL PLACES IN FIELD WIDTH PART.


The edit descriptors F, E, G, and D in FORMAT specifications require that the number
of decimal digits to be displayed be included in the descriptor to the right of a decimal
point, for example, F6.2.

C26 3957 6053003


Error Messages

MISSING END STATEMENT.


A subprogram definition or the end of the source has been encountered without an
END to the previous program or subprogram. Insert the END statement in the
appropriate place.

MISSING ENDING QUOTATION MARK.


A character string was begun with an apostrophe (') or quotation mark ("), but there
was no matching closing apostrophe or quotation mark before the statement ended.
The closing character must be the same as the beginning character.

MISSING FIELD WIDTH PART.


An edit descriptor in a FORMAT specification did not have its required field width
integer. Specify the field width as part of the edit descriptor, for example, I6.

MISSING FIELD WIDTH PART OR IT WAS 0 IN T PHASE.


The edit descriptor in the FORMAT specification is missing the field width or uses 0 in
the T edit descriptor.

MISSING LEFT PARENTHESIS.


A left parenthesis was expected, but was not found.

MISSING RIGHT PARENTHESIS.


A right parentheses was expected, but was not found.

MONITORING FOR CHARACTERS IS NOT IMPLEMENTED YET, NO


MONITORING INFORMATION WILL BE PRODUCED FOR CHARACTERS IN
THIS STATEMENT.
The DEBUG MONITOR statement is not applicable to character strings.

More than one scalar loop would have to be created to vectorize this
statement.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

NAMELIST DECLARATIONS MUST PRECEDE STATEMENT FUNCTION


DECLARATIONS.
The NAMELIST statements must precede all statement function declarations.

NAMELIST FORMATTING IS NOT PERMITTED WITH INTERNAL I/O.


NAMELIST formatting directly relates physical records with variables. There are no
physical records with internal I/O so NAMELIST cannot be used. For more information
on NAMELIST formatting, see Section 10 in this manual.

3957 6053003 C27


Error Messages

NEITHER THE INCLUDE IMAGE NOR INCLUDED RECORDS WILL APPEAR IN


THE NEWSOURCE FILE AND 'MAKEHOST' IS SET.
Neither the actual INCLUDE option image nor the included records themselves will
appear in the new source file. The MAKEHOST and NEW options are set, the
INCLNEW option is reset, and there is no dollar sign in column 2 of the INCLUDE
image.

NO BINDER INFORMATION WILL BE GENERATED IF STATISTICS OR TADS


IS SET.
The BINDINFO compiler control option is ignored if the STATISTICS or TADS options
are set. Files compiled with TADS or STATISTICS may not be used by the Binder. For
more information on BINDINFO, see Section 17 in this manual.

NO EXECUTABLE STATEMENTS ARE ALLOWED WITH PROCEDURES THAT


ARE DECLARED TO BE IN LIBRARY.
Procedures that are declared to be IN LIBRARY are in another program. They cannot
be changed in this program. The END statement should follow the IN LIBRARY
statement.

NO EXPLICIT TYPE DECLARATION EXISTS FOR <name> AND 'IMPLICIT


NONE' WAS SPECIFIED FOR THIS PROGRAM.
If the IMPLICIT NONE statement is specified or the IMPLICIT NONE compiler control
option is set, all variables must be declared. This variable was not declared.

NO INITIAL CARD.
A continuation line was specified, but there is no preceding line to be continued. If
using free-form input (see the $FREE option), a continuation line begins with an
asterisk (*) or minus sign (-). Otherwise, a non-blank character other than zero (0) in
column 6 indicates a continuation line.

NO MAIN PROGRAM FOUND.


A main program is required unless one of the compiler control options SEPCOMP,
SEPARATE, or AUTOBIND is set.

NO RECORDS WERE INCLUDED.


The string <s> specified in the INCLUDE compiler control option could not be found in
a COPYBEGIN/COPYEND pair in the specified file <f>. Therefore, no records were
included from this INCLUDE compiler control option.

No vectorizable expressions in this statement.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

C28 3957 6053003


Error Messages

NO VALUE ASSIGNED TO LONGLIMIT -- OPTION IGNORED.


The value assigned to the LONGLIMIT compiler control option defines the maximum
length of the arrays before they must be segmented. This value must be numeric
between 256 and 65536. Note that the value in LONGLIMIT is used only if the LONG
option is set. For more information on LONGLIMIT, see Section 17 in this manual.

NON-BLANK CHARACTERS DELETED FROM FREE-FIELD CARD.


The number of characters on the input line not including the sequence number
exceeds 66. Enter only 66 characters per line.

NON-FORTRAN CHARACTER GRAPHIC: <text> DECIMAL VALUE:


<number>.
The input to the compiler contains a character that is not part of the FORTRAN
character set and is not recognized by the compiler. It should be removed and
replaced with the correct character, if any.

NOTHING MAY FOLLOW THE COMPILER OPTION '<string>' AND ITS


PARAMETERS -- CARD IGNORED.
This compiler control option affects the inclusion of source to be compiled. It must be
the only option on the card. For more information on compiler control options, see
Section 17 in this manual.

NUMBER OF ARGUMENTS EXCEEDS MAXIMUM OF 255.


The compiler imposes a maximum of 255 arguments for a subprogram. Use
COMMON or arrays to reduce the number of arguments for the subprogram.

NUMBER OF SUBSCRIPTS FOR ARRAY <name> EXCEEDS LIMIT <number>.


The number of subscripts for an array is limited to 31.

OBJECT CODE WILL BE PRODUCED FOR TARGET 'ALL'.


A previous error message explains why the TARGET compiler control option was
incorrect.

ONLY ARRAYS CONTAINING FEWER THAN 2**20 WORDS MAY BE CODE


FILE INITIALIZED. ARRAY '<name>' EXCEEDS THIS LIMIT AND WILL NOT
BE CODE FILE INITIALIZED.
All items in a data area that exceeds 2**20 words will not be code file initialized. For
more information on CODEFILEINIT, see Section 17 in this manual.

ONLY CHARACTER POOLS CONTAINING FEWER THAN 2**20 WORDS


MAY BE CODE FILE INITIALIZED. THE CHARACTER '<name>' IS IN A
CHARACTER POOL THAT EXCEEDS THIS LIMIT AND WILL NOT BE CODE
FILE INITIALIZED.
All items in a data area that exceeds 2**20 words will not be code file initialized. For
more information on CODEFILEINIT, see Section 17 in this manual.

3957 6053003 C29


Error Messages

ONLY COMMON BLOCKS CONTAINING FEWER THAN 2**20 WORDS MAY


BE CODE FILE INITIALIZED. ARRAY '<name>', WHICH IS IN COMMON
BLOCK '<name>', WILL NOT BE CODE FILE INITIALIZED SINCE THAT
COMMON BLOCK EXCEEDS THIS LIMIT.
All items in a data area that exceeds 2**20 words will not be code file initialized. For
more information on CODEFILEINIT, see Section 17 in this manual.

ONLY COMMON BLOCKS CONTAINING FEWER THAN 2**20 WORDS MAY


BE CODE FILE INITIALIZED. CHARACTER '<name>', WHICH IS IN COMMON
BLOCK '<name>', WILL NOT BE CODE FILE INITIALIZED SINCE THAT
COMMON BLOCK EXCEEDS THIS LIMIT.
All items in a data area that exceeds 2**20 words will not be code file initialized. For
more information on CODEFILEINIT, see Section 17 in this manual.

ONLY CONSTANTS, *, AND VARIABLES MAY APPEAR IN THE UNIT


PORTION OF A DEBUG STATEMENT.
The unit specified for the DEBUG MONITOR statement was not in a form understood
by the compiler. For more information on debugging, see Section 14 in this manual.

ONLY INTEGER CONSTANTS MAY BE USED IN THE LABELS PORTION OF


A DEBUG DUMP STATEMENT.
A dump will occur on the statements that have the labels specified in the LABELS
clause of the DEBUG DUMP statement. A label must be an integer constant. For more
information on the DEBUG statement, see Section 14 in this manual.

ONLY INTEGER VARIABLES AND INTEGER CONSTANTS MAY BE USED


FOR THE BOUNDS CONDITION IN THE FREQ PORTION OF A DUMP
STATEMENT.
The bounds condition specifies that a dump is done if the variable is within the bounds
listed. It may only be used with an integer variable and, therefore, integer bounds.
For more information on debugging, see Section 14 in this manual.

ONLY 'NONE' OR A TYPE SPECIFICATION IS PERMITTED WITH AN


IMPLICIT STATEMENT.
An IMPLICIT specifies that no variables are declared implicitly (NONE) or a type is
implicitly declared for all variables beginning with a specific letter. This IMPLICIT
statement specified neither NONE nor a type. For more information, see Section 4 in
this manual.

ONLY ONE '<string>' MODIFIER MAY APPEAR IN A DEBUG DUMP


STATEMENT.
The clause has already been specified, it cannot be specified twice on the same
statement. For more information on debugging, see Section 14 in this manual.

ONLY ONE ANONYMOUS BLOCK DATA SUBPROGRAM IS PERMITTED IN


AN EXECUTABLE PROGRAM.
BLOCK DATA subprograms have subprogram names. Only one BLOCK DATA
subprogram may omit the name, all others must have names.

C30 3957 6053003


Error Messages

ONLY ONE ANONYMOUS BLOCK DATA SUBPROGRAM IS PERMITTED IN


AN EXECUTABLE PROGRAM: THERE ARE DUPLICATES AT <number> AND
<number>.
BLOCK DATA subprograms have subprogram names. Only one BLOCK DATA
subprogram may omit the name, all others must have names. For more information,
see Section 13 in this manual.

ONLY ONE BLOCK GLOBALS SUBPROGRAM IS ALLOWED IN A PROGRAM.


The BLOCK GLOBALS subprogram is used for global declarations. It may appear only
once at the beginning of a program,

ONLY ONE BLOCK GLOBALS SUBPROGRAM IS ALLOWED IN A PROGRAM:


THERE ARE DUPLICATES AT <number> AND <number>.
The BLOCK GLOBALS subprogram must declare all globals and appear at the
beginning of the program. There cannot be more than one BLOCK GLOBALS
subprogram.

ONLY ONE FREEZE STATEMENT PER PROGRAM IS PERMITTED.


The program must call the FREEZE intrinsic from only one location in the main
program.

ONLY ONE MAIN PROGRAM IS PERMITTED IN AN EXECUTABLE


PROGRAM.
Only one main program is allowed. There may be a misplaced END statement in the
program.

ONLY ONE MAIN PROGRAM IS PERMITTED IN AN EXECUTABLE


PROGRAM: THERE ARE DUPLICATES AT <number> AND <number>.
Multiple PROGRAM statements have been entered or there is a misplaced END
statement. Only one main program is allowed.

ONLY ONE POSITIVE INTEGER CONSTANT MAY BE USED AS THE


FREQUENCY CONDITION IN THE FREQ PORTION OF THE DEBUG DUMP
STATEMENT.
The positive integer in the FREQ clause of the DEBUG DUMP statement specifies the
number of times the label is passed before the dump is produced. For more
information on debugging, see Section 14 in this manual.

ONLY THE FIRST '<string>' CONDITION IN THE FREQ PORTION OF A


DEBUG DUMP STATEMENT IS PROCESSED.
The FREQ clause in the DEBUG DUMP statement may specify one frequency condition
or one bounds condition or both. It cannot specify more than one frequency or bounds
condition. For more information on the DEBUG statement, see Section 14 in this
manual.

3957 6053003 C31


Error Messages

ONLY VARIABLES AND ARRAY NAMES MAY APPEAR IN THE VARS


PORTION OF A DEBUG DUMP STATEMENT.
This portion of the DEBUG DUMP statement controls which data items are to be
displayed. Only items that identify data storage may be specified. For more
information on debugging, see Section 14 in this manual.

ONLY VARIABLES AND ARRAYS MAY BE SPECIFIED IN THE VARS


PORTION OF A DEBUG STATEMENT.
This portion of the DEBUG statement controls which data items are to be displayed.
Only items that identify data storage may be specified. For more details on debugging,
see Section 14 in this manual.

OPEN ATTRIBUTE IS IGNORED IN OPEN STATEMENT.


The OPEN file attribute cannot be set in the OPEN statement. The action of the OPEN
statement itself will set the file attribute.

OPTIMIZE(VECTOR) WAS SET FOR ONE OR MORE DO LOOPS IN THIS


PROGRAM UNIT, BUT NOT ALL PROCESSORS SPECIFIED BY TARGET
SUPPORT THE VECTOR OPERATORS.
Vectorization is only performed if all the processors specified by the target support
the vector operators. The default value of target is installation defined. For more
information on the TARGET compiler control option, see Section 17 in this manual and
for more information on COMPILERTARGET, see the ClearPath Enterprise Servers
System Command Programming Reference Manual.

OPTIONAL CHARACTER LENGTH EXCEEDS THE LIMIT OF <string>


CHARACTERS.
The length of the character string exceeds the limit for this machine. See the
description of the TYPE statement in Section 5 of this manual for further information
on the maximum length of a character variable.

OPTIONAL COMMA IS NOT ALLOWED WITH A <type> DECLARATION.


A comma appears after the type declaration and before the first variable. This is only
allowed when a length has been specified with the type. Either specify the correct
length or remove the extra comma.

OPTIONAL LENGTH MUST BE A POSITIVE INTEGER CONSTANT


EXPRESSION.
The length specified in the Type statement must be an integer constant.

OVERLAPPING THE ARRAYS <name> AND <name> BY EQUIVALENCING


THEM HAS CREATED AN ARRAY THAT EXCEEDS THE MAXIMUM ARRAY
SIZE OF <string> CHARACTERS.
When elements from two separate arrays are equivalenced, a combined array is
formed such that the two elements occupy the same storage location. The combined
array exceeds the capacity of the machine. For more information on the maximum
length of a character item in a TYPE statement, see Section 4 in this manual.

C32 3957 6053003


Error Messages

OVERLAPPING THE ARRAYS <name> AND <name> BY EQUIVALENCING


THEM HAS CREATED AN ARRAY THAT EXCEEDS THE MAXIMUM ARRAY
SIZE OF <string> WORDS.
When different elements of two arrays are equivalenced, it forms one combined array
area such that the equivalenced elements map to the same location. In this case, the
combined array is larger than the machine can handle. For more information on array
size, see Section 2 in this manual.

PARAMETER <name> MUST BE ASSIGNED A CONSTANT VALUE.


The identifiers in a PARAMETER statement must be assigned constant expression. All
identifiers in the constant expression must have been previously defined in a
PARAMETER statement.

PARAMETER STATEMENTS MUST APPEAR BEFORE DATA, STATEMENT


FUNCTION, AND EXECUTABLE STATEMENTS.
The PARAMETER statement defining constants is in the wrong location in the
program.

Partially vectorized with one scalar loop and <number> vector


operator<text>.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

PROGRAM UNIT <name> AT <number> REFERENCES UNDECLARED


LIBRARY <name>.
A separate compilation attempted to reference an unknown library. Check the
definition of the library.

PROGRAM UNIT <name> CONTAINS AN INVALID ASSIGNMENT TO


FUNCTION <name>.
The value returned by a function can only be set inside the function. An attempt was
made to set the function value outside the function in the named program unit. Verify
the name used in the assignment and the definition of the function.

PROGRAM UNIT <name> CONTAINS AN INVALID REFERENCE TO


FUNCTION <name>.
The item was either defined or used as a function, but later used where a function
reference is illegal.

READ ONLY ATTRIBUTE -- CANNOT BE SET.


An attempt was made to change a file attribute with an OPEN or CHANGE statement
that cannot be changed. The attribute may only be read (with the INQUIRE statement).

REAL *<number> CONVERTED TO DOUBLE PRECISION.


Items of REAL*8 and REAL*16 are treated as double precision.

3957 6053003 C33


Error Messages

REMOTE FILE IN TADS OPTION NOT DECLARED GLOBALLY.


The remote file assigned in the TADS compiler control option could not be referenced.
For more information on the TADS compiler control option, see Section 17 in this
manual.

SAVED ITEM <name> MUST BE A VARIABLE OR ARRAY ID.


The identifier in the SAVE statement must be the name of a variable or an array.
Common block names can be SAVEd if specified with slashes (/name/).

SEQUENCE NUMBERS ARE OUT OF ORDER -- <number> IS LESS THAN OR


EQUAL TO <number> <string>.
The sequence numbers are not in order and the SEQERR, NEW, or MAKEHOST option
is set.

SHARING CAN ONLY HAVE VALUES -- PRIVATE, DONTCARE,


SHAREDBYALL, OR SHAREDBYRUNUNIT.
An unknown value was specified for the SHARING compiler option. For more
information on the SHARING option, see Section 17 in this manual.

SINCE A DEBUG DUMP STATEMENT WITHOUT A LABELS MODIFIER


ALREADY APPEARED IN THIS PROGRAM UNIT, NO ADDITIONAL DEBUG
DUMP STATEMENTS MAY APPEAR.
A label can appear on only one DEBUG DUMP statement. If no label is specified on a
DEBUG DUMP, it implies all labels are dumped. Because a DEBUG DUMP statement
without labels has already been specified, all labels implicitly appear on that
statement. No other DEBUG DUMP statements can appear because all labels are
already specified.

SINCE A DEBUG DUMP STATEMENT WITH LABELS ALREADY APPEARED


IN THIS PROGRAM UNIT, NO DEBUG DUMP STATEMENTS WITHOUT A
LABELS MODIFIER MAY APPEAR.
A label can appear on only one DEBUG DUMP statement. If no label is specified, on a
DEBUG DUMP, it implies all labels are dumped. Because a DEBUG DUMP statement
that specifies a label has already been specified, a DEBUG DUMP statement without
labels cannot appear. The label would be specified on two different DEBUG DUMP
statements.

SIZE OF ARRAY <name> EXCEEDS THE LIMIT ON THE SIZE OF DOUBLE


AND COMPLEX ARRAYS OF <string>.
The array of type DOUBLE PRECISION or COMPLEX is declared with more elements
than can be handled on this machine. For more information on array size limits, see
Section 2 in this manual.

SORT/MERGE ARGUMENT MUST BE A UNIT NUMBER OR EXTERNAL


SUBROUTINE.
The VALUE intrinsic routine returns a numeric value corresponding to file attribute
mnemonic. That mnemonic must be specified with a character constant.

C34 3957 6053003


Error Messages

SPECIFIED BIT RANGE NOT IN VALID RANGE (0-47).


There are 48 bits in one word, numbered from 0 to 47. The starting bit position plus
the number of bits would extend beyond 47.

STAR LENGTH FOR <name> IS INVALID IN THIS CONTEXT.


A character function passed as an argument to a subprogram cannot have a variable
length. The function should be defined with a constant character length.

STATEMENT FUNCTION DEFINITIONS MUST APPEAR AFTER


SPECIFICATION STATEMENTS AND BEFORE EXECUTABLE STATEMENTS.
Statement function definitions should appear immediately before any executable
statements. Note that if a subscripted item appears on the left hand side of an
assignment statement without having first been defined as an array, it will be defined
as a statement function definition.

Statement is in a cycle of dependencies.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

Statement is not an assignment to a variable or array element.


This message should only appear in a vectorization report (V_REPORT compiler control
option set).

STRING TOO LONG.


The string used for the FORMAT specification is too long to be processed by the
FORTRAN77 compiler.

SUBPROGRAMS COMPILED WITH THE 'SEPARATE' OPTION SET ARE NOT


ALLOWED TO EXPORT ITEMS. ONLY A HOST PROGRAM MAY USE
EXPORT STATEMENTS.
Subprograms compiled with the SEPARATE option will be bound with a host file. Only
the host file may export items for outside reference. For more information, see
Section 17 in this manual.

SUBPROGRAMS DECLARED 'IN LIBRARY' MUST PRECEDE SEPARATELY


COMPILED SUBPROGRAMS.
The compiler must know all items defined in libraries before it can produce separately
compiled subprograms.

THE <class> <name> MAY NOT BE TYPED <type>.


The subprogram has been previously defined in a type statement. It may not be
redefined as a different type.

THE <string> WAS DECLARED WITH <number> ARGUMENTS, BUT


<number> ACTUAL ARGUMENTS WERE SUPPLIED.
The number of actual arguments must be the same as the number of declared
arguments.

3957 6053003 C35


Error Messages

THE 'BINDINFO' OPTION WILL REMAIN SET WHEN SEPARATE, LIBRARY,


OR AUTOBIND IS SET.
The BINDINFO option is automatically set when the SEPARATE, LIBRARY, or
AUTOBIND options are set. It cannot be reset if these options are set.

THE 'FILE ' MUST APPEAR IN COLUMNS 1-6 OF A FILE STATEMENT.


To begin a file statement, the word FILE must begin in column 1 and be followed by
two spaces.

THE 'LIBRARY' OPTION WILL REMAIN SET WHEN SEPARATE IS SET AND
THE COMPLETION IS INITIATED THROUGH CANDE.
The LIBRARY option is automatically set when the SEPARATE option is set if the job is
initiated through CANDE. It cannot be reset if SEPARATE is set. When initiated through
CANDE, only one code file is produced and the LIBRARY and SEPARATE options
perform the same function. For more information on the LIBRARY and SEPARATE
compiler control options, see Section 17 in this manual.

THE 'SEPARATE' OPTION WILL REMAIN SET WHEN LIBRARY IS SET.


The SEPARATE option is automatically set when the LIBRARY option is set. It cannot
be reset if LIBRARY is set.

THE ABOVE NUMBER IS TOO BIG TO REPRESENT INTERNALLY; THE


UPPER BOUND IS APPROXIMATELY 1.9D29603.
The machine cannot handle numbers this large.

THE ABOVE NUMBER IS TOO BIG TO REPRESENT INTERNALLY AS A


SINGLE PRECISION NUMBER; THE UPPER BOUND IS APPROXIMATELY
4.3E68.
The machine cannot handle numbers this large in single precision. Use double
precision for numbers this large.

THE ARGUMENT TO THE <name> INTRINSIC IS NOT VALID.


The intrinsic is expecting the argument to have a value identifying the format of the
result. The argument must have one of a list of values to identify this format. For more
details on the intrinsic routine, see Section 12 in this manual.

THE ARGUMENT TO THE DATE INTRINSIC MUST BE A CHARACTER


CONSTANT.
The argument to the DATE intrinsic describes the format in which the date is returned.
The argument must be a character constant in a form recognized by the DATE
intrinsic. For more information on the DATE intrinsic, see Section 12 in this manual.

THE ARGUMENT TO THE RANDOM INTRINSIC MUST BE A VARIABLE OR


AN ARRAY ELEMENT.
The argument to the RANDOM intrinsic function is altered by the function. Therefore,
it must be a variable or array element.

C36 3957 6053003


Error Messages

THE ARRAY <name> IS NOT A DUMMY ARGUMENT AND THEREFORE


MUST HAVE CONSTANT BOUNDS. THE COMPILER WAS UNABLE TO
GENERATE THE BOUNDS EXPRESSION.
Only variables that are dummy arguments to the procedure may have variable bounds.
This array was not dummy argument.

THE ARRAY BOUNDS VARIABLE <name> HAS BEEN ASSUMED TO BE OF


TYPE INTEGER.
The variable used to define the bounds for the array must be of type integer; however,
this item is declared to be of type real. It has been changed to be of type integer.

THE ARRAY ID <name> MUST BE SUBSCRIPTED WHEN USED TO SPECIFY


A UNIT.
A UNIT is specified with an integer value, not an array.

THE ARRAY ID <name> MUST BE SUBSCRIPTED WHEN USED WITH THIS


SPECIFIER.
A file attribute has a single value, not an array of values. A unique variable must be
specified.

THE ATTRIBUTE '<name>' IS NOT PERMITTED IN A <statement>


STATEMENT.
The attribute specified has no meaning for this input/output statement.

THE ATTRIBUTE '<string>' IS NOT VALID.


The string is not a recognized file attribute.

THE ATTRIBUTE -- <string> -- HAS TOO MANY ARGUMENTS SPECIFIED.


The file attribute specified has more arguments than are allowed. Only one argument
is allowed. For more information on system file attributes, see the ClearPath
Enterprise Servers File Attributes Programming Reference Manual.

THE ATTRIBUTE -- <string> -- MAY NOT HAVE AN ARGUMENT SPECIFIED.


The file attribute specified is not allowed to have an argument. No further qualification
is allowed. For more information on system file attributes, see the ClearPath
Enterprise Servers File Attributes Programming Reference Manual.

THE ATTRIBUTE -- <string> -- MUST HAVE AN ARGUMENT SPECIFIED.


The file attribute must have an argument. The argument is necessary to define the
attribute. For more information on system file attributes, see the ClearPath Enterprise
Servers File Attributes Programming Reference Manual.

THE ATTRIBUTE'S ARGUMENT IS REQUIRED TO BE OF TYPE INTEGER -- IT


IS OF TYPE <type>.
The argument of an attribute specifies the subfile to which it is applied. The subfile is
specified by an integer number, it cannot be of any other type.

3957 6053003 C37


Error Messages

THE CHARACTER '<string>' IS AN ILLEGAL CHARACTER IN A USER


OPTION -- CHARACTER IGNORED, DELIMITER ASSUMED.
User compiler control option names may only contain letter, digit, or underscore
characters.

THE CHARACTER LENGTH SPECIFICATIONS OF ALL THE ENTRY POINTS


OF A FUNCTION MUST BE THE SAME AS THE FUNCTION NAME. SEE
<name>.
Each name used on an ENTRY must be defined to use the same specification as the
FUNCTION definition. If character, they must be the same length.

THE COMMON BLOCK ITEM <name> MAY NOT BE EQUIVALENCED TO


ANOTHER ITEM THAT INTERSECTS A COMMON BLOCK.
Two items in common blocks may not be made equivalent. The item cannot share
storage with another item that is in COMMON.

THE COMPILER CONTROL OPTION '<string>' MAY NOT BE SET, RESET, OR


POPPED -- OPTION IGNORED.
The specified compiler control option may not be changed.

THE COMPILER OPTION '<string>' MUST BE THE ONLY OPTION ON THE


CARD -- OPTION AND REMAINDER OF CARD IGNORED.
This compiler control option cannot appear with any other option. The effect on any
other option that appears on the card is undefined. For more information on compiler
control options, see Section 17 in this manual.

THE COMPILER CONTROL OPTION 'STATISTICS' MAY NOT BE USED


WHEN SEPARATE, LIBRARY, OR AUTOBIND IS SET. THE OPTION WILL BE
IGNORED.
STATISTICS will not operate for separately compiled or bound programs. The
STATISTICS compiler control option is ignored in these cases. For more information on
the STATISTICS compiler control option, see Section 17 in this manual.

THE COMPILER CONTROL OPTION 'TADS' MAY NOT BE USED WHEN


MAKEHOST, SEPCOMP, FULLSEPCOMP, SEPARATE, LIBRARY, OR
AUTOBIND IS SET. THE 'TADS' OPTION WILL BE IGNORED.
TADS will not operate for separately compiled or bound programs. The TADS compiler
control option is ignored in these cases. For more information on the TADS compiler
control option, see Section 17 in this manual.

THE COMPILER CONTROL OPTIONS 'XREF' AND 'XREFFILES' ARE


INCOMPATIBLE WITH THE 'SEPARATE' OPTION. NO CROSS REFERENCE
OR XREFFILES WILL BE GENERATED.
The XREF and XREFFILES compiler control options produce a cross reference for all
identifiers in the compiled program. This is incompatible with the SEPARATE option,
which compiles each subprogram separately.

C38 3957 6053003


Error Messages

THE COMPILER IS UNABLE TO PROCESS A NUMBER THAT HAS MORE


THAN 2000 SIGNIFICANT DIGITS.
The number contains too many digits for the compiler to process.

THE COMPILER LIMIT FOR LABELS THAT APPEAR IN ASSIGN


STATEMENTS : <number> HAS BEEN EXCEEDED.
Only 255 different labels can appear in ASSIGN statements in a program. Either use
subroutines or a different control structure for the program.

THE COMPILER OPTION '<string>' IS NOT A VALID OPTION -- OPTION


IGNORED.
The dollar card ($ in columns 1 or 2) specified an option that is unknown to the
compiler.

THE COMPILER OPTION '<string>' IS NOT VALID IN A COMPILE FOR


SYNTAX.
Option to be passed to the binder are not valid if compiling for syntax check only.

THE CONTROL VARIABLE <name> MAY NOT APPEAR AS AN INPUT ITEM


IN AN IMPLIED-DO.
The control variable controls the elements read in for input. It must not be altered on
the input statement. Use a different name for the control variable if it conflicts with
another variable.

THE COMPILER OPTION '<string>' MUST BE FOLLOWED BY A STRING --


RECORD IGNORED.
The INCLUDE, COPYBEGIN, and COPYEND options use character strings. If the
INCLUDE option requests including with the ( <string> ) format, for
COPYBEGIN/COPYEND inclusion, there must be a string in the parentheses. If the
COPYBEGIN or COPYEND option appear in the included source, they must specify a
string to distinguish which source is to be included. For more information on using the
INCLUDE, COPYBEGIN, and COPYEND options, see Section 17 in this manual.

THE COMPILER OPTION '<string>' MUST BE THE FIRST OPTION ON THE


CARD.
The TARGET option, language-specific options, and items to be passed to the binder
are items that must be the first option specified on the option card.

THE COMPILER OPTION '<string>' MUST PRECEDE THE FIRST SOURCE


IMAGE -- OPTION IGNORED.
Options that affect the entire source program must precede the first source image,
they should be put before the source.

3957 6053003 C39


Error Messages

THE DUMMY '<name>' IN THE STATEMENT FUNCTION '<name>' IS AN


ARRAY IDENTIFIER. THIS IS AN EXTENSION OF THE ANSI X3.9 -- 1978
FORTRAN STANDARD.
The use of an array identifier as an argument to a statement function is an extension
to the ANSI standard.

THE ENTRY <name> THAT IS DECLARED IN THIS SUBPROGRAM IS


ILLEGALLY USED AS A DUMMY ARGUMENT OF <name>.
If a subprogram is passed as an argument, it cannot be defined on an ENTRY
statement. Entries to a subroutine cannot be passed to that subroutine.

THE ENTRY POINT <string> HAS ALREADY BEEN DECLARED.


Duplicate entry points are not allowed.

THE EQUIVALENCE GROUP AT <string> THAT CONTAINS <type> <name>


MUST CONTAIN EITHER ALL CHARACTER OR ALL NON-CHARACTER
ELEMENTS.
A character item in an EQUIVALENCE statement may only share memory with another
character item. An attempt was made to share memory between items where at least
one was of type character and one was not.

THE EQUIVALENCE ITEM <name> WAS EQUIVALENCED TO ITSELF.


Two different elements of an array were defined to share the same storage location,
either directly or indirectly.

THE EQUIVALENCED ITEMS <name> AND <name> BOTH APPEAR IN A


COMMON BLOCK.
Two items that share memory locations cannot be defined to appear in separate
common areas. Only one item may appear in a common block. The equivalenced item
will be defined automatically in the same location.

The EXPORDER argument to the OPTIMIZE compiler control option is


reset for this statement.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

THE EXPRESSION TO BE ASSIGNED TO THE <text> FUNCTION MUST BE


OF TYPE REAL, INTEGER, OR LOGICAL. THIS EXPRESSION IS OF TYPE
<subclass>.
An assignable intrinsic function (ISOL, BITS, or IBITS) may only be assigned to a REAL,
INTEGER, or LOGICAL expression.

C40 3957 6053003


Error Messages

THE FAULT HANDLING INTRINSICS 'DVCK' AND 'OVERFL' CANNOT BE


USED WHEN BINDING IS DESIRED. THE COMPILER CONTROL OPTION
BINDINFO (INCLUDING SEPARATE, LIBRARY, AND AUTOBIND) MUST NOT
BE SET.
These intrinsic routines cannot be used with bound programs. If BINDINFO is set
either explicitly or implicitly, the routines cannot be used. For more information on
intrinsic routines, see Section 12 in this manual.

THE FORMAT LABEL <name> WAS REFERENCED IN AN INPUT/OUTPUT


STATEMENT, BUT NO LEGAL FORMAT STATEMENT WITH THIS LABEL
WAS FOUND IN THIS SUBPROGRAM.
There must be a FORMAT statement for every input/output statement that references
a format by label number.

THE FUNCTION NAME '<name>' IS ALSO AN INTRINSIC NAME. THE


INTRINSIC WILL BE USED UNLESS EACH PROGRAM UNIT THAT
REFERENCES THIS FUNCTION DECLARES IT IN AN EXTERNAL
STATEMENT: 'EXTERNAL <name>' <string>.
A function has been defined with the same name as an intrinsic routine. Either change
the name of the routine or define it in an EXTERNAL statement everywhere it is used.
For a list of intrinsic functions, see Section 12 in this manual.

THE HOST FILE IS INVALID FOR THIS RELEASE. PLEASE RECOMPILE IT


WITH THE OPTION 'MAKEHOST' SET IN ORDER TO USE THE SEPARATE
COMPILATION FACILITY.
The host file was compiled on an old or different version of the FORTRAN compiler.
Recompile it with the same version of the compiler for the separate compilation.

THE IDENTIFIER <name> MUST BE OF TYPE INTEGER; IT IS <type>.


Both the control variable and all identifiers in the expressions in the implied-DO
definition in a DATA statement must be integers.

THE IDENTIFIER <text> ALREADY APPEARED IN A DEBUG MONITOR


STATEMENT IN THIS PROGRAM UNIT.
The identifier is already being monitored.

THE IMPLIED-DO VARIABLE <name> MAY NOT REFER TO ITSELF WHEN


ESTABLISHING ITS VALUE.
The expressions used to define the starting value, ending value, and increment for an
implied-DO in a DATA statement cannot refer to the control variable being defined.
Use a different identifier for the control variable.

THE IMPORTED SUBPROGRAM <name> WAS NEVER REFERENCED AND


WILL NOT BE IMPORTED FROM LIBRARY <name>.
The subprogram was declared in an IMPORT statement, but was never referenced.
There is no need to import it.

3957 6053003 C41


Error Messages

THE INTEGER EXPRESSION USED TO DEFINE THE SUBSTRING CANNOT


BE AN ARRAY NAME.
This is an <integer array name>. Only an <integer expression> is allowed before or
after the ':' in a <substring name>.

THE INTRINSIC '<name>' MAY NOT BE USED AS AN ACTUAL ARGUMENT.


This intrinsic routine cannot be passed to a subprogram. The calling method for an
intrinsic routine can differ from that of standard subprograms. These routines cannot
be passed as arguments.

THE INTRINSIC <name> EXPECTS <number> ARGUMENTS.


The intrinsic function used expects a specific number of arguments. It was referenced
with more or less arguments than it expects. Refer to Section 12 in this manual for a
description of intrinsic functions.

THE INTRINSIC <name> EXPECTS AT LEAST <number> ARGUMENTS.


The intrinsic subprogram used can have a variable number of arguments. However, it
was referenced with a number of arguments that is illegal. Refer to Section 12 for a
description of intrinsic subprograms.

THE ITEM <name> OF CLASS <class> IN COMMON BLOCK <name> IS NOT


ALLOWED.
The item has been declared to be of a class that is not allowed in a COMMON block.
Only variables and arrays may be in COMMON. For more information, see Section 4 in
this manual.

THE ITEM OF CLASS <class> IS AN ILLEGAL ARGUMENT FOR A LIBRARY.


The item may not be passed as an argument to a library subroutine. It has already
been defined for another use.

THE LABEL <name> IS ALREADY IN A DEBUG DUMP STATEMENT IN THIS


PROGRAM UNIT.
Only one DEBUG DUMP statement is allowed for any one label. Either consolidate the
items on one statement or add a CONTINUE statement with a new label for the
second DEBUG DUMP.

THE LABEL <name> WAS DECLARED BEFORE BEING REFERENCED IN THE


DO STATEMENT.
The label specified in the DO statement has already been defined. The statements
repeated in the DO loop occur from the DO down to the statement with the label
specified in the DO statement. A DO loop cannot go upwards through the program.
Use a different label in the DO statement.

C42 3957 6053003


Error Messages

THE LABEL <name> WAS NOT FOUND IN THIS PROCEDURE IN THE


CONTEXT OF A LEGAL STATEMENT LABEL.
A label was used in the program, but was either never defined or defined on a
statement that cannot have a label. Either define the label or correct the reference to
the label in the DO or GO TO statement.

THE LENGTH OF THE USER OPTION '<string>' EXCEEDS THE LIMIT OF 31


CHARACTERS -- OPTION IGNORED.
User compiler control option names may contain no more than 31 characters.

THE LIMIT OF 768 USER COMPILER CONTROL OPTIONS HAS BEEN


EXCEEDED.
No more than 768 user compiler control options may be specified.

THE MIXING OF DOUBLE PRECISION ARGUMENT TYPES WITH OTHER


TYPES IN THIS INTRINSIC FUNCTION IS NOT ALLOWED.
These intrinsic routines accept multiple arguments. If one is of type double precision,
then they all must be of type double precision.

THE MODIFIER 'VARS' IS REQUIRED IN ALL DEBUG DUMP STATEMENTS.


The VARS clause is required to specify which items are to be displayed. For more
information on the DEBUG statement, see Section 14 in this manual.

THE NAMELIST NAME '<name>' HAS PREVIOUSLY BEEN DECLARED OR


HAS BEEN REFERENCED PRIOR TO THIS DECLARATION.
The NAMELIST name is unique, it cannot be used more than once.

THE NUMBER OF <syntactic item>S IN ALL <string>S AND EXPANDING


<string>S ARGUMENTS EXCEEDS <number>.
An internal compiler limit was exceeded. Most likely, the compiler could not recover
from a syntax error (the error may or may not have been reported). If the syntax of the
source is correct, contact Unisys about raising the compiler's limit.

THE NUMBER OF USER <string>S PLUS THE TOTAL NUMBER OF


ARGUMENTS TO <string>S CURRENTLY BEING EXPANDED EXCEEDS
<number>.
An internal compiler limit was exceeded. Most likely, the compiler could not recover
from a syntax error (the error may or may not have been reported). If the syntax of the
source is correct, contact Unisys about raising the compiler's limit.

The number of vector operators that would be generated by this


statement compares unfavorably with the number of iterations of its
enclosing loop.
This message should only appear in a vectorization report (V_REPORT compiler control
option set).

3957 6053003 C43


Error Messages

THE ONLY ATTRIBUTES ALLOWED FOR THE CLOSE STATEMENT ARE


UNIT, ERR, IOSTAT, AND STATUS.
A specifier appeared in the control information list that is not allowed for the CLOSE
statement. General attributes for files should be specified in the OPEN or FILE
statement.

THE ONLY ATTRIBUTES ALLOWED FOR THIS STATEMENT ARE UNIT, ERR,
AND IOSTAT.
A specifier appeared in the control information list that is not allowed for the
BACKSPACE, ENDFILE, REWIND, or FIND statement. General attributes for files should
be specified in the OPEN or FILE statement.

THE OPTIMIZING OPTION 'SEGMENT' MAY NOT BE USED WHEN


'SEPARATE' IS SET. SEGMENT HAS BEEN RESET.
The SEGMENT clause of the OPTIMIZE compiler control option and the SEPARATE
compiler control option are incompatible. The SEPARATE option ensures that
subprograms are separate and the SEGMENT optimization groups subprograms
together. Use one or the other. For more information on optimization, see Section 17 in
this manual.

THE OPTION '<string>' MUST NOT APPEAR IN THE INITIALCCI FILE --


OPTION IGNORED.
This compiler control option is not valid in an INITIALCCI file. Options not allowed in
the INITIALCCI file are those that would have an ambiguous meaning outside of a
source file:

DELETE, VOIDT, END, OMIT, PAGE, VOID, and INCLUDE

THE OPTION <string> MUST NOT APPEAR IN THE TASK ATTRIBUTE


TASKSTRING -- OPTION IGNORED.
This compiler control option is not valid in a TASKSTRING. Options not allowed in the
TASKSTRING are those that would have an ambiguous meaning outside of a source
file:

DELETE, VOIDT, END, OMIT, PAGE, and VOID

THE PROCEDURE NAME '<name>' HAS BEEN TRUNCATED TO 17


CHARACTERS TO FORM A CODE FILE TITLE.
If separate code files are to be produced, the code file names are taken from the
procedure names. The code file names are limited to 17 characters. For more
information on separate code files, see Section 17 in this manual.

THE PROCESSING OF THIS STATEMENT IS ABORTED.


The items specified in the control information list for the I/O statement cannot be
understood by the compiler. The statement is aborted. Please refer to Section 8 for an
explanation of valid I/O statements.

C44 3957 6053003


Error Messages

THE PROGRAM UNIT '<name>' IS BEING REFERENCED RECURSIVELY.


THIS IS AN EXTENSION OF THE ANSI X3.9 - 1978 FORTRAN STANDARD.
A subroutine or function that calls itself is an extension to the standard. This warning
only appears if the ANSI option is set.

THE REFERENCE TO ARRAY <name> CONTAINS TOO <text> SUBSCRIPTS.


The number of subscripts used when referencing the array has fewer or more
subscripts than specified when the array was defined.

THE REPEAT CONSTANT BEFORE THE '*' IN AN INITIAL VALUE LIST MUST
BE A NONZERO UNSIGNED INTEGER.
The number preceding the asterisk (*) indicates the number of times the value
following it is to be repeated. It must be an integer constant greater than zero.

THE SEPCOMP CAPABILITY IS NOT AVAILABLE FOR THIS CODE FILE. A


FULL COMPILATION WITH THE $CARD 'MAKEHOST' SET MUST BE DONE
BEFORE A SEPARATE COMPILATION IS ATTEMPTED -- COMPILATION
ABORTED.
To do a separate compilation, an original compilation must be done with the
MAKEHOST option set. The code file produced is read during the separate
compilation. This code file is not available. Check the file and recompile with
MAKEHOST set if necessary.

THE SEPCOMP CAPABILITY IS NOT AVAILABLE FOR THIS CODE FILE.


COMPILATION ABORTED.
The MAKEHOST file has already been bound into, a separate compilation cannot be
done on that file.

THE SIZE OF THE COMMON BLOCK <name> EXCEEDS THE LIMIT OF


<string> CHARACTERS.
The number of characters in the common block is more than the machine can handle.
For more information on the maximum length of a character item in a TYPE statement,
see Section 4 in this manual.

THE SIZE OF THE COMMON BLOCK <name> EXCEEDS THE LIMIT OF


<string> WORDS.
The common block is declared to have more elements than can be handled on the
target. A common block can contain as many elements as can be in an array. For more
information on array sizes, see Section 2 in this manual.

THE SPECIFICS OF THE IMPORTED FUNCTION <name> ARE NOT KNOWN;


IT IS ASSUMED TO HAVE NO ARGUMENTS.
The function was imported, but not referenced; the specifics of the argument are
unknown.

3957 6053003 C45


Error Messages

THE SPECIFICS OF THE IMPORTED SUBPROGRAM <name> ARE NOT


KNOWN; IT IS ASSUMED TO BE A SUBROUTINE WITH NO ARGUMENTS.
A subprogram was on an IMPORT statement, but was only referenced in EXTERNAL
statements. The details of the argument list cannot be found. It is assumed that there
are no arguments.

THE SPECIFIED UNIT IDENTIFIER, <number>, IS OUT OF RANGE. UNIT


IDENTIFIERS MUST BE BETWEEN 0 AND 99.
The unit identifier that identifies a file must be an integer between 0 and 99.

THE SPECIFIER '<string>' HAS ALREADY APPEARED IN THE CONTROL


LIST FOR THIS STATEMENT. THE ORIGINAL VALUE WAS USED.
A specifier in the control information list of an input/output statement should appear
only once.

THE STATEMENT FUNCTION DEFINITION <name> CONTAINED A


SUBSTRING; THIS IS NOT ALLOWED.
Substring operations are not allowed in statement functions. A statement function
definition is assumed if the item on the left side of the assignment has not previously
been defined.

THE STATISTICS OPTION, TRACE OPTION, AND DEBUG STATEMENTS


ARE IGNORED BECAUSE THE TADS OPTION HAS BEEN SET.
The TADS options takes priority over other forms of debugging aids. This includes
STATISTICS, TRACE, and DEBUG. These options are ignored if TADS is set and reset if
set when TADS is set.

THE STRING IN THIS COMPILER CONTROL IMAGE IS INVALID IN THIS


CONTEXT -- STRING IGNORED.
This compiler control image contains a quoted string that is not associated with a
compiler control option.

THE STRINGS OPTION MAY ONLY HAVE THE VALUE -- ASCII.


Setting the STRINGS compiler control option to ASCII is the same as setting the ASCII
option. STRINGS may only have the value ASCII. A return to EBCDIC may be done by
resetting ASCII. For more details on the ASCII option, see Section 17 in this manual.

THE SUBCLASS FOR <name> HAS BEEN EXPLICITLY OR IMPLICITLY FIXED


AS <type>.
The identifier already has a type. It has been defined previously in a specification
statement such as COMMON or EXTERNAL and the type was assigned at that time.

THE SUBPROGRAM <name> WAS NOT FOUND.


A subprogram was referenced but was not defined. This warning indicates that the
subprogram should be bound in.

C46 3957 6053003


Error Messages

THE SUBROUTINE NAME '<name>' IS ALSO AN INTRINSIC NAME. THE


INTRINSIC WILL BE USED UNLESS EACH PROGRAM UNIT THAT
REFERENCES THIS SUBROUTINE DECLARES IT IN AN EXTERNAL
STATEMENT: 'EXTERNAL <name>'<string>.
A subroutine has been defined with the same name as an intrinsic routine. Either
change the name of the routine or define it in an EXTERNAL statement everywhere it
is used. For a list of intrinsic subroutines, see Section 12 in this manual.

THE SUBSCRIPT EXPRESSION USED TO INDEX ARRAY <name> must be


an integer expression. <name> IS NOT INTEGER.
The subscript expression used to reference items in a DATA statement with an
implied-DO must be an integer. Use an integer variable for the control variable in the
implied-DO.

THE SYMBOLIC REPEAT CONSTANT <name>, BEFORE THE '*' IN THE


INITIAL VALUE LIST, MUST REPRESENT A NONZERO UNSIGNED INTEGER.
The value preceding the asterisk (*) indicates the number of times the value following
it is to be repeated. The symbolic constant must be an integer greater than zero.

THE TARGET OPTION MAY NOT BE SPECIFIED DURING A SEPARATE


COMPILATION.
A separate compilation is a continuation of previous code. The target machine for the
code cannot be changed. The TARGET option cannot be specified with the SEPCOMP
or FULLSEPCOMP options. For more information on the TARGET option and separate
compilation, see Section 17 in this manual.

THE TARGET OPTION MAY ONLY SPECIFIED ONCE.


The TARGET compiler control option has already been specified, it cannot be changed.

THE TARGET OPTION WAS NOT SPECIFIED. THE SYSTEM COMMAND


COMPILERTARGET IS NOT KNOWN TO THIS MCP
Usually this indicates a problem in the MCP. This error should be reported to Unisys
for correction.

THE TARGET VERSION OF THE MCP AND THE COMPILER DIFFER.


The version of the MCP on the system is different than the version of the compiler.
Differences in versions could cause unforeseen problems.

THE TOTAL NUMBER OF ALL <symbolic name>S IN ALL <string>S AND


EXPANDING <string> ARGUMENTS EXCEEDS <number>.
An internal compiler limit was exceeded. Most likely, the compiler could not recover
from a syntax error (the error may or may not have been reported). If the syntax of the
source is correct, contact Unisys about raising the compiler's limit.

3957 6053003 C47


Error Messages

THE TOTAL SIZE OF ALL <symbolic name>S IN ALL <string>S, <string>


NAMES GREATER THAN 6 CHARACTERS, AND EXPANDING <string>
ARGUMENTS EXCEEDS <number>.
An internal compiler limit was exceeded. Most likely, the compiler could not recover
from a syntax error (the error may or may not have been reported). If the syntax of the
source is correct, contact Unisys about raising the compiler's limit.

THE TYPE DOUBLE COMPLEX IS INTERPRETED AS THE TYPE COMPLEX.


Double precision for COMPLEX type is not available. REAL value will be used.

THE URGENT ATTRIBUTE IS ONLY VALID WITH FORMATTED OUTPUT TO


A SEQUENTIAL EXTERNAL FILE.
The URGENT attribute only applies to port files. These files must be sequential
external files.

THE USE OF MORE THAN 19 CONTINUATION LINES IS AN EXTENSION OF


THE ANSI X3.9 -- 1978 FORTRAN STANDARD.
This message appears at the twentieth continued line when the compiler control
option ANSI is set. It warns that the program source is in violation of the ANSI
standard.

THE USE OF THE CONTROL VARIABLE '<name>' IN THIS CONTEXT


CONFLICTS WITH A PRIOR USE OF THE SAME CONTROL VARIABLE.
Nested implied-DO's in a DATA statement must use different control variables.
Change the name of the conflicting control variable.

THE VALUE, <word>, ASSIGNED TO THIS ATTRIBUTE IS NOT VALID.


A mnemonic value is being assigned to a file attribute. The value is either not a
recognized mnemonic or cannot be assigned to this attribute.

THE VALUE (<number>) USED AS SUBSCRIPT NUMBER <number> FOR


ARRAY <name> IS OUT OF RANGE.
An array was referenced in a EQUIVALENCE statement with a subscript value that is
beyond the range for that dimension.

THE VALUE ASSIGNED TO LONGLIMIT IS TOO LARGE -- 65536 WILL BE


USED.
The LONGLIMIT compiler control option cannot exceed 65536 words. Arrays longer
than 65536 words must be segmented.

THE VALUE ASSIGNED TO LONGLIMIT IS TOO SMALL -- 256 WILL BE


USED.
The LONGLIMIT compiler control option must be at least 256 words. Arrays shorter
then 256 words cannot be segmented.

C48 3957 6053003


Error Messages

THE VALUE ASSIGNED TO THE ATTRIBUTE '<string>' MUST BE OF TYPE


<type>; A TYPE OF <type> WAS ASSIGNED.
The attribute for the file requires a different type of value.

THE VALUE ASSIGNED TO THE ATTRIBUTE 'UNIT' MUST OF TYPE


INTEGER, REAL, OR DOUBLE PRECISION. A TYPE OF <type> WAS
ASSIGNED.
The UNIT specifier must be arithmetic, between 1 and 99. For internal I/O, the specifier
must be of type character. The value specified is of the wrong type.

THE VALUE ASSIGNED TO THE 'SERIALNO' ATTRIBUTE MUST BE NO


MORE THAN 6 CHARACTERS IN LENGTH.
Also see the explanation of the SERIALNO attribute in the ClearPath Enterprise
Servers File Attributes Programming Reference Manual.

THE VALUE ASSIGNED TO THIS ATTRIBUTE IS OF TYPE <type>, WHICH IS


NOT VALID.
This file attribute is of a different type than the value assigned to it. Check the file
attribute type in Section 8 of this manual or, if it is a system file attribute, see the
ClearPath Enterprise Servers File Attributes Programming Reference Manual.

THE VALUE OF THE IDLEN OPTION MUST BE IN THE RANGE <number> -


<number> -- OPTION IGNORED.
The maximum length of an identifier can be set by the IDLEN compiler control option.
The maximum length is not less than 6 and not more than 31 compilers. Differences in
versions could cause unforeseen problems.

THE VARIABLE <name> HAS ALREADY APPEARED IN A DATA OR INITIAL


VALUE SPECIFICATION STATEMENT.
The item has been given an initial value in a TYPE or DATA statement. An item may
only have one initial value.

THE VARIABLE <name> OF CLASS <class> CANNOT BE EXPORTED.


Only subroutines, functions, common block names, and unit identifiers may be
exported.

THE VARIABLE, <name>, USED AS A FORMAT DESIGNATOR AT


(<sequence- number>) HAS NEVER BEEN ASSIGNED A FORMAT LABEL.
The integer variable has been used in the FORMAT specifier of a control information
list, but was never given an appropriate value. It must be given a statement label value
with an ASSIGN statement.

3957 6053003 C49


Error Messages

THE VARIABLE <name> USED IN THE ESTABLISHMENT OF THE IMPLIED-


DO VARIABLE <name> IS NOT DECLARED OR IS NOT VALID IN THIS
CONTEXT.
The expressions used to define the starting value, ending value, and increment for an
implied-DO in a DATA statement contain a reference to an undefined variable. Only
integer constants or identifiers defined in PARAMETER statements should appear in
these expressions.

THE VARIABLE <name> USED IN THE SUBSCRIPT EXPRESSION OF ARRAY


<name> IS NOT AN IMPLIED-DO VARIABLE OR IS NOT VALID IN THIS
CONTEXT.
The subscript of the array for an implied-DO in a DATA statement uses a variable that
is not defined. It should be the control variable defined in the implied- DO.

THE XREFFILE IS NOT COMPATIBLE WITH THE HOST FILE -- THE COMPILER
WILL NOT ATTEMPT TO PRODUCE UP-TO-DATE CROSS REFERENCE
INFORMATION.
The XREFFILES option will only produce a cross reference for a separately compiled
program if the current cross reference file matches the host cross reference file.
Because they do not match, no new cross reference is created.

THERE ARE DUPLICATE DECLARATIONS FOR <name> AT <number> AND


AT <number>.
The identifier has been declared more than once. An identifier cannot have multiple
declarations.

THERE ARE <number> CONTINUATION LINES. ONLY 99 CONTINUATION


LINES ARE PERMITTED.
The line has been continued on too many statements.

THERE WERE NO REFERENCES TO THE IMPLIED-DO VARIABLE <name> IN


THE SUBSCRIPT EXPRESSION OF ARRAY <name>.
The control variable in the implied-DO identifies the elements to be initialized. The
control variable did not appear in the subscript of the array and, therefore, did not
control the initialization of the elements of the array. Either put the control variable in
the subscript or define a separate implied-DO if the control variable is not needed.

THERE WERE TOO MANY RIGHT PARENTHESES IN THE PRECEDING


FORMAT.
There were more right parentheses than left parentheses in the FORMAT
specification.

THIS COMPILER DOES NOT HAVE THE INTERNAL DEBUG FACILITIES


COMPILED IN -- OPTION IGNORED.
The $DEBUG option may only be used if internal debug facilities are available. Note
that this option is intended for Unisys use only.

C50 3957 6053003


Error Messages

THIS FEATURE IS NOT YET IMPLEMENTED -- <string>.


An attempt was made to use a feature not fully implemented.

THIS IMPLICIT STATEMENT IS BEING IGNORED BECAUSE THE COMPILER


CONTROL OPTION IMPLICIT NONE IS CURRENTLY SET.
The IMPLICIT NONE compiler control option has the same effect as including an
IMPLICIT NONE statement within every program unit for which IMPLICIT NONE is set
at the first statement of the program unit.

THIS LABEL HAS ALREADY APPEARED AS A FORMAT LABEL IN THIS


PROCEDURE : <text>.
A previous FORMAT statement was defined with this label. The same label cannot be
defined twice.

THIS LABEL HAS ALREADY APPEARED AS A STATEMENT LABEL IN THIS


PROCEDURE : <text>.
A label may only be used once in a procedure. This label appeared previously.

THIS LABEL HAS BEEN USED TO REFERENCE A FORMAT : <text>.


This label was previously used on a FORMAT statement. Use a different label on this
statement.

THIS MAIN PROGRAM CONTAINS NO STATEMENTS.


No statements were defined for the main program. There is probably a misplaced END
statement in the source.

THIS MAY NOT APPEAR IN A BLOCK DATA SUBPROGRAM.


Only the IMPLICIT, PARAMETER, DIMENSION, COMMON, SAVE, EQUIVALENCE, DATA,
END, and TYPE statements may appear in a BLOCK DATA subprogram. Other
statements must go in the main program or an executable subprogram.

THIS MAY NOT APPEAR IN A BLOCK GLOBALS SUBPROGRAM.


The BLOCK GLOBALS subprogram is used only for declaring libraries, export lists,
import lists, and files. Only the FILE, LIBRARY, EXPORT, and IMPORT statements may
be used. For more information, see Section 18 in this manual.

THIS SPECIFICATION STATEMENT MUST APPEAR AFTER IMPLICIT


STATEMENTS AND BEFORE DATA, STATEMENT FUNCTION, AND
EXECUTABLE STATEMENTS.
Specification statements defining variables appear after the IMPLICIT statement and
before executable or definition statements. These specification statements include
INTRINSIC, EXTERNAL, TYPE, DIMENSION, COMMON, and DEBUG statements.

3957 6053003 C51


Error Messages

THIS STATEMENT MAY NOT APPEAR WITHIN A PROCEDURE THAT IS


DECLARED TO BE IN A LIBRARY.
This statement attempts to define items for use in the procedure. Because the IN
LIBRARY statement is used for this procedure, it is considered to be wholly defined in
the library. No other statements may be used in the procedure.

THIS STATEMENT MAY NOT BE REFERENCED BY ITS LABEL : <text>.


Non-executable statements other than FORMAT statements cannot be the object of a
GO TO or DO statement. They do not need labels.

THIS SUBPROGRAM IS TOO LARGE TO BE COMPILED WITH SEPARATE


SET. IT MUST BE BROKEN INTO SMALLER SUBPROGRAMS OR INCLUDED
IN THE HOST COMPILE.
The SEPARATE compiler option cannot be used for this subprogram. For more
information on the SEPARATE option, see Section 17 in this manual.

THIS SUBSCRIPT EXPRESSION FOR ARRAY <name> MUST BE OF TYPE


INTEGER. IT IS OF TYPE <type>.
The subscript identifies a particular element of the array. Each element has a position
in the array identified by an integer number. The subscript expression must be an
integer.

TRANSLATE TABLE MUST BE AN ARRAY.


The translate table used by the intrinsic must be an array of 64 elements.

UNEXPECTED <token> IN <statement> STATEMENT.


A word or character was encountered during processing of a statement that does not
belong in the statement. The statement is syntactically incorrect.

UNEXPECTED _ IN THIS STATEMENT.


The underscore character (_) may not be the first character in a variable name and may
not appear outside a variable name. For more information on naming conventions, see
Section 2 in this manual.

UNIT IDENTIFIER <number> HAS BEEN EXPLICITLY OR IMPLICITLY


DECLARED EARLIER.
A unit identifier may only be used once, each file must have a unique unit identifier.
The number specified has already been used.

UNKNOWN EDITING PHRASE CHARACTER.


The FORMAT specification used an unknown edit descriptor. Replace with the correct
character. Refer to Section 9 in this manual for more information.

C52 3957 6053003


Error Messages

UNLESS '(F77DO)' IS SPECIFIED, OPTIMIZATION OF LOOPS IS NOT


PERFORMED WHEN CONVERT IS SET.
The CONVERT compiler control option specified that DO loops follow FORTRAN66
rules. This prevents them from being optimized. Specify CONVERT (F77DO) to use
FORTRAN77 rules that allow optimization. For more information on the CONVERT
compiler control option, see Section 17 in this manual.

UNMATCHED LEFT PARENTHESIS IN FORMAT STATEMENT.


The FORMAT statement has more left parentheses than right parentheses.

UNSPECIFIED EXPONENT FIELD.


The exponent part of an edit descriptor in a FORMAT specification is not specified.

UNSPECIFIED SCALE FACTOR.


A FORMAT specification that begins with a plus sign (+) or minus sign (-) is assumed
to be a scale factor (P) edit descriptor. This specification begins with a plus or minus
sign, but has no value for the scale factor.

VARIABLE LENGTH IN DECLARATION OF <name> IS NOT PERMITTED.


Only dummy arguments may have variable lengths. This identifier is not a dummy
argument.

VARIABLE LENGTH IN IMPLICIT STATEMENT IS NOT PERMITTED.


The IMPLICIT statement identifies types in general. A specific type using variable
length must be identified in a TYPE statement. For more information, see Section 4 in
this manual.

WHEN THE CONCATENATED FORM OF THE UNIT AND REC SPECIFIERS


(U'RN) IS USED THE SECOND CONTROL LIST ITEM IS REQUIRED TO BE A
NON LIST-DIRECTED FORMAT SPECIFIER WITHOUT THE "FMT =" PART.
The format is the second parameter in the control information list when using the
syntax with unit'rec-num. It cannot be identified with the keyword 'FMT'.

WHEN THE 'FMT =' PART OF THE FORMAT SPECIFIER DOES NOT APPEAR,
THE FORMAT SPECIFIER MUST BE THE SECOND ITEM IN THE LIST. THE
UNIT SPECIFIER MUST BE THE FIRST ITEM IN THE LIST AND MUST
APPEAR WITHOUT THE 'UNIT =' PART.
The format specification in the control information list was specified incorrectly.
Precede the specification by the specifier FMT=.

WHEN USING <string>, SUBFILES MAY NOT BE SPECIFIED.


Subfiles are used for port file communication only. They may not be used with direct
I/O, internal I/O, list-directed or unformatted I/O or namelist formatted I/O.

WHILE ATTEMPTING TO EXPAND <string>, A REFERENCE TO SAME WAS


FOUND. RECURSIVE DECLARATIONS ARE NOT ALLOWED.
A defined statement function may not call itself directly or indirectly.

3957 6053003 C53


Error Messages

WHILE ATTEMPTING TO EXPAND THE ACTUAL ARGUMENTS FOR


<string>, A LEFT PARENTHESIS WAS NOT FOUND AFTER THE NAME.
A defined statement function that was declared with formal arguments was invoked
without a left parenthesis following the function name.

WHILE ATTEMPTING TO EXPAND THE ACTUAL ARGUMENTS FOR


<string>, THE END OF THE STATEMENT WAS FOUND BEFORE THE
TERMINATING RIGHT PARENTHESIS.
A defined statement function that was declared with formal arguments was invoked
without a left parenthesis following the function name.

WITH THE MAKEHOST OPTION IS USED, THE MAIN PROGRAM SHOULD


HAVE A 'PROGRAM' STATEMENT.
When the MAKEHOST option is used, the main program should be named. It is named
with the PROGRAM statement. For more information on the main program, see
Section 11 in this manual.

WRITE ONLY ATTRIBUTE -- CANNOT BE READ.


This file attribute cannot be examined by an INQUIRE statement. Its value may only be
changed.

ZERO WILL BE USED FOR THE ABOVE NUMBER, WHICH IS TOO SMALL TO
REPRESENT AS A SINGLE PRECISION, NON-ZERO NUMBER; THE LOWER
BOUND IS APPROXIMATELY 8.8E- 47.
This number is so small there is no representation for it available on this machine in
single precision. Zero will be used instead. Use double precision for greater precision.

C54 3957 6053003


Index

A character expression, 3-4


character set, 1-3
character variable, 15-6
ALGOL subprogram, 18-13
Command and Edit Language, 16-9
arguments and common blocks, 12-45
COMMON statement, 4-4, 15-11
arithmetic expression, 3-3
common storage, 15-11
array, 2-12, 15-6
comparison
array declarer, 2-13
binding, B-11
array element, 2-12
compiler control statements, B-11
assignable functions, 12-21
compiler files, B-11
assignment statement, 6-1
control statements, B-5
arithmetic, 6-1
debugging aids, B-12
character, 6-3
format, B-2
logical, 6-2
input/output, B-9
statement label, 6-3
libraries, B-11
auxiliary I/O statements
new statements, B-2
BACKSPACE statement, 8-26
optimization, B-12
CHANGE statement, 8-21
separate compilation, B-10
CLOSE statement, 8-19
source input format, B-1
ENDFILE statement, 8-27
specification statements, B-4
FILE statement, 8-29
subprograms, B-7
FIND statement, 8-29
type statements, B-5
INQUIRE statement, 8-22
ZIP statement, B-11
OPEN statement, 8-15
comparison between FORTRAN and
REWIND statement, 8-28
FORTRANN77, B-1
compilation, 16-9
compile and go, 16-8
B compile control options, 17-6
compile for library, 16-8
Basic Linear Algebra Subprograms, 19-25 compile for library and go, 16-9
BLAS, See Basic Linear Algebra compile for syntax, 16-8
Subprograms compiler control image, 17-1
BLOCK DATA statement, 13-1 compiler control option, 17-1, 17-5, 19-14
block data subprogram, 13-1 compiler file table, 16-3
BLOCK GLOBALS subprogram, 18-1 compiler files, 16-1
compiler input file, 16-1
compiler output file, 16-2
C complex constant, 2-5
complex variable, 15-5
CALL statement, 12-40 constant
carriage control character, 9-2 character, 2-6
CCI, See compiler control image complex, 2-5
CCO, See compiler control option double precision, 2-4
character constant, 2-6 hexadecimal, 2-8

3957 6053003 Index1


Index

Hollerith, 2-7 error messages, C-1


integer, 2-2 error specifier, 8-9
logical, 2-6 ERRORLIST, 17-19
real, 2-2 examples
constants, 2-1 invalid array elements, 2-15
CONTINUE statement, 7-10 valid array elements, 2-15
control information list, 8-4 valid substrings, 2-16
control statements, 7-1, B-5 export list, 18-1
creating libraries, 18-1 expression, 3-1
creating library arithmetic, 3-3
CALL FREEZE statement, 18-2 character, 3-4
EXPORT statement, 18-2 logical, 3-6
SHARING option, 18-3 relational, 3-6
external function, 12-24
EXTERNAL statement, 4-10
D
DATA statement, 5-1 F
implied-DO, 5-5
data transfer I/O statement, 8-12 file
data transfer I/O statements, 8-4 external, 8-2
data word internal, 8-2
components record, 8-2
bridges, A-3 format, 9-1
DEBUG <statement> statement, 14-7 arithmetic assignment statement, 6-1
DEBUG DUMP statement, 14-2 arithmetic expression, 3-3
DEBUG MONITOR statement, 14-5 arithmetic IF statement, 7-3
DEBUG PROGRAMDUMP statement, 14-3 array declarer, 2-13
DEBUG START statement, 14-8 array element, 2-12
debug statement, 14-1 ASSIGN statement, 6-3
DEBUG STOP statement, 14-8 assigned GO TO statement, 7-2
debugging aids, 14-1 BACKSPACE statement, 8-26
dependence, 19-3 BLOCK DATA statement, 13-1
dependence theory, 19-3 block IF statement, 7-4
differences between IMPORT and IN CALL FREEZE statement, 18-2
LIBRARY subprograms, 18-9 CALL statement, 12-40
DIMENSION statement, 4-1 CHANGE statement, 8-21
DO statement, 7-7 character assignment statement, 6-3
processing phases, 7-8 character constant, 2-6
double precision, 2-4 character expression, 3-4
double precision variable, 15-3 CLOSE statement, 8-19
COMMON statement, 4-4
complex constant, 2-5
E computed GO TO statement, 7-2
CONTINUE statement, 7-10
edit descriptor, 9-3 DATA statement, 5-1
non-repeatable, 9-3 data transfer I/O statement, 8-12
repeatable, 9-3 DEBUG <statement> statement, 14-7
END statement, 7-12 DEBUG DUMP statement, 14-2
end-of-file specifier, 8-9 DEBUG MONITOR statement, 14-5
ENTRY statement, 12-41 DEBUG PROGRAMDUMP statement, 14-4
EQUIVALENCE statement, 4-2, 15-8 DEBUG START statement, 14-8

Index2 3957 6053003


Index

DEBUG STOP statement, 14-8 format specifications in arrays and character


DIMENSION statement, 4-1 entities, 9-21
DO statement, 7-7 format specifier, 8-6
double precision, 2-4 FORMAT statement, 9-1
ELSE IF statement, 7-5 function
ELSE statement, 7-6 external, 12-24
END IF statement, 7-6 intrinsic, 12-2
END statement, 7-12 statement, 12-20
ENDFILE statement, 8-27 function reference, 12-1
end-of-file specifier, 8-9 function types, 12-1
ENTRY statement, 12-41 functions, 12-1
EQUIVALENCE statement, 4-2
error specifier, 8-9
EXPORT statement, 18-2 G
EXTERNAL statement, 4-10
FILE declaration, 8-29 GO TO statements, 7-1
FIND statement, 8-29
format specifier, 8-6
FORMAT statement, 9-1 H
function reference, 12-1
FUNCTION statement, 12-24
Hollerith constant, 2-7
hexadecimal constant, 2-8
Hollerith constant, 2-7
I/O implied-DO list, 8-11
IMPLICIT statement, 4-8
I
input/output specifier, 8-7
INQUIRE statement, 8-22 I/O implied-DO list, 8-11
integer constant, 2-2 I/O list, 8-11
INTRINSIC statement, 4-10 I/O status specifier, 8-7
logical assignment statement, 6-2 IMPLICIT statement, 4-8
logical constant, 2-6 import files, 18-1
logical expression, 3-7 import list, 18-1
logical IF statement, 7-3 IMPORT statement, 18-8
NAMELIST statement, 10-1 IN LIBRARY statement, 18-7
OPEN statement, 8-15 input statements, 8-1
PARAMETER statement, 4-9 integer constant, 2-2
PAUSE statement, 7-10 integer variable, 15-2
PROGRAM statement, 11-1 intrinsic function, 12-2
real constant, 2-2 INTRINSIC statement, 4-10
record specifier, 8-6
relational expression, 3-6
REWIND statement, 8-28 K
SAVE statement, 4-11
statement function, 12-20 K edit descriptor, 9-20
STOP statement, 7-11
subfile specifier, 8-10
SUBROUTINE statement, 12-28 L
substring, 2-15
TYPE statement, 4-5 library, 18-1
unconditional GO TO statement, 7-1 advantages, 18-1
unit specifier, 8-5 library attributes, 18-4
urgent specifier, 8-10 library declaration, 18-1
format specifications, 9-1

3957 6053003 Index3


Index

list-directed format, 9-21 R


logical constant, 2-6
logical expression, 3-6
Railroad Components, A-2
logical variable, 15-5
railroad diagrams, A-1
loop vectorization, 19-1
description, A-1
real constant, 2-2
real variable, 15-3
M record specifier, 8-6
referencing libraries, 18-4
main program, 11-1 relational expression, 3-6
multiple storage location, 15-9 repeatable edit descriptor
A editing, 9-17
E and D editing, 9-12
N F editing, 9-11
G editing, 9-14
namelist input, 10-2 I editing, 9-9
namelist input record format, 10-2 J editing, 9-10
namelist name, 10-1 L editing, 9-16
namelist output, 10-3 O editing, 9-15
NAMELIST statement, 10-1 Z editing, 9-19
non-repeatable edit descriptor RETURN statement, 12-43
apostrophe and quote editing, 9-4
BN and BZ editing, 9-8
colon editing, 9-6 S
H editing, 9-4
P editing, 9-7 SAVE statement, 4-11
positional editing, 9-5 single storage location, 15-8
S, SP, and SS editing, 9-7 special vectorization cases, 19-13
slash editing, 9-6 specification statements, 4-1, B-4
numeric editing, 9-9 COMMON, 4-4
DIMENSION, 4-1
EQUIVALENCE, 4-2
O EXTERNAL, 4-10
IMPLICIT, 4-8
operators INTRINSIC, 4-10
arithmetic, 3-1 PARAMETER, 4-9
character, 3-1 SAVE, 4-11
logical, 3-1 TYPE, 4-5
relational, 3-1 statement, 1-4
order of statements, 1-5 comment line, 1-4
output statements, 8-1 continuation line, 1-4
initial line, 1-4
statement function, 12-20
P storage allocation, 15-1
subfile specifier, 8-10
PARAMETER statement, 4-9 subprograms, 12-1, B-7
procedures subroutine, 12-27
external, 12-1 SUBROUTINE statement, 12-28
defining in subprograms, 12-1 subscript, 19-11, 19-12
program compilation, 11-1 substring, 2-15
program performance, 19-17 syntactic items, 1-2
PROGRAM statement, 11-1

Index4 3957 6053003


Index

T vectorization, 19-1
vectorization of loop statements, 19-2
vectorization report, 19-22, 19-23
TASKSTRING task attribute, 16-9
vectorization result, 19-18
TYPE statement, 4-5
vectorization result flag, 19-18
type statements, B-5

U Special Characters
$ edit descriptor, 9-20
unavailable edit descriptors in
FORTRANN77, B-4
unit, 8-3
unit specifier, 8-5
urgent specifier, 8-10

V
variable, 2-11, 15-2
name, 2-11
type, 2-11

3957 6053003 Index5


Index

Index6 3957 6053003


.
2011 Unisys Corporation.
All rights reserved.

*39576053-003*
3957 6053003

You might also like