Fortran Language Reference Manual, Volume 2 SR–3903 3.0.1 Copyright © 1993, 1997 Cray Research, Inc
Total Page:16
File Type:pdf, Size:1020Kb
Fortran Language Reference Manual, Volume 2 SR–3903 3.0.1 Copyright © 1993, 1997 Cray Research, Inc. All Rights Reserved. This manual or parts thereof may not be reproduced in any form unless permitted by contract or by written permission of Cray Research, Inc. The CF90 compiler includes United States software patents 5,247,696, 5,257,372, and 5,361,354. Portions of this product may still be in development. The existence of those portions still in development is not a commitment of actual release or support by Cray Research, Inc. Cray Research, Inc. assumes no liability for any damages resulting from attempts to use any functionality or documentation not officially released and supported. If it is released, the final form and the time of official release and start of support is at the discretion of Cray Research, Inc. Autotasking, CF77, CRAY, Cray Ada, CraySoft, CRAY Y-MP, CRAY-1, CRInform, CRI/TurboKiva, HSX, LibSci, MPP Apprentice, SSD, SUPERCLUSTER, UNICOS, and X-MP EA are federally registered trademarks and Because no workstation is an island, CCI, CCMT, CF90, CFT, CFT2, CFT77, ConCurrent Maintenance Tools, COS, Cray Animation Theater, CRAY APP, CRAY C90, CRAY C90D, Cray C++ Compiling System, CrayDoc, CRAY EL, CRAY J90, CRAY J90se, CrayLink, Cray NQS, Cray/REELlibrarian, CRAY S-MP, CRAY SSD-T90, CRAY T90, CRAY T3D, CRAY T3E, CrayTutor, CRAY X-MP, CRAY XMS, CRAY-2, CSIM, CVT, Delivering the power . ., DGauss, Docview, EMDS, GigaRing, HEXAR, IOS, ND Series Network Disk Array, Network Queuing Environment, Network Queuing Tools, OLNET, RQS, SEGLDR, SMARTE, SUPERLINK, System Maintenance and Remote Testing Environment, Trusted UNICOS, UNICOS MAX, and UNICOS/mk are trademarks of Cray Research, Inc. Adapted with permission of McGraw-Hill, Inc. from the FORTRAN 90 HANDBOOK, Copyright © 1992 by Walter S. Brainerd, Jeanne C. Adams, Jeanne T. Martin, Brian T. Smith, and Jerrold L. Wagener. All rights reserved. Cray Research, Inc. is solely responsible for the content of this work. DynaWeb is a trademark of Electronic Book Technologies, Inc. MIPS is a registered trademark and MIPSpro is a trademark of MIPS Technologies, Inc. PostScript is a trademark of Adobe Systems, Inc. Silicon Graphics, the Silicon Graphics logo, and IRIS are registered trademarks and IRIX is a trademark of Silicon Graphics, Inc. SPARC is a trademark of SPARC International, Inc. Sun Microsystem is a trademark of Sun Microsystems, Inc. TotalView is a trademark of Bolt Baranek and Newman, Inc. UNIX is a registered trademark in the United States and other countries, licensed exclusively to X/Open Limited. The UNICOS operating system is derived from UNIX® System V. The UNICOS operating system is also based in part on the Fourth Berkeley Software Distribution (BSD) under license from The Regents of the University of California. New Features Fortran Language Reference Manual, Volume 2 SR–3903 3.0.1 This manual describes the Fortran 90 language as implemented by the Cray Research CF90 compiler, releases 3.0 and 3.0.1, and the MIPSpro 7 Fortran 90 compiler, revision 7.2. Revision 3.0 of the Fortran language reference manual set describes the following features, all of which are extensions to the Fortran 90 standard: • AUTOMATIC statement and attribute. The AUTOMATIC statement and attribute allow you to declare that an array or variable is based on the stack. Items declared as AUTOMATIC become undefined when the procedure that contains them is exited. • The <>,or.LG., operator. This logical operator is suggested by the IEEE standard for floating-point arithmetic. • PURE and ELEMENTAL keywords for subroutines and functions. These features assist programmers interested in parallel processing. PURE declares that the procedure has no side effects. ELEMENTAL declares that the procedure contains scalar dummy arguments but that they may correspond to array actual arguments. When the actual arguments are array-valued, the function result is the same as the result that would have been obtained by operating on each element of the actual argument array independently. • An optional [DIM=]dim argument has been added to the MAXLOC(3I) and MINLOC(3I) intrinsic procedures. • On UNICOS systems, the RESHAPE(3I) intrinsic procedure vectorizes. • The following intrinsic procedures vectorize on UNICOS/mk systems: LOG(3M), EXP(3M), SQRT(3M), RANF(3I), SIN(3M), POPCNT(3I), and COS(3M). For more information on vectorization on UNICOS/mk systems, see CF90 Commands and Directives Reference Manual, publication SR–3901. This manual is one of several manuals that describe the Fortran 90 language as implemented by the CF90 compiler and the MIPSpro 7 Fortran 90 compiler. If information on one of the preceding features cannot be found in this manual, please see the other manuals in the Fortran language reference manual set. Revision 3.0.1, which is provided in online form only, contains corrections and features to support the CF90 3.0.1 release and the MIPSpro 7 Fortran 90 7.2 release. Changes to support this revision are noted with change indicators. Record of Revision Version Description 2.0 November 1995. Original printing. This document supports the CF90 compiler release 2.0 running on Cray PVP systems, CRAY T3E systems, and SPARC systems. The implementation of features on CRAY T3E systems is deferred. This manual contains information that was previously contained in the CF90 Fortran Language Reference Manual, revision 1.0, publication SR–3902, and in the Application Programmer’s Library Reference Manual, publication SR–2165. 3.0 May 1997. This printing supports the Cray Research CF90 3.0 release running on UNICOS and UNICOS/mk operating systems, and the MIPSpro 7 Fortran 90 compiler 7.2 release running on the IRIX operating system. The implementation of features on IRIX operating system platforms is deferred. This manual contains information that was previously contained in the CF90 Fortran Language Reference Manual, Volume 1, revision 2.0, publication SR–3902. 3.0.1 August 1997. This online revision supports the Cray Research CF90 3.0.1 release, running on UNICOS and UNICOS/mk operating systems, and the MIPSpro 7 Fortran 90 compiler 7.2 release, running on the IRIX operating system. SR–3903 3.0.1 i Contents Page Preface xvii Related CF90 and MIPSpro 7 Fortran 90 compiler publications .......... xviii CF90 and MIPSpro 7 Fortran 90 compiler messages .............. xviii CF90 and MIPSpro 7 Fortran 90 compiler man pages . .......... xix Related Fortran publications . .................... xix Related publications . .................... xx Ordering publications . .................... xx Conventions . ......................... xxi BNF conventions ........................ xxii Reader comments ........................ xxiv Input and Output (I/O) Processing [1] 1 Records, files, access methods, and units . ............... 2 Records . ......................... 2 Kinds of files ......................... 4 External files ........................ 6 Internal files ........................ 6 File existence ........................ 6 File position ......................... 7 File access methods . .................... 9 Sequential access . .................... 9 Direct access ........................ 10 Units . ......................... 10 Unit existence ........................ 11 Establishing a connection to a unit . ............... 12 Data transfer statements . .................... 12 SR–3903 3.0.1 iii Fortran Language Reference Manual, Volume 2 Page The I/O control specifiers . .................... 13 UNIT= control specifier . .................... 14 FMT= control specifier . .................... 15 NML= control specifier . .................... 16 ADVANCE= control specifier .................... 16 END= control specifier . .................... 17 EOR= control specifier . .................... 17 ERR= control specifier . .................... 18 IOSTAT= control specifier .................... 19 REC= control specifier . .................... 20 SIZE= control specifier . .................... 20 The I/O item list ........................ 21 Explicitly formatted advancing sequential access data transfer .......... 23 Unformatted sequential access ................... 26 Nonadvancing formatted sequential data transfer .............. 27 Direct access data transfer . .................... 30 Formatted direct access data transfer . ............... 30 Unformatted direct access data transfer . ............... 32 List-directed data transfer . .................... 34 Namelist data transfer . .................... 36 Form of a namelist group declaration . ............... 36 Forms of namelist I/O statements . ............... 37 Data transfer on internal files .................... 38 Printing formatted records . .................... 41 BUFFER IN and BUFFER OUT statements (EXTENSION) . .......... 41 Execution model for data transfer statements . ............... 45 Data transfer ......................... 46 File position prior to data transfer . ............... 46 File position after data transfer ................... 47 iv SR–3903 3.0.1 Contents Page Error and other conditions in I/O statements . ............... 47 OPEN statement ......................... 50 Connecting a file to a unit . .................... 50 Creating a file on a preconnected unit . ............... 50 Changing the connection properties . ............... 51 Form of the OPEN statement .................... 51 The connection specifiers . .................... 52 UNIT= specifier . .................... 53 ACCESS= specifier . .................... 53 ACTION= specifier . .................... 53 BLANK=