- Page 1 and 2: HP Fortran Programmer’s Reference
- Page 3: Notice Copyright 1979-2003 Hewlett-
- Page 7 and 8: Contents 6. Execution control Contr
- Page 9 and 10: Contents Internalfile..............
- Page 11 and 12: Contents EXTERNAL(statementandattri
- Page 13 and 14: Contents Intrinsicprocedurespecific
- Page 15 and 16: Contents ICHAR(C) .................
- Page 17 and 18: Contents RANDOM_NUMBER(HARVEST) ...
- Page 19 and 20: Tables Table2-1.Fortran90characters
- Page 21 and 22: Preface The HP Fortran Programmer
- Page 23 and 24: Scope This guide covers programming
- Page 25 and 26: Table 1 (Continued) Curly brackets
- Page 27 and 28: Associated documents The following
- Page 29 and 30: 1 Introduction to HP Fortran This c
- Page 31 and 32: HP Fortran features Introduction to
- Page 33 and 34: Procedures Introduction to HP Fortr
- Page 35 and 36: 2 Language elements This chapter de
- Page 37 and 38: Character set Language elements Cha
- Page 39 and 40: Names Language elements Names In Fo
- Page 41 and 42: Statement labels Language elements
- Page 43 and 44: Language elements Statements Table
- Page 45 and 46: Statement labels Language elements
- Page 47 and 48: Spaces Language elements Source for
- Page 49 and 50: INCLUDE line Language elements INCL
- Page 51 and 52: 3 Data types and data objects This
- Page 53 and 54: Intrinsic data types Data types and
- Page 55 and 56:
Table 3-1 Intrinsic data types (Con
- Page 57 and 58:
Data types and data objects Intrins
- Page 59 and 60:
SUBROUTINE x(c) CHARACTER*(*) :: c
- Page 61 and 62:
Data types and data objects Intrins
- Page 63 and 64:
Data types and data objects Intrins
- Page 65 and 66:
Data types and data objects Intrins
- Page 67 and 68:
Data types and data objects Intrins
- Page 69 and 70:
Derived types Data types and data o
- Page 71 and 72:
Sequence derived type comp-name [(a
- Page 73 and 74:
Data types and data objects Derived
- Page 75 and 76:
PRINT *,’Heavy commute on rte.’
- Page 77 and 78:
Pointers Data types and data object
- Page 79 and 80:
A pointer example Data types and da
- Page 81 and 82:
4 Arrays This chapter describes arr
- Page 83 and 84:
Array fundamentals Arrays Array fun
- Page 85 and 86:
Array declarations An array is a da
- Page 87 and 88:
INTEGER, PARAMETER :: buffsize = 0
- Page 89 and 90:
Deferred-shape arrays Arrays Array
- Page 91 and 92:
! will have the shape [ n, n ] ALLO
- Page 93 and 94:
$ f90 assumed_size.f90 $ a.out main
- Page 95 and 96:
Arrays Array sections Section-subsc
- Page 97 and 98:
Example 4-3 vector_sub.f90 PROGRAM
- Page 99 and 100:
Arrays Array-valued structure compo
- Page 101 and 102:
Array constructors Arrays Array con
- Page 103 and 104:
Array expressions Arrays Array expr
- Page 105 and 106:
Array-valued functions Arrays Array
- Page 107 and 108:
Array inquiry intrinsics Arrays Arr
- Page 109 and 110:
5 Expressions and assignment This c
- Page 111 and 112:
Expressions Expressions and assignm
- Page 113 and 114:
Expressions and assignment Expressi
- Page 115 and 116:
Expressions and assignment Expressi
- Page 117 and 118:
Table 5-2 Operator precedence (Cont
- Page 119 and 120:
! a named integer constant coord(0.
- Page 121 and 122:
! integer nor character type Expres
- Page 123 and 124:
Assignment Expressions and assignme
- Page 125 and 126:
icnt = icnt + 1 ! integer assignmen
- Page 127 and 128:
contents of t1 referenced through p
- Page 129 and 130:
INTEGER :: num(:) CHARACTER :: lett
- Page 131 and 132:
6 Execution control The normal flow
- Page 133 and 134:
Control constructs and statement bl
- Page 135 and 136:
Execution control Control construct
- Page 137 and 138:
DO j = i+1, 100 IF (scores(i) > sco
- Page 139 and 140:
sum = sum + i n = n + 1 END DO aver
- Page 141 and 142:
Flow control statements Execution c
- Page 143 and 144:
EXIT statement Execution control Fl
- Page 145 and 146:
EXIT 20 i = 20 GO TO 100 30 i = 30
- Page 147 and 148:
PAUSE statement The PAUSE statement
- Page 149 and 150:
7 Program units and procedures This
- Page 151 and 152:
Terminology and concepts Program un
- Page 153 and 154:
Program units and procedures Termin
- Page 155 and 156:
internal-procedure-part takes the f
- Page 157 and 158:
External procedures Program units a
- Page 159 and 160:
keyword actual-argument alternate-r
- Page 161 and 162:
Program units and procedures Extern
- Page 163 and 164:
Internal procedures An internal pro
- Page 165 and 166:
Statement functions Program units a
- Page 167 and 168:
Arguments Program units and procedu
- Page 169 and 170:
... d(2,3,2) a(3,2) Program units
- Page 171 and 172:
! intrinsic procedure passed as tri
- Page 173 and 174:
! use PRESENT intrinsic to see if i
- Page 175 and 176:
Program units and procedures Argume
- Page 177 and 178:
Procedure interface Program units a
- Page 179 and 180:
Program units and procedures Proced
- Page 181 and 182:
Defined operators Program units and
- Page 183 and 184:
PRINT *, 'The point lies inside the
- Page 185 and 186:
PRINT *, 'Minimum =', user_stats%mi
- Page 187 and 188:
module-procedure-part Program units
- Page 189 and 190:
Program units and procedures Module
- Page 191 and 192:
Example 7-12 precision.f90 MODULE p
- Page 193 and 194:
END DO END SUBROUTINE back_substitu
- Page 195 and 196:
Program units and procedures Block
- Page 197 and 198:
8 I/O and file handling This chapte
- Page 199 and 200:
Records I/O and file handling Recor
- Page 201 and 202:
An integer or real array (HP Fortra
- Page 203 and 204:
OPEN (9, FILE='new_file') ... ! pro
- Page 205 and 206:
File access methods I/O and file ha
- Page 207 and 208:
Table 8-2 outlines the rules for th
- Page 209 and 210:
Namelist-directed I/O I/O and file
- Page 211 and 212:
I/O and file handling File access m
- Page 213 and 214:
I/O statements HP Fortran supports
- Page 215 and 216:
Syntax of I/O statements The genera
- Page 217 and 218:
Table 8-7 I/O statements and specif
- Page 219 and 220:
The following restrictions apply to
- Page 221 and 222:
ASA carriage control I/O and file h
- Page 223 and 224:
REAL (KIND=8) :: x CHARACTER (LEN=1
- Page 225 and 226:
Phil Atley 9 27 35 49 Harriet Myrle
- Page 227 and 228:
END IF 100 FORMAT (F16.6) 200 FORMA
- Page 229 and 230:
9 I/O formatting I/O formatting occ
- Page 231 and 232:
FORMAT statement I/O formatting FOR
- Page 233 and 234:
Edit descriptors I/O formatting Edi
- Page 235 and 236:
Table 9-1 Edit descriptors (Continu
- Page 237 and 238:
Slash (/) edit descriptor I/O forma
- Page 239 and 240:
Table 9-4 Contents of character dat
- Page 241 and 242:
I/O formatting Edit descriptors If
- Page 243 and 244:
I/O formatting Edit descriptors The
- Page 245 and 246:
Table9-11providesexamplesoftheE and
- Page 247 and 248:
The magnitude is less than 0.1 but
- Page 249 and 250:
w is a positive integer constant, s
- Page 251 and 252:
Table 9-18 provides examples of the
- Page 253 and 254:
I/O formatting Edit descriptors for
- Page 255 and 256:
I/O formatting Edit descriptors The
- Page 257 and 258:
I/O formatting Edit descriptors neg
- Page 259 and 260:
Nested format specifications I/O fo
- Page 261 and 262:
10 HP Fortran statements This chapt
- Page 263 and 264:
Attributes HP Fortran statements At
- Page 265 and 266:
Statements and attributes HP Fortra
- Page 267 and 268:
Examples HP Fortran statements ACCE
- Page 269 and 270:
HP Fortran statements ALLOCATABLE (
- Page 271 and 272:
Description HP Fortran statements A
- Page 273 and 274:
ASSIGN Assigns statement label to i
- Page 275 and 276:
Related concepts HP Fortran stateme
- Page 277 and 278:
Examples HP Fortran statements BACK
- Page 279 and 280:
BUFFER IN (extension) Provided for
- Page 281 and 282:
BUFFER OUT (extension) Provided for
- Page 283 and 284:
BYTE (extension) Declares entities
- Page 285 and 286:
CALL Invokes a subroutine. Syntax C
- Page 287 and 288:
CASE Marks start of statement block
- Page 289 and 290:
CASE (51:) PRINT *, 'BALANCE OKAY'
- Page 291 and 292:
Description HP Fortran statements C
- Page 293 and 294:
CLOSE Terminates file connection. S
- Page 295 and 296:
COMMON Specifies common blocks. Syn
- Page 297 and 298:
HP Fortran also allows blank—or u
- Page 299 and 300:
COMPLEX Declares entities of type c
- Page 301 and 302:
“Implicit typing” on page 31
- Page 303 and 304:
HP Fortran statements CONTAINS The
- Page 305 and 306:
CYCLE Interrupts current iteration
- Page 307 and 308:
DATA Initializes program variables.
- Page 309 and 310:
If a subscripted array element appe
- Page 311 and 312:
DEALLOCATE Deallocates allocatable
- Page 313 and 314:
DECODE (extension) Inputs formatted
- Page 315 and 316:
Related concepts For related inform
- Page 317 and 318:
attrib-list Table 10-7 entity-list
- Page 319 and 320:
! overrides specifier (10,20) for t
- Page 321 and 322:
HP Fortran statements DO When label
- Page 323 and 324:
“EXIT statement” on page 115 HP
- Page 325 and 326:
HP Fortran statements DOUBLE COMPLE
- Page 327 and 328:
Description HP Fortran statements D
- Page 329 and 330:
ELSE IF Provides alternate path of
- Page 331 and 332:
ELSEWHERE Introduces optional ELSEW
- Page 333 and 334:
IOSTAT=integer-variable out-list De
- Page 335 and 336:
END Marks the end of a program unit
- Page 337 and 338:
END (construct) Terminates a CASE,
- Page 339 and 340:
END INTERFACE Terminates a procedur
- Page 341 and 342:
ENDFILE Writes end-of-file record t
- Page 343 and 344:
ENTRY Provides an additional extern
- Page 345 and 346:
HP Fortran statements ENTRY name ac
- Page 347 and 348:
EQUIVALENCE Associates different ob
- Page 349 and 350:
HP Fortran statements EQUIVALENCE A
- Page 351 and 352:
EXIT Terminates a DO loop. Syntax E
- Page 353 and 354:
HP Fortran statements EXTERNAL (sta
- Page 355 and 356:
FORMAT DescribeshowI/Odataistobefor
- Page 357 and 358:
FUNCTION Introduces a function subp
- Page 359 and 360:
GO TO (assigned) Transfers control
- Page 361 and 362:
GO TO (unconditional) Transfers con
- Page 363 and 364:
IF (block) Begins an IF construct.
- Page 365 and 366:
IMPLICIT Changes or voids default t
- Page 367 and 368:
INCLUDE Imports text from a specifi
- Page 369 and 370:
INQUIRE Returns information about f
- Page 371 and 372:
Table 10-14 DIRECT=character-variab
- Page 373 and 374:
NAME=character-variable NAMED=logic
- Page 375 and 376:
READWRITE=character-variable Table
- Page 377 and 378:
HP Fortran statements INQUIRE The I
- Page 379 and 380:
INTEGER Declares entities of type i
- Page 381 and 382:
“Implicit typing” on page 31
- Page 383 and 384:
HP Fortran statements INTENT (state
- Page 385 and 386:
INTERFACE Introduces an interface b
- Page 387 and 388:
INTRINSIC (statement and attribute)
- Page 389 and 390:
LOGICAL Declares entities of type l
- Page 391 and 392:
“Array constructors” on page 73
- Page 393 and 394:
MODULE Introduces a module. Syntax
- Page 395 and 396:
MODULE PROCEDURE Specifies module p
- Page 397 and 398:
NAMELIST Names a group of variables
- Page 399 and 400:
NULLIFY Disassociates a pointer fro
- Page 401 and 402:
ON (extension) Specifies the action
- Page 403 and 404:
HP Fortran statements ON (extension
- Page 405 and 406:
Table 10-34 (Continued) 'READWRITE'
- Page 407 and 408:
POSITION=character-expression Table
- Page 409 and 410:
OPEN(10, FILE='inv', ERR=100, I0STA
- Page 411 and 412:
HP Fortran statements OPTIONAL (sta
- Page 413 and 414:
OPTIONS (extension) Lowers the opti
- Page 415 and 416:
HP Fortran statements PARAMETER (st
- Page 417 and 418:
PAUSE Temporarily stops program exe
- Page 419 and 420:
POINTER (Cray-style extension) Decl
- Page 421 and 422:
IF (p.EQ.0) THEN PRINT *, 'MALLOC f
- Page 423 and 424:
Description HP Fortran statements P
- Page 425 and 426:
PRINT Writes to standard output. Sy
- Page 427 and 428:
PRIVATE (statement and attribute) P
- Page 429 and 430:
Related concepts For related inform
- Page 431 and 432:
PUBLIC (statement and attribute) En
- Page 433 and 434:
“Type declaration for intrinsic t
- Page 435 and 436:
[NML=]name ADVANCE=character-expres
- Page 437 and 438:
Description HP Fortran statements R
- Page 439 and 440:
REAL Declares entities of type real
- Page 441 and 442:
“KIND(X)” on page 542 HP Fortra
- Page 443 and 444:
Given the following structure defin
- Page 445 and 446:
STRUCTURE /iarray/ BYTE elem_count
- Page 447 and 448:
Related concepts HP Fortran stateme
- Page 449 and 450:
Examples HP Fortran statements REWI
- Page 451 and 452:
Derived type objects Records HP For
- Page 453 and 454:
SELECT CASE Begins CASE construct.
- Page 455 and 456:
INTEGER high_temp, low_temp CHARACT
- Page 457 and 458:
IF (first_call) ncalls = 0 ncalls =
- Page 459 and 460:
STRUCTURE (extension) Defines a nam
- Page 461 and 462:
STRUCTURE /foo_bar/ REAL, DIMENSION
- Page 463 and 464:
HP Fortran statements STRUCTURE (ex
- Page 465 and 466:
A type declaration statement Anothe
- Page 467 and 468:
STRUCTURE /wordmask/ UNION MAP INTE
- Page 469 and 470:
SUBROUTINE altitude (*, long, lat)
- Page 471 and 472:
TARGET [::] object-name [(array-spe
- Page 473 and 474:
TASK COMMON (extension) Declares a
- Page 475 and 476:
TYPE (declaration) Declares a varia
- Page 477 and 478:
TYPE (Point) a, b, t(100,100) ! Thr
- Page 479 and 480:
! operations provide all functional
- Page 481 and 482:
UNION (extension) Defines a union w
- Page 483 and 484:
HP Fortran statements USE Entities
- Page 485 and 486:
VOLATILE (extension) Provides for d
- Page 487 and 488:
HP Fortran statements WHERE (statem
- Page 489 and 490:
Related concepts For related inform
- Page 491 and 492:
[NML=]name ADVANCE=character-expres
- Page 493 and 494:
HP Fortran statements WRITE In the
- Page 495 and 496:
11 Intrinsic procedures Intrinsic p
- Page 497 and 498:
Basic terms and concepts Intrinsic
- Page 499 and 500:
Optimized intrinsic functions Intri
- Page 501 and 502:
Data representation models Intrinsi
- Page 503 and 504:
s is the sign (+1 or -1). Intrinsic
- Page 505 and 506:
Table 11-3 Intrinsic procedures by
- Page 507 and 508:
Intrinsic procedure specifications
- Page 509 and 510:
Intrinsic procedures Intrinsic proc
- Page 511 and 512:
ADJUSTL(STRING) Description Adjust
- Page 513 and 514:
Result type/ type parameters Intrin
- Page 515 and 516:
AND(I, J) Description Logical AND.
- Page 517 and 518:
Class Transformational function. Ar
- Page 519 and 520:
ASINH(X) Description Hyperbolic arc
- Page 521 and 522:
Result value Intrinsic procedures I
- Page 523 and 524:
Result type/ type parameters Same a
- Page 525 and 526:
BTEST(I, POS) Description Tests a b
- Page 527 and 528:
Intrinsic procedures Intrinsic proc
- Page 529 and 530:
Result value Intrinsic procedures I
- Page 531 and 532:
Result type, type parameters, and s
- Page 533 and 534:
Argument Intrinsic procedures Intri
- Page 535 and 536:
Result type/ type parameters Double
- Page 537 and 538:
Result value Intrinsic procedures I
- Page 539 and 540:
Intrinsic procedures Intrinsic proc
- Page 541 and 542:
Intrinsic procedures Intrinsic proc
- Page 543 and 544:
Intrinsic procedures Intrinsic proc
- Page 545 and 546:
Class Nonstandard subroutine. FNUM(
- Page 547 and 548:
GETENV(VAR, VALUE) Description Retu
- Page 549 and 550:
Class Elemental function. Argument
- Page 551 and 552:
IARGC() Description Get the number
- Page 553 and 554:
Class Elemental function. Arguments
- Page 555 and 556:
Result value If X > Y, IDIM(X, Y) i
- Page 557 and 558:
Argument A must be of type INTEGER(
- Page 559 and 560:
KIND (optional) must be a scalar in
- Page 561 and 562:
Class Elemental nonstandard functio
- Page 563 and 564:
IQINT(A) Description Convert to int
- Page 565 and 566:
Intrinsic procedures Intrinsic proc
- Page 567 and 568:
Result value Thevalueoftheresultis|
- Page 569 and 570:
Result Intrinsic procedures Intrins
- Page 571 and 572:
Result type/ type parameters The re
- Page 573 and 574:
LEN_TRIM(STRING) Description Intrin
- Page 575 and 576:
Intrinsic procedures Intrinsic proc
- Page 577 and 578:
Class Elemental function. Argument
- Page 579 and 580:
Class Elemental nonstandard functio
- Page 581 and 582:
MAX(A1, A2, A3, ...) Optional argum
- Page 583 and 584:
Result value Intrinsic procedures I
- Page 585 and 586:
Class Inquiry nonstandard function.
- Page 587 and 588:
Result type, type parameters, and s
- Page 589 and 590:
Intrinsic procedures Intrinsic proc
- Page 591 and 592:
Intrinsic procedures Intrinsic proc
- Page 593 and 594:
Result type/ type parameters Intrin
- Page 595 and 596:
Table 11-11 Truth table for OR intr
- Page 597 and 598:
Result value Intrinsic procedures I
- Page 599 and 600:
QEXT(A) Description Convert to REAL
- Page 601 and 602:
Class Inquiry function. Argument X
- Page 603 and 604:
Argument Intrinsic procedures Intri
- Page 605 and 606:
Description Convert to real type. C
- Page 607 and 608:
Arguments Intrinsic procedures Intr
- Page 609 and 610:
RSHIFT(I, SHIFT) Description Bitwis
- Page 611 and 612:
Argument X must be of type REAL(4).
- Page 613 and 614:
SET_EXPONENT(X, I) Description Intr
- Page 615 and 616:
SIN(X) Description Sine function in
- Page 617 and 618:
SIZE(ARRAY, DIM) Optional argument
- Page 619 and 620:
SPREAD(SOURCE, DIM, NCOPIES) Descri
- Page 621 and 622:
Intrinsic procedures Intrinsic proc
- Page 623 and 624:
Arguments Intrinsic procedures Intr
- Page 625 and 626:
Result value Intrinsic procedures I
- Page 627 and 628:
Intrinsic procedures Intrinsic proc
- Page 629 and 630:
Arguments Intrinsic procedures Intr
- Page 631 and 632:
BACK (optional) must be of type log
- Page 633 and 634:
12 BLAS and libU77 libraries This c
- Page 635 and 636:
Calling libU77 and BLAS routines BL
- Page 637 and 638:
SUBROUTINE without_decl PRINT *, TT
- Page 639 and 640:
libU77 routines BLAS and libU77 lib
- Page 641 and 642:
Table 12-3 libU77 routines (Continu
- Page 643 and 644:
Table 12-3 libU77 routines (Continu
- Page 645 and 646:
Table 12-3 libU77 routines (Continu
- Page 647 and 648:
Table 12-3 libU77 routines (Continu
- Page 649 and 650:
Table 12-4 BLAS routines (Continued
- Page 651 and 652:
A I/O runtime error messages This a
- Page 653 and 654:
Runtime I/O errors I/O runtime erro
- Page 655 and 656:
Table A-1 Runtime I/O errors (Conti
- Page 657 and 658:
Table A-1 Runtime I/O errors (Conti
- Page 659 and 660:
Table A-1 Runtime I/O errors (Conti
- Page 661 and 662:
Table A-1 Runtime I/O errors (Conti
- Page 663 and 664:
Glossary A actual argument Avalue,v
- Page 665 and 666:
uilt-in functions %REF and %VAL—H
- Page 667 and 668:
array or apply independently to the
- Page 669 and 670:
literal constant A constant that do
- Page 671 and 672:
shared library A library of routine
- Page 673 and 674:
Symbols $HP$ CHECK_OVERFLOW directi
- Page 675 and 676:
assignment, 96 expressions, 83 glos
- Page 677 and 678:
BDIM intrinsics function, 509 BIAND
- Page 679 and 680:
ZTRMV, 621 ZTRSM, 621 ZTRSV, 621 bl
- Page 681 and 682:
BLOCK DATA statement, 250 COMMON st
- Page 683 and 684:
CHARACTER statement, 262 complex, 2
- Page 685 and 686:
DTAND intrinsics function, 596 DTAN
- Page 687 and 688:
union extension, 438 VOLATILE state
- Page 689 and 690:
newline ($) edit descriptor, 184, 2
- Page 691 and 692:
FREE intrinsic, 517 Cray-style poin
- Page 693 and 694:
IIDNNT intrinsics function, 565 IIE
- Page 695 and 696:
ABS, 479 ACHAR, 480 ACOS, 481 ACOSD
- Page 697 and 698:
IGETARG, 528 IIAND, 522 IIBCLR, 524
- Page 699 and 700:
QSIGN, 586 QSIN, 587 QSIND, 588 QSI
- Page 701 and 702:
L Leditdescriptor, 222 labels, 13 f
- Page 703 and 704:
man pages, xxiii BLAS routines, 610
- Page 705 and 706:
INTERFACE statement, 357 USE statem
- Page 707 and 708:
main program, 126, 402 module, 158,
- Page 709 and 710:
estrictions, 423 STATIC statement,
- Page 711 and 712:
END IF, 309 END INTERFACE, 311 END
- Page 713 and 714:
counter-controlled DO loop, 107 def
- Page 715 and 716:
REWIND statement, 420 WRITE stateme