Compaq Fortran
User Manual for
Tru64 UNIX
and Linux Alpha Systems
A.4 Compatibility with Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems
This section provides compatibility information for those who:
- Port Compaq Fortran 77 and Compaq Fortran applications from OpenVMS
systems to Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems
- Design Compaq Fortran applications to run on multiple platforms,
including OpenVMS and Compaq Tru64 UNIX or Linux Alpha systems
If your primary concern is the design and development of Compaq Fortran
applications for only Compaq Tru64 UNIX (or other U*X) systems,
consider skipping this section.
This section discusses the following topics:
- Compaq Fortran 77 extensions for OpenVMS systems that are not
supported by this version of Compaq Fortran 77 or Compaq Fortran on
Compaq Tru64 UNIX or Linux Alpha Systems ( Section A.4.1)
- Porting Compaq Fortran data files from an OpenVMS system to a
Compaq Tru64 UNIX or Linux Alpha system ( Section A.4.2)
- Nonnative VAX floating-point representations, provided for those
converting unformatted OpenVMS floating-point data ( Section A.4.3)
A.4.1 Language Features Specific to Compaq Fortran 77 and Compaq Fortran for OpenVMS Systems
Some extensions to the FORTRAN-77 standard provided by Compaq Fortran
77 and Compaq Fortran for OpenVMS Systems are specific to the OpenVMS
operating system, VAX architecture, or certain products on OpenVMS
systems. Such extensions are not included in Compaq Fortran 77 or
Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems.
For information on language compatibility between Compaq Fortran and
Compaq Fortran 77 without regard to operating system or architecture
differences, see Section A.2.
Compaq Fortran 77 and Compaq Fortran products for OpenVMS systems
include:
- Compaq Fortran Version 7.2 for OpenVMS Alpha Systems
- Compaq Fortran 77 Version 7.2 for OpenVMS Alpha Systems
- Compaq Fortran 77 Version 6.6 for OpenVMS VAX Systems (previously
called VAX FORTRAN)
Unless otherwise noted, the following list describes the Compaq Fortran
77 extensions in Compaq Fortran 77 and/or Compaq Fortran for OpenVMS
systems that are not supported by Compaq Fortran Version 5.3
for Compaq Tru64 UNIX Systems:
- DICTIONARY statement
The DICTIONARY and related support for the
CDD/Repository (common data dictionary) product are not provided by
Compaq Fortran or Compaq Fortran 77 for Compaq Tru64 UNIX Systems.
- Support for indexed sequential files
I/O statement specifiers
for indexed file (keyed access) record I/O using OpenVMS OPEN and
INQUIRE statement specifiers are not provided by Compaq Fortran or
Compaq Fortran 77 for Compaq Tru64 UNIX or Linux Systems, as follows:
ACCESS=
'
KEYED
'
|
EXTENDSIZE
|
INITIALSIZE
|
KEY
|
NOSPANBLOCKS
|
ORGANIZATION=
'
INDEXED
'
|
SHARED
|
|
- FORSYSDEF symbol definitions for OpenVMS systems
The parameter
definitions of run-time messages found in FORSYSDEF.TLB library module
FORIOSDEF on OpenVMS systems are provided in the file
/usr/include/foriosdef.f
(see Section 8.2.2) on Compaq Tru64 UNIX Systems. On Compaq Tru64 UNIX
and Linux Alpha systems, Compaq Fortran and Compaq Fortran 77 provides
jacket routines to simplify calling system calls and library routines
(see Chapter 12).
- The INCLUDE statement option of including text from text libraries.
On Compaq Tru64 UNIX and Linux Alpha systems, OpenVMS text
libraries are not supported.
- The %DESCR built-in function (for OpenVMS character descriptors).
On Compaq Tru64 UNIX and Linux Alpha systems, character data is
passed by address and hidden length. For information about calling or
being called by procedures written in other languages, see
Chapter 11.
- Run-time default I/O units spelled as FOR0nn.dat, SYS$INPUT, and so
on
In Compaq Fortran and Compaq Fortran 77 on Compaq Tru64 UNIX and
Linux Alpha systems, these are environment variables FORTn,
stdin
,
stdout
, and so forth (see Section 7.5.1).
- VAX floating-point formats and related selection of the
floating-point format in memory
Only IEEE floating-point formats
are supported in memory on Compaq Tru64 UNIX (Alpha) systems. (Compaq
proprietary VAX floating-point formats are not supported in memory.)
You can request conversion of unformatted files containing VAX
floating-point formats into the appropriate IEEE memory format during
record I/O (see Chapter 10).
On OpenVMS VAX systems, you
specify the floating-point format to be used in memory with either the
option [NO]G_FLOATING in the OPTIONS statement or the qualifier
/[NO]G_FLOATING on the FORTRAN command line.
On OpenVMS Alpha
systems, you specify the floating-point format to be used in memory
using the /FLOAT qualifier on the FORTRAN command line.
- Stream record format differences
With Compaq Fortran 77 and Compaq Fortran for OpenVMS systems, the
Stream record type is delimited by CR-LF character sequence (carriage
control and line feed characters). In Compaq Fortran for Compaq Tru64
UNIX systems, the Stream record type uses no delimiters.
For more
information on compatible record types, see Section A.4.2.
- Other differences related to the OpenVMS operating system and the
Compaq Tru64 UNIX and Linux operating systems
When parsing file specifications for the OPEN, INQUIRE, and INCLUDE
statements, keep in mind that file names are case-sensitive on Compaq
Tru64 UNIX and Linux systems and that OpenVMS file specification syntax
differs from pathname syntax.
For the INCLUDE statement, the
network node names (terminated by "::"), logical names
(usually terminated by ":"), and other OpenVMS file
specification components are not recognized. Instead, the INCLUDE
statement should specify a pathname, possibly with an absolute
directory path.
- The OpenVMS operating system provides various system services (SYS$
prefix) and run-time library routines (LIB$, SMG$, and other prefixes)
that are not supported on Compaq Tru64 UNIX and Linux systems. Compaq
Tru64 UNIX systems support system calls and library routines with
similar functions (but different names).
To make programs more
portable to other operating systems, wherever possible you should use
standard-conforming Compaq Fortran intrinsic routines in place of
routines specific to a particular operating system.
For more
information on specifying files, see Section 7.5.1.3.
The following language and VAX architecture features are associated
only with Compaq Fortran 77 on OpenVMS VAX Systems (previously called
VAX FORTRAN) and are not supported by Compaq Fortran Version 5.3 for
Compaq Tru64 UNIX and Compaq Fortran Version 1.0 for Linux Alpha
systems:
- Directed decomposition features and CPAR$ directives for parallel
processing
CPAR$ directives are treated as comments (ignored).
Parallel processing capabilities (appropriate
f90
options, OpenMP, Compaq Fortran parallel, and HPF data mapping
directives) are provided by Compaq Fortran.
- OPTIONS statement options /BLAS, /NOBLAS, /CHECK=ALIGNMENT,
/CHECK=NOALIGNMENT, /CHECK=ASSERTION, /CHECK=NOASSERTION, /G_FLOAT, and
/NOG_FLOAT
You can specify some of these options by using the
corresponding
f90
command-line options. The OPTIONS statement is treated as a comment
(ignored).
- CDEC$ performance directives ASSERT and NOVECTOR are treated as
comments (ignored).
- The REAL*16 floating-point data type
On VAX systems, REAL*16
data is in H_float format. On Alpha systems, REAL*16 data is in the
native IEEE style X_float; so are both halves (real and imaginary) of
COMPLEX*32 data.
- The following subroutines for PDP-11 compatibility:
ASSIGN
CLOSE
ERRSET
|
ERRTST
FDBSET
IRAD50
|
RAD50
R50ASC
USEREX
|
- Radix-50 constants and character set
- The BLAS routines
Similar basic linear algebra routines are
provided in the Compaq Extended Mathematical Library (CXML) product
(see Section 5.1.1).
The following language and VAX architecture features are interpretation
differences between Compaq Fortran and Compaq Fortran 77 on Alpha
systems and Compaq Fortran 77 on OpenVMS VAX Systems (previously called
VAX FORTRAN):
- Random number generator (RAN)
The RAN function (one argument)
generates a different pattern of numbers in Compaq Fortran than in
Compaq Fortran 77 on OpenVMS VAX Systems for the same random seed.
Compaq Fortran and Compaq Fortran 77 use the same random seed. (The RAN
and RANDU functions are provided for Compaq Fortran 77 on OpenVMS VAX
Systems compatibility. See Compaq Fortran Language Reference Manual.)
- Hollerith constants in formatted I/O statements
Compaq Fortran
77 on OpenVMS VAX Systems and Compaq Fortran behave differently if
either of the following occurs:
- Two different I/O statements refer to the same CHARACTER PARAMETER
constant as their format specifier. For example:
CHARACTER*(*) FMT2
PARAMETER (FMT2='(10Habcdefghij)')
READ (5, FMT2)
WRITE (6, FMT2)
|
- Two different I/O statements use the identical character constant
as their format specifier. For example:
READ (5, '(10Habcdefghij)')
WRITE (6, '(10Habcdefghij)')
|
In Compaq Fortran 77 for OpenVMS VAX Systems, the parameter value
obtained by the READ statement is modified. The parameter value
modified by the READ statement is used as the output of the WRITE
statement (FMT2 is ignored). However, in Compaq Fortran, the parameter
value is not modified (the parameter value read by the READ
statement has no effect on the parameter value written by the WRITE
statement.)
For More Information:
- On language compatibility information about Compaq Fortran for
Compaq Tru64 UNIX systems and Compaq Fortran 77, see Section A.2.2.
- On language interpretation differences between Compaq Fortran for
Compaq Tru64 UNIX systems and Compaq Fortran 77, see Section A.2.3.
- About the Compaq Fortran language, see the Compaq Fortran Language Reference Manual.
A.4.2 OpenVMS Data Porting Considerations
When porting data between systems running the Compaq Tru64 UNIX and
Linux Alpha operating systems and systems running the OpenVMS operating
system, the file formats and the floating-point representations may
differ.
The file and record formats of Compaq Fortran 77 on Compaq Tru64 UNIX
systems are compatible with Compaq Fortran on Compaq Tru64 UNIX and
Linux Alpha systems; they share the same language run-time I/O
environment (see Chapter 7).
OpenVMS Fortran1 files containing only character, integer,
or logical data do not need field-by-field conversion, but the record
types must match. The segmented record type is the same on OpenVMS
Fortran systems and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha
systems. Certain other record types, such as variable-length records,
differ between OpenVMS systems and Compaq Fortran on Compaq Tru64 UNIX
or Linux Alpha systems.
Table A-2 summarizes the OpenVMS Fortran record types and their
equivalent record types in Compaq Fortran on Compaq Tru64 UNIX or Linux
Alpha systems.
Table A-2 Equivalent Record Types for OpenVMS Fortran and Compaq Fortran on Compaq Tru64 UNIX or Linux Alpha Systems
OpenVMS Fortran Record Type |
Compaq Tru64 UNIX Fortran Record Type |
Comments |
Fixed-length
|
None
|
Equivalent (must be copied correctly) if you use sequential access and
you specify the
-vms
option when compiling the Compaq Fortran
file. Otherwise, convert the file to a different record type.
|
Variable-length
|
None
|
Not equivalent.
Convert the file to a different record type.
|
Segmented
|
Segmented
|
Equivalent (must be copied correctly). Segmented data files
can contain formatted or unformatted data.
|
Stream
|
None
|
Not equivalent. Convert the file to
a different record type.
|
Stream_CR
|
Stream_CR
|
Equivalent (must be copied correctly).
|
Stream_LF
|
Stream_LF
|
Equivalent (must be copied correctly).
|
A.4.2.1 Matching Record Types
To match record types, there are several options:
- For the Segmented, Stream_CR, and Stream_LF record types, you do
not need to convert the files.
- For fixed-length records where you will only use sequential access,
use the
-vms
option when compiling the Compaq Fortran program that will access the
OpenVMS Fortran files. For fixed-length records where you will use
direct access, convert the files to a different record format.
- For incompatible record types, convert the files by writing a
OpenVMS Fortran or C conversion program or by using the ANALYZE/RMS/FDL
and CONVERT/FDL (or EXCHANGE/FDL) commands for an appropriate file. For
instance, convert the OpenVMS Fortran file to the segmented record type.
A.4.2.2 Copying Files
Equivalent record types must be copied carefully to preserve control
information and record characteristics. For example:
- Do not use the ASCII transfer mode for binary files.
- Segmented files must be copied in a manner that preserves record
length information.
To transfer (copy) the files, choose one of the following methods:
- From an NFS mounted disk, use the
cp
command (see cp(1)).
- Perform a DECnet copy from a Compaq Tru64 UNIX or Linux Alpha
system running the appropriate optional network software using
dcp
(see dcp(8)). Use the
dcp -i
option when you want to preserve record format information.
- Perform a copy from a Compaq Tru64 UNIX or Linux Alpha system with
rcp
, possibly by using an intermediate node running the appropriate
optional network software when using a version of the OpenVMS operating
system that does not support a compatible network protocol (optional
product).
- Use ftp from a Compaq Tru64 UNIX or Linux Alpha system to copy a
file between a Compaq Tru64 UNIX or Linux Alpha system and an OpenVMS
system. Use the
binary
or
ascii
command to set the mode before you copy (get or put) the file. For
example, use the ftp
binary
command before copying an unformatted file (such as the segmented
record type).
- Perform a DECnet copy from an OpenVMS system with the EXCHANGE
command with the /NETWORK and /TRANSFER=BLOCK qualifiers with a Compaq
Tru64 UNIX system. To convert the file to Stream_LF format during the
copy operation, use /TRANSFER=(BLOCK,RECORD_SEPARATOR=LF) instead of
/TRANSFER=BLOCK, or specify the /FDL qualifier to the EXCHANGE command
to specify the record type.
In addition to using the correct record type and carefully transferring
the files, the data inside unformatted records may need to be
converted. OpenVMS Fortran data files that contain VAX binary
floating-point data must be converted before they can be accessed by a
Compaq Fortran program. There are several methods:
- On an OpenVMS system, a Fortran program can convert files
containing unformatted data to files containing formatted data. Once
the files contain formatted data, they can be read by the appropriate
Compaq Fortran programs.
However, converting unformatted data to formatted data may result in a
loss of accuracy for unformatted floating-point data.
- On an OpenVMS VAX system, a Compaq Fortran 77 program can read and
write files containing unformatted data by using the Compaq Fortran
conversion capabilities described in DEC Fortran User Manual for OpenVMS VAX Systems.
- On an OpenVMS Alpha system, a Fortran program can read and write
files containing unformatted data by using the Compaq Fortran
conversion capabilities described in the Compaq Fortran User Manual
for OpenVMS Alpha Systems.
A Compaq Fortran 77 for OpenVMS
Alpha Systems program can also use the CVT$CONVERT_FLOAT routine to
convert individual floating-point fields.
- On a Compaq Tru64 UNIX or Linux Alpha system, a Compaq Fortran
program can read and write files containing unformatted data using the
Compaq Fortran conversion capabilities described in Section 10.2. A
program using the Compaq Fortran conversion capabilities can also
convert such data to other formats.
If you need to convert unformatted floating-point data, keep in mind
that Compaq Fortran 77 for OpenVMS VAX programs (VAX hardware) store
the following:
- REAL*4 or COMPLEX*8 data in VAX F_float format
- REAL*8 or COMPLEX*16 data in either VAX D_float or G_float format
- REAL*16 data in VAX H_float format
In contrast, Compaq Fortran programs running on the Compaq Tru64 UNIX
or Linux Alpha operating system on Alpha hardware store the following:
- REAL*4 or COMPLEX*8 data in IEEE S_float format
- REAL*8 or COMPLEX*16 data in IEEE T_float format
- REAL*16 data or COMPLEX*32 data in native (IEEE style) X_float
format
Compaq Fortran 77 and Compaq Fortran for OpenVMS Alpha programs store
floating-point data in the format specified by the /FLOAT qualifier:
- REAL*4 or COMPLEX*8 data in VAX F_float or IEEE S_float format
- REAL*8 or COMPLEX*16 data in VAX D_float, VAX G_float, or IEEE
T_float format
- REAL*16 data or COMPLEX*32 data in native (IEEE style) X_float
format
For information on Compaq Fortran data types, see Chapter 9.
For More Information:
- On Compaq Fortran I/O, see Chapter 7.
- About the Compaq Fortran language, see the Compaq Fortran Language Reference Manual.
A.4.3 Nonnative VAX Floating-Point Representations
This section provides information about VAX floating-point data
formats. You can convert unformatted files from OpenVMS systems by
using the methods described in Chapter 10.
On OpenVMS VAX systems, single-precision data (such as REAL*4) is
stored in VAX F_float format and double-precision data (such as REAL*8)
data can be stored in either VAX D_float or VAX G_float formats,
depending on whether the /G_FLOATING qualifier was specified on the
FORTRAN command line (see the DEC Fortran User Manual for OpenVMS VAX Systems).
On OpenVMS Alpha systems, you can specify the floating-point format in
memory by using the /FLOAT qualifier (see the DEC Fortran User Manual for OpenVMS AXP Systems).
Single-precision data on OpenVMS Alpha systems is stored in either VAX
F_float or IEEE S_float formats; double-precision data can be stored in
VAX D_float, VAX G_float, or IEEE T_float formats.
REAL*16 (extended precision) data is always stored in IEEE style
X_float format on Alpha systems.
With VAX floating-point data types, the binary radix point is to the
left of the most-significant bit.
A.4.3.1 VAX F_float REAL (KIND=4) or REAL*4
Intrinsic REAL (KIND=4) or REAL*4 F_float data occupies four contiguous
bytes. Bits are labeled from the right, 0 through 31, as shown in
Figure A-1.
Figure A-1 VAX F_float REAL (KIND =4) or REAL*4
Representation
The form of REAL (KIND=4) or REAL*4 F_float data is sign magnitude,
where:
- Bit 15 is the sign bit (0 for positive numbers, 1 for negative
numbers).
- Bits 14:7 are a binary exponent in excess 128 notation (binary
exponents from --127 to 127 are represented by binary 1 to 255).
- Bits 6:0 and 31:16 are a normalized 24-bit fraction with the
redundant most significant fraction bit not represented.
When converting unformatted F_float data from an OpenVMS system, the
approximate range is 0.293873588E--38 to 1.7014117E38. The precision is
approximately one part in 2**23, typically seven decimal digits.
A.4.3.2 VAX G_float REAL (KIND=8) or REAL*8
Intrinsic REAL (KIND=8) or REAL*8 (same as DOUBLE PRECISION) G_float
data occupies eight contiguous bytes. The bits are labeled from the
right, 0 through 63, as shown in Figure A-2.
Figure A-2 VAX G_float REAL (KIND =8) or REAL*8
Representation
The form of REAL (KIND=8) or REAL*8 G_float data is sign magnitude,
where:
- Bit 15 is the sign bit (0 for positive numbers, 1 for negative
numbers).
- Bits 14:4 are a binary exponent in excess 1024 notation (binary
exponents from --1023 to 1023 are represented by the binary 1 to 2047).
- Bits 3:0 and 63:16 are a normalized 53-bit fraction with the
redundant most significant fraction bit not represented.
When converting unformatted G_float data from an OpenVMS system, the
approximate range is 0.5562684646268004D--308 to
0.89884656743115785407D308. The precision of G_float data is
approximately one part in 2**52, typically 15 decimal digits.
A.4.3.3 VAX D_float REAL (KIND=8) or REAL*8
Intrinsic REAL (KIND=8) or REAL*8 (same as DOUBLE PRECISION) D_float
data occupies eight contiguous bytes. Bits are labeled from the right,
0 through 63, as shown in Figure A-3.
Figure A-3 VAX D_float REAL (KIND =8) or REAL*8
Representation
The form of REAL (KIND=8) or REAL*8 D_float data is identical to an
F_float real number, except for an additional 32 low-significance
fraction bits. The exponent conventions and approximate range of values
are the similar to those for F_float.
When converting unformatted D_float data from an OpenVMS system, the
approximate range is 0.2938735877055719D--38 to 1.70141183460469229D38.
The precision is approximately one part in 2**55, typically 16 decimal
digits.
A.4.3.4 VAX F_float COMPLEX (KIND=4) or COMPLEX*8
Intrinsic COMPLEX (KIND=4) or COMPLEX*8 (single-precision COMPLEX) data
in VAX F_float format occupies eight contiguous bytes containing a pair
of REAL*4 values. The low-order four bytes contain REAL*4 data that
represents the real part of the complex number. The high-order four
bytes contain REAL (KIND=4) or REAL*4 data that represents the
imaginary part of the complex number. Figure A-4 shows a COMPLEX*8
number in F_float format.
Figure A-4 VAX F_float COMPLEX (KIND =4) or COMPLEX*8
Representation
The limits for REAL (KIND=4) or REAL*4 apply to the two separate real
and imaginary parts of a COMPLEX (KIND=4) or COMPLEX*8 number. Like
REAL (KIND=4) or REAL*4 numbers, the sign bit representation is 0
(zero) for positive numbers and 1 for negative numbers.
A.4.3.5 VAX G_float and D_float COMPLEX (KIND=8) or COMPLEX*16
Intrinsic COMPLEX (KIND=8) or COMPLEX*16 (same as DOUBLE COMPLEX) data
occupies 16 contiguous bytes containing a pair of REAL*8 or REAL
(KIND=8) values. COMPLEX (KIND=8) or COMPLEX*16 data from an OpenVMS
system is in one of the following REAL*8 or REAL (KIND=8) formats:
- VAX G_float format
- VAX D_float format
The low-order eight bytes contain REAL (KIND=8) or REAL*8 data that
represents the real part of the complex data. The high-order eight
bytes contain REAL (KIND=8) or REAL*8 data that represents the
imaginary part of the complex data, as shown in Figure A-5 (for
G_float) and Figure A-6 (for D_float).
Figure A-5 VAX G_float COMPLEX (KIND =8) or COMPLEX*16
Representation
Figure A-6 VAX D_float COMPLEX (KIND =8) or COMPLEX*16
Representation
The limits for REAL (KIND=8) or REAL*8 apply to the two separate real
and imaginary parts of a COMPLEX (KIND=8) or COMPLEX*16 number. Like
REAL (KIND=8) or REAL*8 numbers, the sign bit representation is 0
(zero) for positive numbers and 1 for negative numbers.
A.4.3.6 VAX H_float Representation
The REAL (KIND=16) or REAL*16 VAX H_float data format is used only on
OpenVMS VAX systems. On Alpha systems, REAL (KIND=16) extended
precision data is always stored in Alpha X_float format.
With VAX floating-point data types, the binary radix point is to the
left of the most-significant bit.
As shown in Figure A-7, REAL*16 H_float data is 16 contiguous bytes
starting on an arbitrary byte boundary. The bits are labeled from the
right, 0 through 127.
Figure A-7 VAX H_float REAL*16 Representation (VAX
Systems)
The form of an H_float REAL*16 data is sign magnitude with bit 15 the
sign bit, bits 14:0 an excess 16384 binary exponent, and bits 127:16 a
normalized 113-bit fraction with the redundant most significant
fraction bit not represented.
The value of H_float data is in the approximate range 0.84*10**--4932
through 0.59*10**4932. The precision of H_float data is approximately
one part in 2**112 or typically 33 decimal digits.
For More Information:
- On converting unformatted data files, see Chapter 10.
- On native floating-point ranges, see Table 9-1.
Note
1 OpenVMS Fortran refers collectively
to VAX FORTRAN, Compaq Fortran 77 for OpenVMS Alpha Systems, and Compaq
Fortran 77 for OpenVMS VAX Systems
|