1 FORTRAN Invokes the VSI Fortran for OpenVMS compiler. This command is described in detail in the VSI Fortran for OpenVMS User Manual. For more information on VSI Fortran, including the latest online documentation, see: http://www.hp.com/go/fortran/ Format of the Fortran command line: FORTRAN[/qualifiers] file-spec-list[/qualifiers] To invoke the Compaq Fortran 77 compiler, use FORTRAN/OLD_F77 (Alpha only). 2 Parameters /qualifiers Indicates either special actions to be performed by the compiler or special properties of input or output files. file-spec-list Specifies the source files containing the program units to be compiled. You can specify more than one source file. If source file specifications are separated by commas (,), the programs are compiled separately. If source file specifications are separated by plus signs (+), the files are concatenated and compiled as one program. When compiling source files with the /OPTIMIZE qualifier (the default), concatenating source files allows full interprocedural optimizations to occur. In specifying a list of input files on the Fortran command line, you can use abbreviated file specifications for those files that share common device names, directory names, or file names. The system applies temporary file specification defaults to those files with incomplete specifications. The defaults applied to an incomplete file specification are based on the previous device name, directory name, or file name encountered in the list. The output produced by the compiler includes the object and listing files. You can control the production of these files by using the appropriate qualifiers on the Fortran command line. For complete information on these command-line parameters, see the HP Fortran for OpenVMS User Manual. 2 Qualifiers Fortran command qualifiers influence the way in which the compiler processes a file. In many cases, the simple Fortran command is sufficient. However, you can select appropriate optional qualifiers if special processing is required. 2 /ALIGNMENT[=p] D=/ALIGN=(COMM=(PACK,NOMULTI),RECO=NATU) /[NO]ALIGNMENT Controls whether the VSI Fortran compiler naturally aligns fields in records or data items in common blocks, or whether the compiler packs those fields and data items together on arbitrary byte boundaries. Although VSI Fortran always aligns local data items on natural boundaries, certain data declaration statements and misaligned arguments can force misaligned data. Use the /ALIGNMENT qualifier to control the alignment of fields associated with common blocks, derived-type structures, and record structures. The compiler issues messages when it detects misaligned data by default (/WARNINGS=ALIGNMENT). For information about the causes of misaligned data and detection at run time, see the HP Fortran for OpenVMS User Manual. NOTE Misaligned data significantly increases the time it takes to execute a program, depending on the number of misaligned fields encountered. Specifying /ALIGNMENT=ALL (same as /ALIGNMENT=NATURAL) minimizes misaligned data. To obtain compiler messages when misaligned data is encountered, use the /WARNING=ALIGNMENT qualifier (or within the OpenVMS Debugger, use the command SET BREAK/UNALIGNED). Parameter "p" is a specifier with one of the following forms: [class =] rule (class = rule [,...]) SEQUENCE ALL (or NATURAL) MULTILANGUAGE NONE (or PACKED) PAD_ALIGN_SIZE class Is one of the following keywords: COMMONS (for common blocks) RECORDS (for derived-type and record structures) STRUCTURES (for derived-type and record structures) In VSI Fortran, STRUCTURES and RECORDS are the same. rule Is one of the following keywords: NATURAL Naturally aligns fields in derived-type and record structures and data items in common blocks on up to 8-byte boundaries. If you specify NATURAL, the compiler will naturally align all data in a common block, including INTEGER(KIND=8), REAL(KIND=8), and all COMPLEX data. PACKED Packs fields in derived-type and record structures or data items in common blocks on arbitrary byte boundaries. STANDARD Naturally aligns data items in common blocks on up to 4-byte boundaries (consistent with the Fortran 95/90 and FORTRAN 77 standards). The compiler will not naturally align INTEGER(KIND=8), REAL(KIND=8), and COMPLEX data declarations. Such data declarations should be planned so they fall on natural boundaries. Specifying /ALIGNMENT=COMMONS=STANDARD alone means that the default for record structures is used. Note that this keyword only applies to common blocks; therefore, you can specify /ALIGNMENT=COMMONS=STANDARD, but you cannot specify /ALIGNMENT=STANDARD. [NO]MULTILANGUAGE Controls whether the compiler pads the size of common blocks to ensure compatibility when the common block program section is shared by code created by other compilers running on OpenVMS. When a program section generated by a Fortran common block is overlaid with a program section consisting of a C structure, linker error messages can result. This is because the sizes of the program sections are inconsistent; the C structure is padded and the Fortran common block is not. Specifying /ALIGNMENT=COMMON=MULTILANGUAGE ensures that HP Fortran follows a consistent program section size allocation scheme that works with DEC C program sections that are shared across multiple images. Program sections shared in a single image do not have a problem. The corollary DEC C qualifier is /PSECT_MODEL=[NO]MULTILANGUAGE. The default is /ALIGNMENT=COMMON=NOMULTILANGUAGE, which is also the default behavior of HP Fortran 77 (formerly Compaq Fortran 77) and is sufficient for most applications. This keyword only applies to common blocks; therefore, you can specify /ALIGNMENT=COMMONS=[NO]MULTILANGUAGE, but you cannot specify /ALIGNMENT=[NO]MULTILANGUAGE. [NO]PAD_ALIGN_SIZE Controls whether the compiler pads the size of common blocks based on the alignment size. Specifying /ALIGNMENT=COMMON=PAD_ALIGN_SIZE ensures that the padding appended to the common blocks makes the program section size allocation as large as the alignment size. Using this keyword results in a program section allocation incompatible with sharing across multiple images if those images are not Fortran images which have also been compiled with this keyword. This keyword applies only to common blocks; therefore, you can specify /ALIGNMENT=COMMON=[NO]PAD_ALIGN_SIZE, but you cannot specify /ALIGNMENT=[NO]PAD_ALIGN_SIZE. [NO]SEQUENCE Specifies whether or not SEQUENCE types follow the alignment rule currently in effect. If SEQUENCE is in effect, then SEQUENCE types participate in alignment the same as derived types without the SEQUENCE property. If NOSEQUENCE is in effect, SEQUENCE types are always packed, regardless of the current alignment rules. ALL Is equivalent to /ALIGNMENT, /ALIGNMENT=(NATURAL, SEQUENCE) and /ALIGNMENT=(COMMONS=(NATURAL, NOMULTILANGUAGE), RECORDS=NATURAL, SEQUENCE). NONE Is equivalent to /NOALIGNMENT, /ALIGNMENT=(PACKED, NOSEQUENCE), and /ALIGNMENT=(COMMONS=(PACKED, NOMULTILANGUAGE), RECORDS=PACKED, NOSEQUENCE). Defaults depend whether the /ALIGNMENT and /FAST qualifiers are specified, as follows: Command Line Default ------------ ------- Omit /ALIGNMENT and /ALIGNMENT=(NOSEQUENCE, COMMONS=(PACKED, omit /FAST NOMULTILANGUAGE), RECORD=NATURAL) Omit /ALIGNMENT and /ALIGNMENT=(SEQUENCE, COMMONS=(NATURAL, specify /FAST NOMULTILANGUAGE), RECORD=NATURAL) /ALIGNMENT=COMMONS=rule Use whatever the /ALIGNMENT qualifier specifies for COMMONS, but use the default of RECORDS=NATURAL /ALIGNMENT=RECORD=rule Use whatever the /ALIGNMENT qualifier specifies for RECORDS, but use the default of COMMONS (depends whether /FAST was specified or omitted) If you specify /ALIGNMENT=class=rule, the rule only applies to that class, the other class gets aligned according to the default; for example: 1. /ALIGNMENT=COMMONS=STANDARD In this case, RECORDS=NATURAL by default. 2. /ALIGNMENT=RECORDS=NATURAL In this case, COMMONS=PACKED by default. To request packed, unaligned data in a derived-type or record structure, specify /ALIGNMENT=RECORDS=PACKED, or consider placing source data declarations for the structure so that the data is naturally aligned. To request aligned data in common blocks, specify /ALIGNMENT=COMMONS=STANDARD (for data items up to 4 bytes in length) or /ALIGNMENT=COMMONS=NATURAL (for data items up to 8 bytes length), or place source data declarations within the common block carefully so that each data field is naturally aligned. The /ALIGNMENT and /WARN=ALIGNMENT qualifiers can be used together in the same command line. You can override the alignment specified on the command line by using a CDEC$ OPTIONS directive, as described in the HP Fortran for OpenVMS Language Reference Manual. You can also specify /ALIGNMENT=REC2BYTE or /ALIGNMENT=REC4BYTE. These options specify that fields of records and components of derived types are to be aligned on the smaller of: o The 2- or 4-byte boundary specified o The boundary that will naturally align them These options do not affect whether common blocks are naturally aligned or packed. 2 /ANALYSIS_DATA[=file] D=/NOANALYSIS_DATA /[NO]ANALYSIS_DATA Produces an analysis data file that contains cross-reference and static-analysis information about the source code being compiled. Analysis data files are reserved for use by HP products such as, but not limited to, the Source Code Analyzer (SCA). If you omit the file specification, the analysis file name has the name of the primary source file and a file type of ANA (filename.ANA). The compiler produces one analysis file for each source file that it compiles. If you are compiling multiple files and you specify a particular name as the name of the analysis file, each analysis file is given that name (with an incremental version number). The default is /NOANALYSIS_DATA. 2 /ANNOTATIONS=option D=/NOANNOTATIONS Requests that annotations be added to the source listing (/LIST) indicating which of a set of optimizations were applied to particular parts of the source. Annotation options may exist for optimizations not supported on this platform. Annotations can be helpful in understanding why the compiler was unable to optimize a particular code sequence or to see what optimizations were performed. The default is /ANNOTATIONS=NONE which is equivalent to /NOANNOTATIONS. Options ALL or NONE may be used to specify all or no annotations. CODE Annotates the machine code listing with descriptions of special instructions used for prefetching, alignment, and so on. DETAIL Provides an additional level of annotation detail, if available. FEEDBACK Annotates the source listing if profile-directed feedback optimizations were used. INLINING Annotates the source listing if code for a called procedure was expanded inline. LOOP_TRANSFORMS Annotates the source listing if advanced loop nest optimizations have been applied to improve cache performance. LOOP_UNROLLING Annotates the source listing if a loop was unrolled. PREFETCHING Annotates the source listing if special instructions were used to reduce memory latency. SHRINKWRAPPING Annotates the source listing if code establishing routine context was removed. SOFTWARE_PIPELINING Annotates the source listing if instructions have been rearranged to make optimal use of the processor's functional units. TAIL_CALLS Annotates the source listing if the optimization was used that indicates where a call from one routine to another can be replaced by a jump. TAIL_RECURSION Annotates the source listing if the optimization was used that eliminates unnecessary routine context for a recursive call. ALL This option is the same as specifying all the above options. NONE Places no annotations in the source listing (same as /NOANNOTATIONS. 2 /ARCHITECTURE=option (Alpha only) D=/ARCHITECTURE=GENERIC Determines the target generation of Alpha chip for which code will be generated for this program. The /ARCHITECTURE qualifier uses the same options (keywords) as the /OPTIMIZE=TUNE (Alpha only) qualifier. Whereas the /OPTIMIZE=TUNE qualifier is primarily used by certain higher-level optimizations for instruction scheduling purposes, the /ARCHITECTURE qualifier determines the type of code instructions generated for the program unit being compiled. OpenVMS Version 7.1 and subsequent releases will provide an operating system kernel that includes an instruction emulator. This emulator allows new instructions, not implemented on the host processor chip, to execute and produce correct results. Applications using emulated instructions will run correctly, but may incur significant software emulation overhead at runtime. All Alpha processors implement a core set of instructions. Certain Alpha processor versions include additional instruction extensions. The following /ARCHITECTURE options are supported: GENERIC Generates code that is appropriate for all Alpha processor generations. This is the default. Programs compiled with the GENERIC option run all implementations of the Alpha architecture without any instruction emulation overhead. HOST Generates code for the processor generation in use on the system being used for compilation. Programs compiled with this option run on other implementations of the Alpha architecture might encounter instruction emulation overhead. EV4 Generates code for the 21064, 21064A, 21066, and 21068 implementations of the Alpha architecture. Programs compiled with the EV4 option run without instruction emulation overhead on all Alpha processors. EV5 Generates code for some 21164 chip implementations of the Alpha architecture that use only the base set of Alpha instructions (no extensions). Programs compiled with the EV5 option run without instruction emulation overhead on all Alpha processors. EV56 Generates code for some 21164 chip implementations that use the byte and word manipulation instruction extensions of the Alpha architecture. Programs compiled with the EV56 option may incur emulation overhead on EV4 and EV5 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. EV6 Generates code for the 21264 chip implementation that uses the following extensions to the base Alpha instruction set: BWX (Byte/Word manipulation) and MAX (Multimedia) instructions, square root and floating-point convert instructions, and count instructions. Programs compiled with the EV6 option may incur emulation overhead on EV4, EV5, EV56, and PCA56 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. EV67 Generates code for chip implementations that use advanced instruction extensions of the Alpha architecture. This option permits the compiler to generate any EV67 instruction, including the following extensions to the base Alpha instruction set: BWX (Byte/Word manipulation), MVI (Multimedia) instructions, square root and floating-point convert extensions (FIX), and count extensions (CIX). Programs compiled with the EV67 option may incur emulation overhead on EV4, EV5, EV56, EV6 and PCA56 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. PCA56 Generates code for the 21164PC chip implementation that uses the byte and word manipulation instruction extensions and multimedia instruction extensions of the Alpha architecture. Programs compiled with the PCA56 option may incur emulation overhead on EV4, EV5, and EV56 processors, but still run correctly on OpenVMS Version 7.1 (or later) systems. 2 /ASSUME=(opt[,...]) /[NO]ASSUME Specifies various assumptions, including the following: o What the compiler can assume about program behavior without affecting correct results when it optimizes code. o Whether the compiler should use certain code transformations that affect floating-point operations. These changes may affect the accuracy of the program's results. o Whether a single-precision constant assigned to a double-precision variable should be evaluated in single or double precision. o Changes the directory where the compiler searches for files specified by an INCLUDE statement to the directory where the source files reside, not the current default directory. The defaults are /ASSUME=(ACCURACY_SENSITIVE, ALTPARAM, NOBUFFERED_IO, NOBYTERECL, NODUMMY_ALIASES, NOF77RTL, NOFP_CONSTANT, NOINT_CONSTANT, PROTECT_CONSTANTS, NOSOURCE_INCLUDE,NO64BIT_STRING_PARAMS). [NO]ACCURACY_SENSITIVE Specifies whether certain code transformations that affect floating-point operations are allowed. These changes may or may affect the accuracy of the program's results. The default, /ASSUME=ACCURACY_SENSITIVE, directs the compiler to use only naive scalar rules for calculations. This setting may prevent some optimizations. Specifying /ASSUME=NOACCURACY_SENSITIVE allows the compiler to reorder floating-point operations based on algebraic identities (inverses, associativity, and distribution). For example, this allows the compiler to move divide operations outside of loops, thereby improving performance. The numeric results can be slightly different from the default (/ASSUME=ACCURACY_SENSITIVE) because of the way intermediate results are rounded. Numeric results with /ASSUME=NOACCURACY_SENSITIVE are not categorically less accurate. They can produce more accurate results for certain floating-point calculations, such as dot product summations. For example, the following expressions are mathematically equivalent but may not compute the same value using finite precision arithmetic. X = (A + B) - C X = A + (B - C) [NO]ALTPARAM Allows or disallows the alternate syntax for PARAMETER statements. The alternate form has no parentheses surrounding the list, and the form of the constant, rather than inplicit or explicit typing, determines the data type of the variable. The default is /ASSUME=ALTPARAM. [NO]BUFFERED_IO Controls whether buffered I/O is used for all Fortran logical units opened for sequential writing. The default is /ASSUME=NOBUFFERED_IO. [NO]BYTERECL Specifies (for unformatted data files) that the units for the OPEN statement RECL specifier (record length) value are in bytes, not longwords (four-byte units). For formatted files, the RECL unit is always in bytes. INQUIRE returns RECL in bytes if the unit is not open. INQUIRE returns RECL in longwords if the file is open for unformatted data and /ASSUME=BYTERECL is not specified; otherwise, it returns RECL in bytes. [NO]DUMMY_ALIASES Specifies whether dummy (formal) arguments are permitted to share memory locations with COMMON block variables or other dummy arguments. If you specify /ASSUME=DUMMY_ALIASES, the compiler assumes that dummy (formal) arguments to procedures may share memory locations with other dummy arguments or with variables shared through use association, host association, or common block use. These program semantics do not strictly obey the Fortran 95/90 standard and slow performance. If you specify /ASSUME=NODUMMY_ALIASES, the default, the compiler does not need to make these assumptions, which results in better run-time performance. However, omitting /ASSUME=DUMMY_ALIASES can cause some programs that depend on such aliases to fail or produce wrong answers. You only need to compile the called subprogram with /ASSUME=DUMMY_ALIASES. If you compile a program containing dummy aliasing with /ASSUME=NODUMMY_ALIASES in effect, the run-time behavior of the program will be unpredictable. The run-time behavior will depend on the exact optimizations that are performed. In some cases, normal results will occur. However, in other cases, results will differ because the values used in computations involving the offending aliases will differ. [NO]F77RTL Specifies whether certain run-time I/O defaults are to match those of HP Fortran 77 compilers. If you specify /ASSUME=F77RTL, the following behavior changes: - In NAMELIST-directed output, the HP Fortran 77 extension $ delimiters are used instead of the Fortran 90 standard delimiters - PAD='NO' is the default when files are opened The default is /ASSUME=NOF77RTL, which specifies that Fortran 95 semantics are to be followed. [NO]FP_CONSTANT Specifies whether a single-precision constant assigned to a double-precision variable will be evaluated in double precision. If you use /ASSUME=NOFP_CONSTANT (the default), a single-precision constant assigned to a double-precision variable is evaluated in single precision. The Fortran 95/90 standard requires that the constant be evaluated in single precision. If you specify /ASSUME=FP_CONSTANT, a single-precision constant assigned to a double-precision variable is evaluated in double precision. Certain programs created for Fortran 77 compilers (including HP Fortran 77) may show different results with /ASSUME=FP_CONSTANT than when you use /ASSUME=NOFP_CONSTANT, because they rely on single-precision constants assigned to a double-precision variable to be evaluated in double precision. In the following example, if you specify /ASSUME=FP_CONSTANT, identical values are assigned to D1 and D2. If you use /ASSUME=NOFP_CONSTANT, VSI Fortran will follow the standard and assign a less precise value to D1: REAL(KIND=8) D1,D2 DATA D1 /2.71828182846182/ ! REAL(KIND=4) value expanded to double DATA D2 /2.71828182846182D0/ ! REAL(KIND=8) value assigned to double [NO]INT_CONSTANT Specifies whether Fortran 77 or Fortran 95/90 semantics are used to determine the type for integer constants. If you specify /ASSUME=INT_CONSTANT, integer constants take their type from the value, as interpreted by HP Fortran 77. If you specify /ASSUME=NOINT_CONSTANT, integer constants have Fortran 95/90 "default integer" type. This is the default. [NO]MINUS0 Specifies whether the compiler uses F95 or F90/FORTRAN 77 standard semantics for the treatment of the IEEE floating value -0.0 in the SIGN intrinsic. If you specify /ASSUME=NOMINUS0, F90 (FORTRAN 77) standard semantics are used, where IEEE floating value -0.0 is treated as 0.0. This is the default. If /ASSUME=MINUS0 is specified, F95 standard semantics are used, where IEEE floating value -0.0 is treated as -0.0. Note that the processor must be capable of distinguishing the difference between -0.0 and +0.0. [NO]PROTECT_CONSTANTS Specifies whether a copy of a constant actual argument is passed. /ASSUME=NOPROTECT_CONSTANTS causes a copy of a constant actual argument to be passed, so it can be modified by the called routine, even though the Fortran Standard prohibits such modification. The constant is not modified in the calling routine. The default, /ASSUME=PROTECT_CONSTANTS, passes the constant actual argument. Any attempt to modify it results in an error. [NO]SOURCE_INCLUDE Specifies the directory where the compiler searches for source files or text libraries specified by an INCLUDE statement. The default, /ASSUME=NOSOURCE_INCLUDE, indicates that the compiler should search in the current default directory. Specifying /ASSUME=SOURCE_INCLUDE causes the compiler to search the directory of the source file specified on the F90 command line, instead of the current default directory. You can specify additional directories for the compiler to search for include files or include libraries by using the /INCLUDE qualifier. [NO]64BIT_STRING_PARAMS Specifies whether all string variables uses as parameters should use 64-bit descriptors. The default, /ASSUME=NO64BIT_STRING_PARAMS, indicates that the compiler should generate 32-bit descriptors for string variables unless such a variable is individually specified for a 64-bit descriptor by using a compiler directive. Specifying /ASSUME=64BIT_STRING_PARAMS causes ALL string variables used as parameters to be passed/received by 64-bit descriptors. Note that an unwanted side effect of changing explicit or implicit parameters to system calls or the Fortran Runtime Library can occur, causing runtime errors. For more information, see the HP Fortran for OpenVMS User Manual. 2 /AUTOMATIC D=/NOAUTOMATIC /[NO]AUTOMATIC The /AUTOMATIC and /NOAUTOMATIC qualifiers are synonyms of /RECURSIVE or /NORECURSIVE (see /RECURSIVE in this Help file). This qualifier is provided for compatibility with HP Fortran 77 (formerly Compaq Fortran 77). 2 /BY_REF_CALL=routine-list /BY_REF_CALL Causes character constants used as actual arguments in calls to routines to be passed by reference (%REF) instead of by descriptor (%DESCR). This helps applications that pass quoted character constants to numeric dummy parameters, such as applications ported from OpenVMS VAX systems that rely on the OpenVMS VAX Linker, to change the argument passing mechanism for character constant actual arguments. The "routine-list" is a list of one or more routine names (in parentheses); it can contain "*" wild-carding. The default is to always pass character constant actual arguments by descriptor. 2 /CCDEFAULT=option D=/CCDEFAULT=DEFAULT Specifies the type of carriage control used for units that are connected by default to the terminal (units 5, 6, and *, and the units implicitly specified by PRINT and TYPE). If output from one of these units is redirected to a file, /CCDEFAULT is ignored. FORTRAN Specifies normal Fortran interpretation of the first character (CARRIAGECONTROL=FORTRAN). LIST Specifies one line feed between records (CARRIAGECONTROL=LIST). NONE Specifies no carriage control processing (CARRIAGECONTROL=NONE). DEFAULT Specifies that the compiler is to use the default carriage-control setting. The default is /CCDEFAULT=DEFAULT. The default setting can be affected by the /VMS qualifier: if "/VMS /CCDEFAULT=DEFAULT" is specified, carriage control defaults to FORTRAN if the file is formatted, and the unit is connected to a terminal; if "/NOVMS /CCDEFAULT=DEFAULT" is specified, carriage control defaults to LIST. 2 /CHECK=(option[,...]) D=/CHECK=(NOARG,NOAR,NOBO,FOR,NOFP,NOFP_M, NOOUT,NOOV,POW,NOUN) /[NO]CHECK Controls whether the compiler performs certain error checking during program execution (run time). The compiler produces extra code that performs the checks. [NO]ARG_INFO (I64 only) Controls whether run-time checking of the actual argument list occurs. For actual arguments that correspond to declared formal parameters, the check compares the run-time argument type information for arguments passed in registers with the type that is expected. An informational message is issued at run time for each miscompare. Extra actual arguments or too few actual arguments are not reported. With the default, NOARG_INFO, no check is made. [NO]ARG_TEMP_CREATED Controls whether run-time checking occurs for actual arguments being copied into temporary storage before routine calls. With the default, /CHECK=NOARG_TEMP_CREATED, no check is performed. When /CHECK=ARG_TEMP_CREATED is specified, if a copy is made at run-time, an informative message is displayed. [NO]BOUNDS Controls whether run-time checking occurs for each dimension of an array reference or substring subscript reference to determine whether it is within the range of the dimension specified by the array or character variable declaration. With the default, NOBOUNDS, array bounds checking and substring checking do not occur. [NO]FORMAT Controls whether the run-time message number 61 (FORVARMIS) is displayed and halts program execution when the data type for an item being formatted for output does not match the format descriptor being used (such as a REAL data item with an I format). The default, FORMAT, causes FORVARMIS to be a fatal error and halts program execution. Specifying NOFORMAT ignores the format mismatch, which suppresses the FORVARMIS error and allows the program to continue. If you omit /NOVMS and omit /CHECK=NOFORMAT, the default is /CHECK=FORMAT. If you specify /NOVMS, the default is NOFORMAT (unless you also specify /CHECK=FORMAT). [NO]FP_EXCEPTIONS Controls whether run-time checking counts each operation that generates exceptional values. With the default, NOFP_EXCEPTIONS, no run-time messages are reported. Specifying FP_EXCEPTIONS requests reporting of the first two occurrences of each type of exceptional value and a summary run-time message at program completion that displays the number of times exceptional values occurred. Consider using FP_EXCEPTIONS when the /IEEE_MODE qualifier allows generation of exceptional values. To limit reporting to only denormalized numbers (and not other exceptional numbers), specify UNDERFLOW instead of FP_EXCEPTIONS. [NO]FP_MODE (I64 only) Controls whether run-time checking of the current state of the processor's floating-point status register (FPSR) occurs. For every call of every function or subroutine, the check will compare the current state of the FPSR register against the expected state. That state is based on the /FLOAT, /IEEE_MODE and /ROUND qualifier values specified by the FORTRAN command. An informational message is issued at run time for miscompares. With the default, NOFP_MODE, no check is made. [NO]OUTPUT_CONVERSION Controls whether run-time message number 63 (OUTCONERR) is displayed when format truncation occurs. Specifying /CHECK=NOOUTPUT_CONVERSION disables the run-time message (number 63) associated with format truncation. The data item is printed with asterisks. When OUTPUT_CONVERSION is in effect and a number can not be output in the specified format field length without loss of significant digits (format truncation), the OUTCONERR (number 63) error occurs. If you omit /NOVMS and omit /CHECK=NOOUTPUT_CONVERSION, the default is OUTPUT_CONVERSION. If you specify /NOVMS, the default is NOOUTPUT_CONVERSION (unless you also specify /CHECK=OUTPUT_CONVERSION). [NO]OVERFLOW Controls whether run-time checking occurs for arithmetic overflow of all integer calculations. Specify OVERFLOW to request integer overflow checking. With the default, NOOVERFLOW, overflow checking does not occur. Real and complex calculations are always checked for overflow and are not affected by /NOCHECK. Integer exponentiation is performed by a routine in the mathematical library. The routine in the mathematical library always checks for overflow, even if /CHECK=NOOVERFLOW is specified. [NO]POWER Suppresses the run-time errors for 0.0**0.0 and **, so 0.0**0.0 is 1.0 and (-3.0)**3.0 is -27.0. The default is /CHECK=POWER, which causes fatal run-time errors. [NO]UNDERFLOW Controls whether run-time messages are displayed for floating underflow (denormalized numbers) in floating-point calculations. Specify UNDERFLOW to request reporting of the first two occurrences of denormalized numbers and a summary run-time message at program completion that displays the number of times denormalized numbers occurred. With the default, NOUNDERFLOW, floating underflow messages are not displayed. To check for all exceptional values (not just denormalized numbers), specify /CHECK=FP_EXCEPTIONS. For more information about exceptional floating-point values and exception handling, see the HP Fortran for OpenVMS User Manual. ALL Requests that all run-time checks (BOUNDS, FORMAT, FP_EXCEPTIONS, OUTPUT_CONVERSION, OVERFLOW, and UNDERFLOW) be performed. Specifying /CHECK and /CHECK=ALL are equivalent. NONE Requests no run-time checking. Specifying /NOCHECK and /CHECK=NONE are equivalent. 2 /CONVERT=option D=/CONVERT=NATIVE Specifies the format of numeric unformatted data in a file. By default, an unformatted file containing numeric data is assumed to be in the same floating-point format used for memory representation or /CONVERT=NATIVE. You set the floating-point format used for memory representation using the /FLOAT qualifier. There are other ways to specify format for numeric unformatted files: you can specify an OpenVMS logical name, OPEN (CONVERT=), or OPTIONS/CONVERT. The order of precedence is: 1. A logical name The form is FOR$CONVERTnnn, where "nnn" is the logical unit number (including leading zeros if necessary). 2. OPEN (CONVERT=) 3. OPTIONS/CONVERT 4. The qualifier /CONVERT The /CONVERT qualifier and OPTIONS/CONVERT affect all unit numbers used by the program, while a logical name and OPEN (CONVERT=) affect specific unit numbers. The /CONVERT qualifier specifies a default data-conversion type for all logical units opened in the program unit, either explicitly by an OPEN statement or implicitly by a READ, WRITE or other I/O statement (with the exception of DEFINE FILE). For more information on using unformatted data files, using OpenVMS logical names to specify CONVERT options, and information about the ranges of the various data types, see the HP Fortran for OpenVMS User Manual. BIG_ENDIAN Specifies that numeric data in unformatted files is in big endian integer format (INTEGER declarations of the appropriate size) and IEEE floating-point format (REAL and COMPLEX declarations of the appropriate size). INTEGER(KIND=1) data is the same for little endian and big endian. CRAY Specifies that numeric data in unformatted files is in big endian integer format (INTEGER declarations of the appropriate size) and CRAY floating-point format (REAL and COMPLEX declarations of the appropriate size). FDX Specifies that numeric data in unformatted files is in little endian integer format (INTEGER declarations of the appropriate size). It also specifies VAX floating-point format F_floating (for size REAL(KIND=4) and COMPLEX(KIND=4)), D_floating (for size REAL(KIND=8) and COMPLEX(KIND=8)), and IEEE X_floating (for size REAL(KIND=16)). FGX Specifies that numeric data in unformatted files is in little endian integer format (INTEGER declarations of the appropriate size). It also specifies VAX floating-point format F_floating (for size REAL(KIND=4) and COMPLEX(KIND=4)) and G_floating (for size REAL(KIND=8) and COMPLEX(KIND=8)), and IEEE X_floating (for size REAL(KIND=16)). IBM Specifies that numeric data in unformatted files is in big endian integer format (INTEGER declarations of the appropriate size) and IBM System\370 floating-point format (REAL and COMPLEX declarations of the appropriate size). LITTLE_ENDIAN Specifies that numeric data in unformatted files is in little endian integer format (INTEGER declarations of the appropriate size) and IEEE IBM System\370 floating-point format (REAL and COMPLEX declarations of the appropriate size). INTEGER(KIND=1) data is the same for little endian and big endian. NATIVE Specifies that numeric data in unformatted files is determined by the floating-point format representation in memory, which is specified using the /FLOAT qualifier. If you omit the /FLOAT qualifier and specify the obsolete /[NO]G_FLOATING qualifier, the format specified by the /[NO]G_FLOATING qualifier is used. This is the default. VAXD Specifies that numeric data in unformatted files is in little endian integer format (INTEGER declarations of the appropriate size). It also specifies HP VAX floating-point format F_floating (for size REAL(KIND=4) and COMPLEX(KIND=4)) and D_floating (for size REAL(KIND=8) and COMPLEX(KIND=8)), and H_floating (for size REAL(KIND=16)). VAXG Specifies that numeric data in unformatted files is in little endian integer format (INTEGER declarations of the appropriate size). It also specifies HP VAX floating-point format F_floating (for size REAL(KIND=4) and COMPLEX(KIND=4)) and G_floating (for size REAL(KIND=8) and COMPLEX(KIND=8)), and H_floating (for size REAL(KIND=16)). 2 /D_LINES D=/NOD_LINES /[NO]D_LINES Specifies that the compiler should treat fixed-format lines that contain a D in column 1 as source code rather than comment lines. The default is /NOD_LINES, which means that fixed-format lines with a D in column 1 are treated as comments. This qualifier is ignored for free-format source code. 2 /DEBUG=(option[,...]) D=/DEBUG=(NOSYMBOLS,TRACEBACK) /[NO]DEBUG Requests that the object module contain information for use by the OpenVMS Debugger and the run-time error traceback mechanism. [NO]SYMBOLS Controls whether the compiler provides the debugger with local symbol definitions for user-defined variables, arrays (including dimension information), structures, and labels of executable statements. [NO]TRACEBACK Controls whether the compiler provides an address correlation table so that the debugger and the run-time error traceback mechanism can translate virtual addresses into source program routine names and compiler-generated line numbers. ALL Requests that the compiler provide both local symbol definitions and an address correlation table. NONE Requests that the compiler provide no debugging information. If you omit the /DEBUG qualifier, the default is /DEBUG=(TRACEBACK,NOSYMBOLS). If you specify /DEBUG without any keywords, it is the same as /DEBUG=ALL or /DEBUG=(TRACEBACK,SYMBOLS). The /NODEBUG, /DEBUG=NONE, and /DEBUG=(NOTRACEBACK,NOSYMBOLS) qualifiers are equivalent. NOTE It is strongly recommended that you use /NOOPTIMIZE when using the /DEBUG qualifier. Optimizations performed by the compiler can cause several different kinds of unexpected behavior when using the OpenVMS Debugger. For more information on debugging and traceback, see the HP Fortran for OpenVMS User Manual. 2 /DIAGNOSTICS[=file-spec] D=/NODIAGNOSTICS /[NO]DIAGNOSTICS Controls whether the compiler creates a file containing compiler messages and diagnostic information. The default is /NODIAGNOSTICS. If you omit the file specification, the diagnostics file has the name of your source file and a file type of DIA. The diagnostics file is reserved for use with HP layered products such as, but not limited to, the Language Sensitive Editor (LSE). 2 /DOUBLE_SIZE[=n] D=/DOUBLE_SIZE=64 /DOUBLE_SIZE The /DOUBLE_SIZE qualifier lets you specify the data size for floating-point DOUBLE PRECISION data declarations. You can specify 64 or 128 for "n". To request that all DOUBLE PRECISION declarations, constants, functions, and intrinsic procedures use the REAL(KIND=16) extended-precision data, specify /DOUBLE_SIZE=128. REAL(KIND=16) data is stored in memory using X_floating format. The default is /DOUBLE_SIZE=64, which specifies that DOUBLE PRECISION entities use REAL(KIND=8) (64-bit) double-precision data. To select the floating-point format used in memory for 64-bit REAL(KIND=8) data, use the /FLOAT qualifier. 2 /ERROR_LIMIT[=n] D=/ERROR_LIMIT=30 /[NO]ERROR_LIMIT Specifies the maximum number of E-level or F-level compiler errors allowed for a given file specified on the F90 command line. Error counts are accumulated across a sequence of compilation units. If you specify /ERROR_LIMIT=n, the compilation can have up to n - 1 errors without terminating the compilation. When the error limit is reached, compilation is terminated. The /ERROR_LIMIT=0 option is equivalent to ERROR_LIMIT=1. If you specify /NOERROR_LIMIT, there is no limit on the number of errors that are allowed. By default, execution of the compiler is terminated when the 30th E-level or F-level error (equivalent to /ERROR_LIMIT=30) is issued. When the error limit is surpassed, only compilation on the current comma-list element is terminated; the compiler will proceed to compile any other comma-list element. For example, consider the following: $ FORT A,B,C If comma-list element A has more than 30 E- or F-level errors, its compilation is terminated, but the compiler proceeds to compile elements B and C. 2 /EXTEND_SOURCE D=/NOEXTEND_SOURCE /[NO]EXTEND_SOURCE Controls whether the compiler increases the length of Fortran statement fields in fixed-format source programs to column 132, instead of column 72 (the default). The default is /NOEXTEND_SOURCE. You can also specify this qualifier using the OPTIONS statement. This qualifier is ignored for free-format source code. 2 /F77 (Alpha only) D=/F77 /[NO]F77 Controls whether the compiler uses FORTRAN-77 interpretation rules for those statements that have a meaning incompatible with FORTRAN-66. See the HP Fortran for OpenVMS User Manual for a discussion of these incompatibilities. The default is /F77. If you specify /NOF77, the compiler selects FORTRAN-66 interpretations in cases of incompatibility. If you omit /NOF77, DO loops whose lower range exceeds the upper range are not executed. You can also specify this qualifier using the OPTIONS statement. 2 /FAST /FAST Sets the following qualifiers that usually improve run-time performance: /ALIGNMENT=(NATURAL, SEQUENCE), /ARCHITECTURE=HOST, /ASSUME=NOACCURACY_SENSITIVE, /MATH_LIBRARY=FAST (Alpha only), /OPTIMIZE=(TUNE=HOST) (Alpha only). The default is /NOFAST. If qualifier /STANDARD is specified, /FAST does not set /ALIGNMENT=(NATURAL, SEQUENCE). Note that programs compiled with HOST architecture and tuning optimizations may run slowly on systems with earlier generations of Alpha processors than the compiling host system. 2 /FLOAT=option D=/FLOAT=IEEE_FLOAT (I64) D=/FLOAT=G_FLOAT (Alpha) Specifies the floating-point data format to be used in memory for REAL or COMPLEX data. For performance reasons, consider specifying the same floating-point memory format as the floating-point format used by unformatted files the program will access if the data falls within the acceptable range. To specify a floating-point format (such as big endian) for all unformatted files opened by the program, use the /CONVERT qualifier. To allow the same program to use different floating-point formats, you must use predefined logical names or the OPEN (CONVERT=) keyword to specify the format for specific unit numbers, as described in the HP Fortran for OpenVMS User Manual. You can only specify one qualifier option. D_FLOAT Specifies that the memory format for REAL(KIND=4) and COMPLEX(KIND=4) data is VAX F_floating and that the memory format for REAL(KIND=8) and COMPLEX(KIND=8) data is VAX D_floating. This option is the same as the obsolete qualifier /NOG_FLOATING. NOTE OpenVMS VAX systems support D_floating and G_floating implementations of the DOUBLE PRECISION (REAL(KIND=8)) data type in memory. OpenVMS Alpha systems can store REAL(KIND=8) floating-point data in memory in D_floating, G_floating, or T_floating format. Because the Alpha instruction set does not support D_floating computations, D_floating data is converted to G_floating format for arithmetic computations and then converted back to D_floating format. For programs that perform many REAL(KIND=8) computations, using D_floating data is slower than using G_floating or T_floating data and the results will differ from VAX D_floating computations and results. Unless a program uses unformatted data files in D_floating format, do not use the /FLOAT=D_FLOAT option. If range and accuracy constraints do not disallow the use of the other REAL(KIND=8) data types, consider converting existing unformatted files that contain D_floating data to another format, such as G_floating, T_floating, or X_floating to optimize performance. (For more information, see the HP Fortran for OpenVMS User Manual.) G_FLOAT Specifies that the memory format for REAL(KIND=4) and COMPLEX(KIND=4) data is VAX F_floating and that REAL(KIND=8) and the memory format for COMPLEX(KIND=8) data is VAX G_floating. This option is the same as the obsolete qualifier /G_FLOATING. NOTE Because the I64 instruction set does not support F_floating, D_floating, or G_floating computations, data in those formats is converted to IEEE format (S_floating or T_floating) for arithmetic computations and then converted back to the original format. For programs that perform many REAL (KIND=4 or KIND=8) computations, using F_floating, D_floating, or G_floating data will be slower than using S_floating or T_floating data. The results may differ from slightly from Alpha F_floating, D_floating, or G_floating computations and results. In particular, exceptions raised by the calculation may be different, and some exceptions may no longer occur, while new exceptions may appear. This the default floating-point format for Alpha systems. IEEE_FLOAT Specifies that the memory format for REAL(KIND=4) and COMPLEX(KIND=4) data is IEEE S_floating and the memory format for REAL(KIND=8) and COMPLEX(KIND=8) data is IEEE T_floating. This format lets you use the /IEEE_MODE qualifier. This is the default floating-point format for I64 systems. If your program requires the G_floating form of double precision for its correct operation (it uses a range larger than 10**38), you should use the /FLOAT qualifier in an OPTIONS statement in your source program. You should not mix floating data type formats in routines that pass single-precision or double-precision quantities amongst themselves. For more information on floating-point data types, see the HP Fortran for OpenVMS User Manual. 2 /GRANULARITY=option D=/GRANULARITY=QUADWORD Controls the size of data that can be safely accessed from different threads. You do not need to specify this option for local data access by a single process, unless asynchronous write access from outside the user process might occur. The default is /GRANULARITY=QUADWORD. Data that can be written from multiple threads must be declared as VOLATILE (so it is not held in registers). To ensure alignment in common blocks and derived-type and record structures, use the /ALIGNMENT qualifier. You can only specify one of the qualifier options. BYTE Ensures that all data (one byte or greater) can be accessed from different threads sharing data in memory. This option will slow run-time performance. LONGWORD Ensures that naturally aligned data of longword size (4 bytes) or greater can be accessed safely from different threads sharing data in memory. When this option is in effect, attempts to access smaller size data or misaligned data can result in data items that are inconsistently updated for multiple threads. QUADWORD Ensures that naturally aligned data of quadword size (8 bytes) can be accessed safely from different threads sharing data in memory. This is the default. When this option is in effect, attempts to access smaller size data or misaligned data can result in data items that are inconsistently updated for multiple threads. 2 /IEEE_MODE=option D=/IEEE_MODE=DENORM (I64) D=/IEEE_MODE=FAST (Alpha) Specifies the arithmetic exception handling used for floating-point calculations, such as for exceptional values. It also controls the precision of exception reporting (like /SYNCHRONOUS_EXCEPTIONS (Alpha only)). Exceptional values are associated with IEEE arithmetic and include Infinity (+ and -) values, Not-A-Number (NaN) values, invalid data values, and denormalized numbers. (See the HP Fortran for OpenVMS User Manual.) Use the /IEEE_MODE qualifier to control: o Whether exceptional values cause program termination or continuation o Whether exception reporting is precise o Whether underflowed (denormalized) values are set to zero This qualifier only applies to arithmetic calculations when: o You omit the /MATH_LIBRARY=FAST (Alpha only) qualifier (or /FAST) qualifier. Using /MATH_LIBRARY=FAST provides limited handling of exceptional values of arguments to and results from VSI Fortran intrinsic functions. o You specify the /FLOAT=IEEE_FLOAT qualifier to request IEEE S_floating (REAL(KIND=4)) and T_floating (REAL(KIND=8)) data. If you specify /FLOAT=G_FLOAT (the default on Alpha) or /FLOAT=D_FLOAT, only the default (/IEEE_MODE=FAST) can be used. Because X_floating data (REAL(KIND=16)) has no denormalized range, DENORM_RESULTS is equivalent to UNDERFLOW_TO_ZERO for X_floating data. NOTE You should choose the value for the /IEEE_MODE qualifier based on the floating-point semantics your application requires, not on possible performance benefits. FAST Specifies that the program should stop if any exceptional values are detected. When the program encounters or calculates any exceptional values (Infinity (+ or -), NaN, or invalid data) in a calculation, the program stops and displays a message. This allows the fastest run-time performance. Denormalized values calculated in an arithmetic expression are set to zero. Denormalized values encountered as variables in an arithmetic expression (including constant values) are treated as invalid data (an exceptional value), which stops the program. Exceptions are not reported until one or more instructions after the instruction that caused the exception. To have exceptions reported at the instruction that caused the exception when using /IEEE_MODE=FAST, also specify /SYNCHRONOUS_EXCEPTIONS (Alpha only). /IEEE_MODE=FAST is the default on Alpha systems. UNDERFLOW_TO_ZERO Specifies that the program should continue if any exceptional values are detected and that calculated denormalized (underflow) values should be set to zero. When the program encounters an exceptional value (Infinity (+ or -), NaN, or invalid data) in an arithmetic expression, the program continues. It also continues when the result of a calculation is an exceptional value. Calculated denormalized values are set to zero. This prevents the denormalized number from being used in a subsequent calculation (propagated). Exceptions are reported at the instruction that caused the exception (same as /SYNCHRONOUS_EXCEPTIONS). This allows precise run-time reporting of exceptions for those programs that generate exceptional values, but slows program run-time performance. Using UNDERFLOW_TO_ZERO allows programs to handle exceptional values, but does not propagate numbers in the denormalized range. To request run-time messages for arithmetic exceptions, specify the /CHECK=FP_EXCEPTIONS qualifier. DENORM_RESULTS Specifies that the program should continue if any exceptional values are detected and that calculated denormalized values should be left as is (allows underflow). When the program encounters an exceptional value (Infinity (+ or -), NaN, or invalid data) in an arithmetic expression, the program continues. It also continues when the result of a calculation is an exceptional value. Calculated denormalized values are left as denormalized values. When a denormalized number is used in a subsequent arithmetic expression, it requires extra software-assisted handling and slows performance. A program that generates denormalized numbers will be slower than the same program compiled using /IEEE_MODE=UNDERFLOW_TO_ZERO. Exceptions are reported at the instruction that caused the exception (same as /SYNCHRONOUS_EXCEPTIONS). This allows precise run-time reporting of exceptions for those programs that generate exceptional values, but slows program run-time performance. Using DENORM_RESULTS allows programs to handle exceptional values, including allowing underflow of denormalized numbers. To request run-time messages for arithmetic exceptions, specify the /CHECK=FP_EXCEPTIONS qualifier. To request run-time messages for only those arithmetic exceptions related to denormalized numbers, specify the /CHECK=UNDERFLOW qualifier. /IEEE_MODE=DENORM_RESULTS is the default on I64 systems. 2 /INCLUDE=(dir[,...]) D=NOINCLUDE /[NO]INCLUDE Specifies an additional directory for the VSI Fortran compiler to search for module files or include files: o Module files are specified by a USE statement. The module files have a file type of F90$MOD and are created by the HP Fortran compiler. o Include files are specified by an INCLUDE statement. The include files have a file type like other VSI Fortran source files (F90, FOR, or F) in the following form: INCLUDE 'name' or INCLUDE 'name.ext' You can also include library modules from a text library, where the name of the module appears within parentheses ((name)). If the INCLUDE statement specifies an explicit device and/or directory, only that directory is searched. Directories are searched in the following order: 1. The current directory (if /ASSUME=SOURCE_INCLUDE is omitted) or the directory where the source file resides (if /ASSUME=SOURCE_INCLUDE is specified). 2. One or more directories specified by the /INCLUDE qualifier. 3. The standard system location. To prevent searching in this directory, specify /NOINCLUDE. To limit the compiler's search to the current directory (or the directory where the source file resides), specify /NOINCLUDE. To control the searching for only text libraries (not module files and included source files), you can use the logical name F90$LIBRARY or FORT$LIBRARY. Like other OpenVMS logical names, the name can specify the location for only your process or for multiple processes (including system-wide). For example, you can specify additional directories DISKA:[P_MODULE.F90] and DISKB:[F_COMMON.F90] with the /INCLUDE qualifier as follows: $ F90 PROJ_M.F90 /INCLUDE=(DISKA:[P_MODULE.F90],DISKB:[F_COMMON.F90]) If you specify multiple directories, the order of the directories (and their devices) in the /INCLUDE qualifier determines the directory search order. 2 /INTEGER_SIZE=n D=/INTEGER_SIZE=32 /INTEGER_SIZE Controls how the compiler interprets INTEGER or LOGICAL declarations that do not have a specified length. The default is /INTEGER_SIZE=32. You can specify the following values: /INTEGER=16 INTEGER declarations are interpreted as INTEGER(KIND=2) and LOGICAL declarations as LOGICAL(KIND=2). This is the same as the obsolete /NOI4 qualifier. /INTEGER=32 INTEGER declarations are interpreted as INTEGER(KIND=4) and LOGICAL declarations as LOGICAL(KIND=4). This is the same as the obsolete /I4 qualifier. /INTEGER=64 INTEGER declarations are interpreted as INTEGER(KIND=8) and LOGICAL declarations as LOGICAL(KIND=8). You must explicitly declare INTEGER(KIND=1) data. NOTE To improve performance, use /INTEGER_SIZE=32 rather than /INTEGER_SIZE=16 and declare variables as INTEGER(KIND=4) (or INTEGER(KIND=8)) rather than INTEGER(KIND=2) or INTEGER(KIND=1). For logical data, avoid using /INTEGER_SIZE=16 and declare logical variables as LOGICAL(KIND=4) rather than LOGICAL(KIND=2) or LOGICAL(KIND=1). 2 /LIBRARY Specifies that a file is a text library file. The /LIBRARY qualifier can be specified on one or more text library files in a list of files concatenated by plus signs (+). At least one of the files in the list must be a nonlibrary file. The default file type is TLB. The use of text libraries is discussed at length in the HP Fortran for OpenVMS User Manual. 2 /LIST[=file-spec] D=/NOLIST /[NO]LIST Requests a source listing file. You can request additional listing information using the /MACHINE_CODE and /SHOW qualifiers. The default is /LIST for a batch process, and /NOLIST for an interactive process. You can include a file specification for the listing file. If you omit the file specification, the listing file has the name of the first source file and a file type of LIS. The default depth of a page in a listing file is 66 lines. To modify the default, assign the new number to the logical name SYS$LP_LINES using the DCL command DEFINE. For example, the following DCL command sets the page depth at 88 lines: $ DEFINE SYS$LP_LINES 88 The valid number of lines per page ranges from 30 to a maximum of 255. The definition can be applied to the entire system by using the command DEFINE/SYSTEM. In interactive mode, the compiler does not produce a listing file unless you include the /LIST qualifier. In batch mode, the compiler produces a listing file by default. In either case, the listing file is not automatically printed; you must use the PRINT command to obtain a line printer copy of the listing file. If a source line contains a form-feed character, that line is printed but the form-feed character is ignored (does not generate a new page). If a source line of length 1 contains a Ctrl/Z character, the source code listing contains a blank line in place of the Ctrl/Z character. Any other nonprinting ASCII characters encountered in HP Fortran source files are replaced by a space character and a warning message appears. For more information on the format of listing files, see the HP Fortran for OpenVMS User Manual. 2 /MACHINE_CODE D=/NOMACHINE_CODE /[NO]MACHINE_CODE Controls whether the listing file includes a symbolic representation of the OpenVMS Alpha object code generated by the compiler. Generated code and data are represented in a form similar to a MACRO assembly code listing. The code produced by the /MACHINE_CODE qualifier is for informational purposes only. It is not intended to be assembled and is not supported by the MACRO assembler. If a listing file is not being generated, the /MACHINE_CODE qualifier is ignored. The default is /NOMACHINE_CODE. See the HP Fortran for OpenVMS User Manual for a description of the format of a machine code listing. 2 /MATH_LIBRARY=option (Alpha only) D=/MATH_LIBRARY=ACCURATE /MATH_LIBRARY Controls selection of math library routines to provide accurate or fast results for VSI Fortran intrinsic functions, such as SQRT. The default is /MATH_LIBRARY=ACCURATE. This qualifier applies only to IEEE data types (when you specify /FLOAT=IEEE_FLOAT). You can only specify one of the qualifier options. ACCURATE Causes the compiler to produce the very accurate results and error checking expected of quality compiler products. It uses the standard set of math library routines for the applicable intrinsics. The standard math library routines are designed to obtain very accurate "near correctly rounded" results and provide the robustness needed to check for IEEE exceptional argument values, rather than achieve the fastest possible run-time execution speed. Using /MATH_LIBRARY=ACCURATE allows user control of arithmetic exception handling with the /IEEE_MODE qualifier. FAST Causes the compiler to use versions of certain math library routines that perform faster computations than the standard, more accurate math library routines, but with slightly less fractional accuracy and less reliable arithmetic exception handling. Using /MATH_LIBRARY=FAST allows certain math library functions to get significant performance improvements when the applicable intrinsic function is used. If you specify /MATH_LIBRARY=FAST, the math library routines do not necessarily check for IEEE exceptional values and the /IEEE_MODE qualifier is ignored. When you use MATH_LIBRARY=FAST, you should carefully check the calculated output from your program to verify it is not relying on the full fractional accuracy of the floating-point data type to produce correct results. You should also verify that the calculated output is not producing unexpected exceptional values (exception handling is indeterminate). Programs that do not produce acceptable results with /MATH_LIBRARY=FAST and single-precision data might produce acceptable results if they are modified (or compiled) to use double-precision data. The specific intrinsic routines that have special fast math routines depend on the version of the OpenVMS Alpha operating system in use. Allowed error bounds vary with each routine. 2 /MODULE=directory D=/NOMODULE /[NO]MODULE Controls where module files (.F90$MOD) are placed. If you omit this qualifier or specify /NOMODULE, the .F90$MOD files are placed in your current default directory. If /MODULE is specified, .F90$MOD files are placed in the location indicated. 2 /NAMES=option D=/NAMES=UPPERCASE /NAMES Specifies how the compiler treats the case of identifiers and how it represents external (global) names to the linker. HP recommends using the ATTRIBUTES ALIAS directive rather than /NAMES to specify the form of external names. UPPERCASE Tells the compiler to ignore case differences in identifiers and to convert external names to uppercase. This is the default. LOWERCASE Tells the compiler to ignore case differences in identifiers and to convert external names to lowercase. AS_IS Tells the compiler to recognize and distinguish case differences in identifiers, including the names of NAMELIST groups and variables in those groups, and to preserve the case of external names. This option also prevents the compiler from recognizing intrinsic functions unless they are specified in uppercase. 2 /OBJECT[=file-spec] D=/OBJECT /[NO]OBJECT Specifies the name of the object file or prevents object file creation. The default is /OBJECT. If you omit the file specification, the object file has the name of the first source file and a file type of OBJ. Use the negative form, /NOOBJECT, to suppress object code (for example, when you want to test only for compilation errors in the source program). 2 /OLD_F77 (Alpha only) Specifies to use the Compaq Fortran 77 compiler. The default is to use the VSI Fortran (95/90 language) compiler. If you specify the /OLD_F77 qualifier, certain qualifiers associated with Fortran 95 and Fortran 90 features, Fortran 95 and 90 standards checking, and certain optimization keywords will be ignored. If specified, the /OLDF77 qualifier must immediately follow the FORTRAN verb on the command line. For help on Fortran 77 options, see HELP F77. If you wish to change the default compiler invoked by the FORTRAN command, use one of the following command definition files: o SYS$LIBRARY:FORT$FORTRAN-F77.CLD Specifies that the FORTRAN command invokes the HP Fortran 77 compiler and that the F90 command invokes the HP Fortran compiler. o SYS$LIBRARY:FORT$FORTRAN-F95.CLD Specifies that the FORTRAN and F90 commands invoke the HP Fortran compiler and that the FORTRAN/OLD_F77 command invokes the HP Fortran 77 compiler. This is the default. To change the command definition for your process, use the command: $ SET COMMAND SYS$LIBRARY:FORT$FORTRAN-Fxx where "xx" is either 77 or 95. To change the definition for all users on the system, use the command: $ SET COMMAND /TABLES=SYS$LIBRARY:DCLTABLES - /OUTPUT=SYS$COMMON:[SYSLIB]DCLTABLES - SYS$LIBRARY:FORT$FORTRAN-Fxx $ INSTALL REPLACE SYS$LIBRARY:DCLTABLES The INSTALL REPLACE command must also be executed on any other OpenVMS Alpha nodes of the cluster. Users must log out and in again to see the new definitions. 2 /OPTIMIZE[=(opt[,...])] D=/OPTI=(LEV=4,INL=SPE,NOL,NOP,TUN=GEN,UNR=0) /[NO]OPTIMIZE Controls how the compiler produces optimized code. The default is /OPTIMIZE, which is the same as /OPTIMIZE=(LEVEL=4, INLINE=SPEED, NOLOOPS, NOPIPELINE, TUNE=GENERIC, UNROLL=0). For a debugging session, use the negative form (/NOOPTIMIZE or /OPTIMIZE=LEVEL=0) to ensure that the debugger has sufficient information to locate errors in the source program. In most cases, using /OPTIMIZE will make the program execute faster. As a side effect of getting the fastest execution speeds, using /OPTIMIZE can produce larger object modules and longer compile times than /NOOPTIMIZE. To allow full interprocedural optimization when compiling multiple source modules, consider separating source file specifications with plus signs (+), so the files are concatenated and compiled as one program. Full interprocedural optimization can reduce overall program execution time. Consider not concatenating source files when the size of the source files is excessively large and the amount of memory or disk space is limited. INLINE=keyword Controls the inlining performed by the compiler. The keyword can be any of the following: Keyword Meaning ------- ------- NONE Suppresses all inlining of routines. MANUAL This is the same as INLINE=NONE for VSI Fortran. SIZE Inlines calls that the compiler feels will improve run-time performance without significantly increasing the size of the program. SPEED Inlines calls that the compiler feels will improve run-time performance, even where it may significantly increase the size of the program. ALL Inlines every procedure call that can be inlined while still generating correct code. Recursive routines will not cause an infinite loop at compile time. /OPTIMIZE=INLINE is equivalent to /OPTIMIZE=(INLINE=SPEED). /OPTIMIZE=NOINLINE is equivalent to /OPTIMIZE=(INLINE=NONE) For all optimization levels other than 0, the inlining mode is the one specified on the command line. If no inlining mode is explicitly specified, the compiler derives it from the optimization level, as follows: Level Inlining Mode ----- ------------- 0 NONE 1 NONE 2 NONE 3 NONE 4 SPEED 5 SPEED LEVEL=n Controls the level of optimization performed by the compiler. The "n" is an integer in the range 0 through 5. LEVEL=0 is the same as /NOOPTIMIZE; LEVEL=4 is the same as /OPTIMIZE. The following explains the level numbers: Level Number Meaning ------------ ------- LEVEL=0 Disables nearly all optimizations. LEVEL=1 Enables local optimizations within the source program unit and recognition of common subexpressions. LEVEL=2 Enables global optimizations and optimizations performed with LEVEL=1. LEVEL=3 Enables additional global optimizations that improve speed (at the cost of extra code size) and optimizations performed with LEVEL=2. LEVEL=4 Enables interprocedural analysis, automatic inlining of small procedures (with heuristics limiting the amount of extra code), and optimizations performed with LEVEL=3. LEVEL=4 is the default. LEVEL=5 Activates software pipelining, loop transformation optimizations, and optimizations performed with LEVEL=4. Loop transformation optimizations apply to array references within loops. Software pipe- lining allows instructions within a loop to "wrap around" and execute in a different itera- tion of the loop. In certain cases, loop trans- formation and software pipelining can improve run-time performance. For more information about these LEVEL numbers, see the HP Fortran for OpenVMS User Manual. [NO]LOOPS Specifies a group of loop transformation optimizations that apply to array references within loops. These optimizations can improve the performance of the memory system and usually apply to multiply nested loops. The loops chosen for loop transformation optimizations are always "counted" loops (which include DO or IF loops, but not DO WHILE loops). Conditions that typically prevent the loop transformation optimizations from occurring include subprogram references that are not inlined (such as an external function call), complicated exit conditions, and uncounted loops. The types of optimizations associated with this option are: Loop blocking Loop distribution Loop fusion Loop interchange Loop scalar replacement Outer loop unrolling This type of optimization can be specified for /OPTIMIZE=LEVEL=2 or higher; it is performed by default if /OPTIMIZE=LEVEL=5 is in effect. [NO]PIPELINE Applies instruction scheduling to certain innermost loops, allowing instructions within a loop to "wrap around" and execute in a different iteration of the loop. This can reduce the impact of long-latency operations, resulting in faster loop execution. /OPTIMIZE=PIPELINE also enables prefetching of data to reduce the impact of cache misses. This type of optimization can be specified for /OPTIMIZE=LEVEL=2 or higher; it is performed by default if /OPTIMIZE=LEVEL=5 is in effect. TUNE=keyword (Alpha only) Specifies the kind of optimized code to be generated. The keyword can be any of the following: Keyword Meaning ------- ------- GENERIC Generates and schedules code that will execute well for all generations of Alpha processors. This provides generally efficient code for those cases where all processor generations are likely to be used. HOST Generates and schedules code optimized for the processor generation in use on the system being used for compilation. EV4 Generates and schedules code optimized for the 21064, 21064A, 21066, and 21068 implementations of the Alpha chip. Programs compiled with the EV4 option run without instruction emulation overhead on all Alpha processors. EV5 Generates and schedules code optimized for the 21164 implementation of the Alpha chip. This processor generation is faster than EV4. Programs compiled with the EV5 option run without instruction emulation overhead on all Alpha processors. EV56 Generates code for some 21164 chip implementations that use the byte and word manipulation instruction extensions of the Alpha architecture. Programs compiled with the EV56 option may incur emulation overhead on EV4 and EV5 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. EV6 Generates and schedules code for the 21264 chip implementation that uses the following extensions to the base Alpha instruction set: BWX (Byte/Word manipulation) and MAX (Multimedia) instructions, square root and floating-point convert instructions, and count instructions. Programs compiled with the EV6 option may incur emulation overhead on EV4, EV5, EV56, and PCA56 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. EV67 Generates and schedules code for the 21264 chip implementation that uses the following extensions to the base Alpha instruction set: BWX (Byte/Word manipulation) and MAX (Multimedia) instructions, square root and floating-point convert instructions, and CIX (Count) instructions. Programs compiled with the EV67 option may incur emulation overhead on EV4, EV5, EV56, EV6 and PCA56 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. PCA56 Generates code for the 21164PC chip implementation that uses the byte and word manipulation instruction extensions and multimedia instruction extensions of the Alpha architecture. Running programs compiled with the PCA56 keyword may incur emulation overhead on EV4, EV5, and EV56 processors, but will still run correctly on OpenVMS Version 7.1 (or later) systems. The default is /OPTIMIZE=TUNE=GENERIC. UNROLL=n Controls loop unrolling done by the optimizer. UNROLL=n means to unroll loop bodies n times, where "n" is an integer in the range 0 through 16. UNROLL=0 (the default) means the optimizer will use its default unroll amount. For more information, see the HP Fortran for OpenVMS User Manual. 2 /PAD_SOURCE D=/NOPAD_SOURCE /[NO]PAD_SOURCE Controls how the compiler treats fixed-form source code lines which are shorter than the statement field width (72 characters, or 132 characters if /EXTEND_SOURCE is in effect.) This option has an effect on how the compiler treats character and Hollerith constants that are continued across two or more source lines. Specifying /PAD_SOURCE causes the compiler to treat short source lines as if they were padded with blanks out to the statement field width. This may be useful when compiling programs developed for non-OpenVMS platforms which may assume that short source lines are blank-padded. The default, /NOPAD_SOURCE, is compatible with current HP Fortran and previous OpenVMS Fortran compilers, which causes the compiler to not treat short source lines as padded with blanks so that the first character of a continuation line immediately follows the last character of the previous line. If /NOPAD_SOURCE is in effect, the compiler will issue an informational diagnostic message if it detects a continued constant which may be affected by blank padding. 2 /REAL_SIZE=n D=/REAL_SIZE=32 Controls how the compiler interprets floating-point declarations that do not have a specified length. The default, /REAL_SIZE=32, defines REAL declarations, constants, functions, and intrinsics as REAL(KIND=4) (single precision) and COMPLEX declarations, constants, functions, and intrinsics as COMPLEX(KIND=4) (single COMPLEX). Specifying /REAL_SIZE=64 defines REAL declarations, constants, functions, and intrinsics as REAL(KIND=8) (DOUBLE PRECISION) and COMPLEX declarations, constants, functions, and intrinsics as COMPLEX(KIND=8) (DOUBLE COMPLEX). This also causes intrinsic functions to produce a double precision REAL(KIND=8) or COMPLEX(KIND=8) result instead of a single precision REAL(KIND=4) or COMPLEX(KIND=4) result, unless the argument is explicitly typed. For example, if you specify /REAL_SIZE=64, references to the CMPLX intrinsic produce DCMPLX results (COMPLEX(KIND=8)). However, if the argument to CMPLX is explicitly typed as REAL(KIND=4) or COMPLEX(KIND=4), the resulting data type is COMPLEX(KIND=4). Specifying /REAL_SIZE=128 defines REAL declarations, constants, functions, and intrinsics as REAL(KIND=16). It does not affect COMPLEX objects. 2 /RECURSIVE D=/NORECURSIVE /[NO]RECURSIVE Controls whether VSI Fortran generates code and allocates data so that a subroutine or function can be called recursively. The default is /NORECURSIVE. Specifying /RECURSIVE does the following: o Changes the default allocation class for all local variables from STATIC to AUTOMATIC, except for variables that are data-initialized, named in a SAVE statement, or declared as STATIC. o Permits reference to a routine name from inside the routine. Subprograms declared with the RECURSIVE keyword are always recursive (whether you specify or omit the /RECURSIVE qualifier). Data objects declared as AUTOMATIC always use stack-based storage (whether you specify or omit the /RECURSIVE or /AUTOMATIC qualifiers). Specifying /RECURSIVE sets /AUTOMATIC. You can also specify this qualifier using the OPTIONS statement. 2 /REENTRANCY=option D=/REENTRANCY=NONE /[NO]REENTRANCY Tells the VSI Fortran RTL whether the program will be relying on threaded or asynchronous (AST) reentrancy. /NOREENTRANCY specifies that the program will not be relying on threaded or asynchronous (AST) reentrancy. So, the RTL will not guard against such interrupts inside the RTL. This is the same as specifying /REENTRANCY=NONE (the default). ASYNC Specifies that the program may contain asynchronous (AST) handlers that could call the RTL. This causes the RTL to guard against AST interrupts inside its own critical regions. This option is ignored for applications running on versions of OpenVMS earlier than Version 7.0. NONE Specifies that the program will not be relying on threaded or asynchronous (AST) reentrancy. So, the RTL will not guard against such interrupts inside the RTL. This is the default and is the same as specifying /NOREENTRANCY. THREADED Specifies that the program is multithreaded, such as programs using the DECthreads library. This causes the RTL to use thread locking to guard its own critical regions. This option is ignored for applications running on versions of OpenVMS earlier than Version 7.0. 2 /ROUNDING_MODE=option D=/ROUNDING_MODE=NEAREST Controls the rounding mode to be used for IEEE floating-point calculations. You can only specify one of the qualifier options. CHOPPED Specifies to round toward zero. DYNAMIC Specifies to get the rounding mode at runtime. For more information, see the HP Fortran for OpenVMS User Manual. MINUS_INFINITY Specifies to round toward the next smallest representation value. NEAREST Specifies to round toward the nearest representation value. This is the default. 2 /SEPARATE_COMPILATION D=/NOSEPARATE_COMPILATION /[NO]SEPARATE_COMPILATION Controls whether an individual compilation unit becomes a separate module in an object file. The default is /NOSEPARATE_COMPILATION, which groups individual compilation units as a single module in an object file. When creating modules for use in an object library, consider using /SEPARATE_COMPILATION to minimize the size of the routines included by the linker as it creates the executable image. In most cases, the default setting (/NOSEPARATE_COMPILATION) allows more interprocedural optimizations. 2 /SEVERITY=(WARNINGS=opt) D=/SEVERITY=(WARNINGS=WARNING) Changes the severity of warning or error messages. The default is that compiler diagnostic warning messages and standards checking messages have a severity of warning, or /SEVERITY=(WARNINGS=WARNING). ERROR Specifies that all warning messages are to be issued with ERROR severity. STDERROR Specifies that if /STANDARD is in effect and diagnostics indicating non-standard features are issued, the diagnostics are issued with ERROR severity (the default is that these are informational). All other warning messages are issued with WARNING severity. WARNINGS Specifies that all warning messages are to be issued with WARNING severity. 2 /SHOW=(option[,...]) D=/SHO=(NOIN,MAP) /[NO]SHOW Controls whether optionally listed source lines and a symbol map appear in the source listing. (Optionally listed source lines are text-module source lines and preprocessor-generated source lines.) For the /SHOW qualifier to take effect, you must specify the /LIST qualifier. [NO]INCLUDE Controls whether the source lines from any file or text module specified by INCLUDE statements are included in the source listing. [NO]MAP Controls whether the symbol map is included in the listing file. ALL Requests that all optionally listed source lines and a symbol map be included in the listing file. This is the same as specifying /SHOW without any arguments. NONE Requests that no optionally listed source lines or a symbol map be included in the listing file. This is the same as specifying /NOSHOW. The /SHOW qualifier defaults are NOINCLUDE and MAP. 2 /SOURCE_FORM=option D=Depends on file type /SOURCE_FORM Specifies whether all VSI Fortran source files on the F90 command line are in fixed or free source form. FIXED Specifies that the input source files will be in fixed source form, regardless of the file type. Source files with a file type of FOR or F (or any file type other than F90) are assumed to contain fixed source form. FREE Specifies that the input source files will be in free source form, regardless of the file type. Source files with a file type of F90 are assumed to contain free source form. 2 /STANDARD[=option] D=/NOSTANDARD /[NO]STANDARD Controls whether the compiler generates informational diagnostic messages for HP extensions to the Fortran language standard in effect at compile time. F90 Tells the compiler to compare language features to the Fortran 90 Standard. F95 Tells the compiler to compare language features to the Fortran 95 Standard. Specifying /STANDARD causes informational diagnostic messages to be generated for items such as the following: o Extensions to language syntax o Standard-conforming statements that become nonstandard due to the way in which they are used o Tab formatting, when it appears in fixed-format source files If /STANDARD is specified without an option, messages are issued for extensions to the Fortran 95 Standard. The default is /NOSTANDARD (or /STANDARD=NONE). If you specify the /NOWARNINGS qualifier, the /STANDARD qualifier is ignored. For more information on how the compiler detects source statements that do not conform to Fortran language standards, see the description of /STANDARD in the HP Fortran for OpenVMS User Manual. 2 /SYNCHRONOUS_EXCEPTIONS (Alpha only) D=/NOSYNCHRONOUS_EXCEPTIONS /[NO]SYNCHRONOUS_EXCEPTIONS Controls whether an exception is associated with the instruction that caused it. Specifying /SYNCHRONOUS_EXCEPTIONS slows program execution, so only use it when debugging a specific problem, such as locating the source of an exception. The default, /NOSYNCHRONOUS_EXCEPTIONS, is used where exceptions can be reported imprecisely one or more instructions after the instruction that caused the exception. Specifying /IEEE_MODE=FAST (the default) provides imprecise exception reporting (same as /NOSYNCHRONOUS_EXCEPTIONS). Specifying other /IEEE_MODE keywords provides precise exception reporting (same as /SYNCHRONOUS_EXCEPTIONS). 2 /SYNTAX_ONLY D=/NOSYNTAX_ONLY /[NO]SYNTAX_ONLY Controls whether the source file is checked only for correct syntax. If you specify the /SYNTAX_ONLY qualifier, no code is generated, no object file is produced, and some error checking done by the optimizer is bypassed (for example, checking for uninitialized variables). This qualifier lets you do a quick syntax check of your source file, and is especially useful in conjunction with /WARNINGS=ARGUMENT_CHECKING. 2 /TIE D=/NOTIE /[NO]TIE Controls whether compiled code is used with translated shared images, either because the code might call into a translated image or might be called from a translated image. Specifying /NOTIE, the default, indicates the compiled code will not be associated with a translated image. If you specify /TIE, link the object module using the LINK command /NONATIVE_ONLY qualifier. For more information, see the HP Fortran for OpenVMS User Manual. 2 /VERSION Displays the VSI Fortran version number. If you specify this qualifier, compilation does not occur. 2 /VMS D=/VMS /[NO]VMS Controls whether the run-time system behaves like VSI Fortran for OpenVMS VAX Systems (VAX FORTRAN) in various ways. The default, /VMS, specifies the following aspects of the run-time environment: o Reinforces the defaults of /IEEE_MODE=FAST and /NORECURSIVE. o Does not recognize the \n control character syntax in character literals. o Causes the defaults for keyword BLANK= in OPEN statements to become 'ZERO' for an implicit OPEN of an external or internal file, and 'NULL' for an explicit OPEN. o Allows use of /LIST or /NOLIST in INCLUDE statement specifications (also see /ASSUME=SOURCE_INCLUDE in this Help file). o Sets the following as defaults: - /CHECK=FORMAT (with /NOVMS, the default is /CHECK=NOFORMAT) - /CHECK=OUTPUT_CONVERSION (with /NOVMS, the default is /CHECK=NOOUTPUT_CONVERSION) /VMS does not affect the alignment of fields in records or items in COMMON. To override the effects of the /VMS qualifier, specify /NOVMS. You can also override qualifier settings reinforced by /VMS, by specifying the desired qualifier settings on the command line. For example, the following command line permits recursion in the source program: $ F90/VMS/RECURSIVE filename.for 2 /WARNINGS=(opt[,...]) D=/WAR=(ALI,NOA,NOD,GEN,GRA,NOI,NOT,UNC,UNI,NOU,US) /[NO]WARNINGS Controls whether the compiler generates informational (I-level) and warning (W-level) diagnostic messages in response to informational and warning-level errors. The default is /WARNINGS=(ALIGNMENT, NOARGUMENT_CHECKING, NODECLARATIONS, GENERAL, GRANULARITY, NOIGNORE_LOC, NOTRUNCATED_SOURCE, UNCALLED, UNINITIALIZED NOUNUSED, USAGE). [NO]ALIGNMENT Controls whether the compiler issues diagnostic messages when variables or arrays (created in COMMON or EQUIVALENCE statements) are declared in such a way that they cross natural boundaries for their data size. For example, a diagnostic message is issued if /WARNINGS=ALIGNMENT is in effect and the virtual address of a REAL(KIND=8) variable is not a multiple of 8. The default is /WARNINGS=ALIGNMENT. To suppress diagnostic messages about misaligned data, specify /WARNINGS=NOALIGNMENT. To control the alignment of fields in derived-type or record structures or in common blocks, use the /ALIGNMENT qualifier. (See the HP Fortran for OpenVMS User Manual.) [NO]ARGUMENT_CHECKING Controls whether the compiler issues diagnostic messages for argument mismatches between caller and callee (when compiled together). The default is /WARNINGS=NOARGUMENT_CHECKING. [NO]DECLARATIONS Controls whether the compiler issues diagnostic messages for any untyped data item used in the program. DECLARATIONS acts as an external IMPLICIT NONE declaration. See the description of the IMPLICIT statement in the HP Fortran for OpenVMS Language Reference Manual for information about the effects of IMPLICIT NONE. The default is /WARNINGS=NODECLARATIONS. [NO]GENERAL Controls whether the compiler issues I-level and W-level diagnostic messages. An I-level message indicates that a correct VSI Fortran statement may have unexpected results or contains nonstandard syntax or source form. A W-level message indicates that the compiler has detected acceptable, but nonstandard, syntax or has performed some corrective action; in either case, unexpected results may occur. To suppress I-level and W-level diagnostic messages, specify the negative form of this qualifier (/WARNINGS=NOGENERAL). The default is /WARNINGS=GENERAL. [NO]GRANULARITY Controls whether the compiler issues the NONGRNACC warning message: "Unable to generate code for requested granularity". The default is /WARNINGS=GRANULARITY. [NO]IGNORE_LOC Controls whether the compiler issues warnings when %LOC is stripped from an argument. The default is /WARNINGS=NOIGNORE_LOC. [NO]TRUNCATED_SOURCE Controls whether the compiler issues a warning diagnostic message (EXCCHASRC) when it reads a fixed-form source line with a statement field that exceeds the maximum column width. The maximum column width is column 72 or 132, depending on the value of the /EXTEND_SOURCE qualifier or the OPTIONS statement option in effect. This option has no effect on truncation; lines that exceed the maximum column width are always truncated. The default is /WARNINGS=NOTRUNCATED_SOURCE. [NO]UNCALLED Controls whether the compiler issues SFUNCALLED messages when a statement function is never called. The default is /WARNINGS=UNCALLED (the messages are displayed). [NO]UNINITIALIZED Controls whether the compiler issues UNINIT messages when a variable is used before it has a value assigned to it. The default is /WARNINGS=UNINITIALIZED (the messages are displayed). [NO]UNUSED Controls whether the compiler issues a warning diagnostic message when a variable is declared but not used. The default is /WARNINGS=NOUNUSED. [NO]USAGE Controls whether the compiler generates informational diagnostic messages for questionable programming practices which, though allowed, often are the result of programming errors. For example, the following would cause such a message: a continued character or Hollerith literal whose first part ends before the statement field and appears to end with trailing spaces. The default is /WARNINGS=USAGE. ALL Causes the compiler to print all I-level and W-level diagnostic messages, including warning messages for any misaligned data and untyped data items. Specifying ALL has the effect of specifying (ALIGNMENT, ARGUMENT_CHECKING, DECLARATIONS, GENERAL, GRANULARITY, IGNORE_LOC, TRUNCATED_SOURCE, UNCALLED, UNINITIALIZED, UNUSED, USAGE). This is the same as specifying /WARNINGS. NONE Suppresses all I-level and W-level messages. This is the same as specifying /NOWARNINGS. 2 Examples The following examples show a variety of VSI Fortran commands. Each command is followed by a description of the output files it produces. 1. $ FORTRAN/LIST AAA.F90, BBB.F90, CCC.F90 Source files AAA.F90, BBB.F90, and CCC.F90 are compiled as separate files, producing object files named AAA.OBJ, BBB.OBJ, and CCC.OBJ; and listing files named AAA.LIS, BBB.LIS, and CCC.LIS. 2. $ FORTRAN XXX+YYY+ZZZ Source files XXX.F90, YYY.F90, and ZZZ.F90 are concatenated and compiled as one file, producing an object file named XXX.OBJ, but no listing file. (A listing file named XXX.LIS would be produced in batch mode.) 3. $ FORTRAN/OBJECT=SQUARE/NOLIST _File: CIRCLE The source file CIRCLE.F90 is compiled, producing an object file named SQUARE.OBJ, but no listing file. 4. $ FORTRAN AAA+BBB,CCC/LIST Two object files are produced: AAA.OBJ (comprising AAA.F90 and BBB.F90) and CCC.OBJ (comprising CCC.F90). One listing file is produced: CCC.LIS (comprising CCC.F90). 5. $ FORTRAN ABC+CIRC/NOOBJECT+XYZ When you include a qualifier in a list of files that are to be concatenated, the qualifier affects all files in the list. The Fortran command shown in this example completely suppresses the object file. That is, source files ABC.F90, CIRC.F90, and XYZ.F90 are concatenated and compiled, but no object file is produced. 2 Release_Notes For VSI Fortran release notes, refer to the following file: SYS$HELP:FORTRAN.RELEASE_NOTES. 2 Built-in_Functions Built-in functions perform utility operations that are useful in communicating with subprograms written in languages other than Fortran. See also Intrinsics. 3 %LOC %LOC (arg) Returns the internal address of a storage item. The argument can be a variable, an expression, or the name of a procedure. (It must not be the name of an internal procedure or statement function.) It can be of any data type. The result is an INTEGER*8 data type. In the case of global symbolic constants, %LOC returns the value of the constant rather than an address. The %LOC built-in function serves the same purpose as the LOC intrinsic. 3 %REF %REF (arg) Forces an actual argument in a CALL statement or function reference to be passed by reference: the address of the argument is passed to the subprogram. By default, Fortran passes all numeric values by reference. 3 %VAL %VAL (arg) Forces an actual argument in a CALL statement or function reference to be passed by value. The argument is passed as a 64-bit immediate value. If "arg" is integer (or logical) and less than 64 bits in size, it is sign-extended to a 64-bit value. When a complex argument is passed, two 64-bit values (one containing the real part, the other containing the imaginary part) are passed by immediate value. 3 %DESCR %DESCR (arg) Forces an actual argument in a CALL statement or function reference to be passed by descriptor: the address of a descriptor of the argument is passed to the subprogram. By default, Fortran passes all character values by descriptor. 2 Character_Sets VSI Fortran supports the following characters: o The Fortran 95/90 character set, consisting of those ASCII characters which can appear in Fortran 95/90 language syntax. This character set is a superset of the FORTRAN 77 character set. o Other printable characters, which can appear in comments, character constants, Hollerith constants, character string edit descriptors, and input/output records. 3 ASCII The following table represents the ASCII character set (characters with decimal values 0 through 127). Except for SP and HT, the characters with names are nonprintable. To determine the hexadecimal value of an ASCII character, combine the values in the column (0-7) and the row (0-F) that relate to the character. For example, the value of the character representing the equal sign is 3D(hex). +------------------------------------------+ | 0 1 2 3 4 5 6 7 | +---+--------------------------------------+ | 0 | NUL DLE SP 0 @ P ` p | | 1 | SOH DC1 ! 1 A Q a q | | 2 | STX DC2 " 2 B R b r | | 3 | ETX DC3 # 3 C S c s | | 4 | EOT DC4 $ 4 D T d t | | 5 | ENQ NAK % 5 E U e u | | 6 | ACK SYN & 6 F V f v | | 7 | BEL ETB ' 7 G W g w | | 8 | BS CAN ( 8 H X h x | | 9 | HT EM ) 9 I Y i y | | A | LF SUB * : J Z j z | | B | VT ESC + ; K [ k { | | C | FF FS , < L \ l | | | D | CR GS - = M ] m } | | E | SO RS . > N ^ n ~ | | F | SI US / ? O _ o DEL | +---+--------------------------------------+ The characters with names are defined as follows: NUL Null DC1 Device Control 1(XON) SOH Start of DC2 Device Control 2 Heading STX Start of Text DC3 Device Control 3(XOFF) ETX End of Text DC4 Device Control 4 EOT End of NAK Negative Acknowledge Transmission ENQ Enquiry SYN Synchronous Idle ACK Acknowledge ETB End of Transmission Block BEL Bell CAN Cancel BS Backspace EM End of Medium HT Horizontal Tab SUB Substitute LF Line Feed ESC Escape VT Vertical Tab FS File Separator FF Form Feed GS Group Separator CR Carriage Return RS Record Separator SO Shift Out US Unit Separator SI Shift In SP Space DLE Data Link DEL Delete Escape 3 DEC_Multinational The ASCII character set comprises the first half of the DEC Multinational Character Set. The following table represents the second half of the DEC Multinational Character Set (characters with decimal values 128 through 255). These characters cannot be output on some older terminals and printers. Note that the characters with names are nonprintable. To determine the hexadecimal value of an ASCII character, combine the values in the column (8-F) and the row (0-F) that relate to the character. For example, the value of the character representing the pound sterling sign is A3(hex). +------------------------------------------+ | 8 9 A B C D E F | +---+--------------------------------------+ | 0 | DCS ° À à | | 1 | PU1 ¡ ± Á Ñ á ñ | | 2 | PU2 ¢ ² Â Ò â ò | | 3 | STS £ ³ Ã Ó ã ó | | 4 | IND CCH Ä Ô ä ô | | 5 | NEL MW ¥ µ Å Õ å õ | | 6 | SSA SPA ¶ Æ Ö æ ö | | 7 | ESA EPA § · Ç × ç ÷ | | 8 | HTS ¨ È Ø è ø | | 9 | HTJ © ¹ É Ù é ù | | A | VTS ª º Ê Ú ê ú | | B | PLD CSI « » Ë Û ë û | | C | PLU ST ¼ Ì Ü ì ü | | D | RI OSC ½ Í Ý í ý | | E | SS2 PM Î î | | F | SS3 APC ¿ Ï ß ï | +---+--------------------------------------+ The characters with names are defined as follows: IND Index PU1 Private Use 1 NEL Next Line PU2 Private Use 2 SSA Start of STS Set Transmit State Selected Area ESA End of Selected CCH Cancel Character Area HTS Horizontal Tab MW Message Waiting Set HTJ Horizontal SPA Start of Protected Tab Set with Area Justification VTS Vertical Tab EPA End of Protected Set Area PLD Partial Line CSI Control Sequence Down Introducer PLU Partial Line Up ST String Terminator RI Reverse Index OSC Operating System Command SS2 Single Shift 2 PM Privacy Message SS3 Single Shift 3 APC Application DCS Device Control String 3 Fortran_Standards The character set specified by the Fortran 95 and Fortran 90 Standards consists of all uppercase and lowercase letters (A-Z and a-z), the digits 0-9, the underscore (_), and the following special characters: (blank or space) : (colon) = (equal sign) ! (exclamation point) + (plus sign) " (quotation mark) - (minus sign) % (percent sign) * (asterisk) & (ampersand) / (slash) ; (semicolon) ( (left parenthesis) < (less than) ) (right parenthesis) > (greater than) , (comma) ? (question mark) . (period) $ (dollar sign) ' (apostrophe) 3 VSI_Fortran The VSI Fortran character set includes the entire Fortran 95/90 Standard set plus the special character (tab). All printable characters (those in the range 20(hex) through 7E(hex), or A1(hex) through FE(hex)) can appear in comments, character constants, and Hollerith constants. 3 Printable_Characters Printable characters include the tab character (09 hex), those ASCII characters with codes in the range 20(hex) through 7E(hex), and those characters in the DEC Multinational Extension to the ASCII Character Set with codes in the range A1(hex) through FE(hex). Printable characters that are not in the Fortran 95/90 character set (see CHAR FORTRAN_90 in online Help) can only appear in comments, character constants, Hollerith constants, character string edit descriptors, and input/output records. 2 Compatibility_Features VSI Fortran provides the following language features to facilitate compatibility with other versions of Fortran: o The DEFINE FILE, ENCODE, DECODE, and FIND statements o An alternative syntax for the PARAMETER statement o The VIRTUAL statement o The AND, OR, XOR, IMAG, LSHIFT, and RSHIFT intrinsic functions o An alternative syntax for octal and hexadecimal constants o An alternative syntax for a record specifier o An alternative syntax for the DELETE statement o An alternative form for namelist external records o Record structures o VSI Fortran pointers These language features are particularly useful in transporting older Fortran programs to systems on Alpha processors. However, you should avoid using them in new programs on these systems, and in new programs for which portability to other Fortran 95 or Fortran 90 implementations is important. 3 DEFINE_FILE The DEFINE FILE statement establishes the size and structure of files with relative organization and associates them with a logical unit number. The DEFINE FILE statement is comparable to the OPEN statement (in situations where you can use the OPEN statement, it is the preferable mechanism for creating and opening files). Statement format: DEFINE FILE u(m, n, U, asv) [,u(m, n, U, asv)]... u Is an integer constant or variable that specifies the logical unit number. m Is an integer constant or variable that specifies the number of records in the file. n Is an integer constant or variable that specifies the length of each record in 16-bit words (2 bytes). U Specifies that the file is unformatted (binary); this is the only acceptable entry in this position. asv Is an integer variable, called the associated variable of the file. At the end of each direct access I/O operation, the record number of the next higher numbered record in the file is assigned to "asv"; "asv" must not be a dummy argument. The DEFINE FILE statement specifies that a file containing "m" fixed-length records, each composed of n 16-bit words, exists (or is to exist) on the specified logical unit. The records in the file are numbered sequentially from 1 through "m". A DEFINE FILE statement must be executed before the first direct access I/O statement referring to the specified file, even though the DEFINE FILE statement does not itself open the file. The file is actually opened when the first direct access I/O statement for the unit is executed. If this I/O statement is a WRITE statement, a new relative organization file is created. If it is a READ or FIND statement, an existing file is opened, unless the specified file does not exist. If a file does not exist, an error occurs. 3 DELETE In VSI Fortran, you can specify the following form of the DELETE statement when deleting records from a relative file: DELETE (u'r [,ERR=s] [,IOSTAT=ios]) u Is the number of the logical unit containing the record to be deleted. r Is the positional number of the record to be deleted. s Is the label of an executable statement that receives control if an error condition occurs. ios Is a scalar integer variable that is defined as a positive integer if an error occurs and zero if no error occurs. This form deletes the direct access record specified by r. 3 ENCODE_and_DECODE The ENCODE and DECODE statements transfer data between variables or arrays in internal storage. The ENCODE statement translates data from internal (binary) form to character form. Inversely, the DECODE statement translates data from character to internal form. These statements are comparable to using internal files in formatted sequential WRITE and READ statements, respectively. Statement format: ENCODE (c,f,b [,IOSTAT=ios] [,ERR=s]) [list] DECODE (c,f,b [,IOSTAT=ios] [,ERR=s]) [list] c Is an integer expression. In the ENCODE statement, "c" is the number of characters (in bytes) to be translated to character form. In the DECODE statement, "c" is the number of characters to be translated to internal form. f Is a format identifier. An error occurs if more than one record is specified. b Is a scalar or array reference. If b is an array reference, its elements are processed in the order of subscript progression. The data type of "b" determines the number of characters that ENCODE or DECODE can process. In the ENCODE statement, "b" receives the characters after translation to external form. If less than "c" characters are received, the remaining character positions are filled with blank characters. In the DECODE statement, "b" contains the characters to be translated to internal form. ios Is a scalar integer variable that is defined as a positive integer if an error occurs, and zero if no error occurs. s Is the label of an executable statement. list Is an I/O list. In the ENCODE statement, the "list" contains the data to be translated to character form. In the DECODE statement, the "list" receives the data after translation to internal form. The interaction between the format specifier and the I/O list is the same as for a formatted I/O statement. 3 FIND The FIND statement positions a direct access file at a particular record and sets the associated variable of the file to that record number. It is comparable to a direct access READ statement with no I/O list, and can open an existing file. No data transfer takes place. Statement format: FIND (u'r [,ERR=s] [,IOSTAT=ios]) FIND ([UNIT=]u, REC=r [,ERR=s] [,IOSTAT=ios]) u Is a logical unit number. It must refer to a relative organization file. r Is the direct access record number. It cannot be less than one or greater than the number of records defined for the file. s Is the label of the executable statement that receives control if an error occurs. ios Is an integer variable or integer array element that is defined as a positive integer if an error occurs, and as a zero if no error occurs. 3 Intrinsic_Functions VSI Fortran allows certain intrinsic functions for compatibility with FORTRAN for RISC. The following list shows these functions and their equivalents: Function Equivalent Function -------- ------------------- AND IAND OR IOR XOR IEOR LSHIFT ISHFT with a positive second argument RSHIFT ISHFT with a negative second argument 3 Namelist_Record You can use the following form for an external record: $group-name object = value [object = value]...$[END] group-name Is the name of the group containing the objects to be given values. The name must have been previously defined in a NAMELIST statement in the scoping unit. object Is the name (or subobject designator) of an entity defined in the NAMELIST declaration of the group name. The object name must not contain embedded blanks, but it can be preceded or followed by blanks. value Is a null value, a constant (or list of constants), a repetition of constants in the form r*c, or a repetition of null values in the form r*. If more than one object=value or more than one value is specified, they must be separated by value separators. A value separator is any number of blanks, or a comma or slash, preceded or followed by any number of blanks. Comments (beginning with ! only) can appear anywhere in namelist input. The comment extends to the end of the source line. 3 Octal_Hex_Syntax In VSI Fortran, you can use the following alternative syntax for octal and hexadecimal constants: Alternative Syntax Equivalent ------------------ ---------- Octal '0..7'O O'0..7' Hexadecimal '0..F'X Z'0..F' In the above syntax forms, you can use a quotation mark(") in place of an apostrophe ('). 3 PARAMETER This statement is similar to the one discussed in Help topic: Statements PARAMETER; they both assign a symbolic name to a constant. However, this PARAMETER statement differs from the other one in the following two ways: its list is not bounded with parentheses; and the form of the constant, rather than implicit or explicit typing of the symbolic name, determines the data type of the variable. Statement format: PARAMETER p=c [,p=c]... p Is a symbolic name. c Is a constant, the symbolic name of a constant, or a compile-time constant expression. 3 Record_Specifier_Syntax In VSI Fortran, you can specify the following form for a record specifier: 'r r Is a numeric expression with a value that represents the position of the record to be accessed using direct access I/O. The value must be greater than or equal to 1, and less than or equal to the maximum number of records allowed in the file. If necessary, a record number is converted to integer data type before being used. 3 Record_Structures A record is a named data entity, consisting of one or more fields, which you can use when you need to declare and operate on multi-field data structures in your programs. To create a record, you must have a structure declaration (to describe the fields in the record) and a RECORD statement to establish the record in memory. 4 Examples Structure APPOINTMENT: Structure /APPOINTMENT/ RECORD /DATE/ APP_DATE STRUCTURE /TIME/ APP_TIME (2) LOGICAL*1 HOUR, MINUTE END STRUCTURE CHARACTER*20 APP_MEMO (4) LOGICAL*1 APP_FLAG END STRUCTURE The following statement results in the creation of both a variable named NEXT_APP and a 10-element array named APP_list. Both the variable and each element of the array have the form of the structure APPOINTMENT. RECORD /APPOINTMENT/ NEXT_APP,APP_list(10) The following examples illustrate aggregate and scalar field references. Aggregate: NEXT_APP ! the record NEXT_APP NEXT_APP.APP_TIME(1) ! an array field of the variable ! NEXT_APP APP_list(3).APP_DATE ! a /DATE/ record, part of the record ! APP_list(3) in the array APP_list Scalar: NEXT_APP.APP_FLAG ! a LOGICAL field of the record ! NEXT_APP NEXT_APP.APP_MEMO(1)(1:1) ! The first character of APP_MEMO(1), ! a character*20 field of the record ! NEXT_APP 4 Field_References Fields within a record may be accessed collectively or individually. Record references are either qualified or unqualified. A qualified reference refers to a typed data item and can be used wherever an ordinary variable is allowed. Type conversion rules are the same as for variables. Its form is: rname[.cfname...cfname].afname Unqualified references refer to a record structure or substructure and can be used (in most cases) like arrays, for example: rname[.cfname...cfname] rname Is the name used in the RECORD statement to identify a record. cfname Is a substructure field name within the record identified by record-name. afname Is the name of a typed data item within a structure declaration. 4 Aggregate_Reference An aggregate reference resolves into a reference to a structured data item (a record structure or substructure). For example: Data Declarations: STRUCTURE /STRA/ INTEGER INTFLD, INTFLDARY (10) END STRUCTURE . . . STRUCTURE /STRB/ CHARACTER*20 CHARFLD INTEGER INTFLD, INTFLDARY (10) STRUCTURE STRUCFLD COMPLEX CPXFLD, CPXFLDARY (10) END STRUCTURE RECORD /STRA/ RECFLD, RECFLDARY (10) END STRUCTURE . . . RECORD /STRB/ REC, RECARY (10) Reference Examples: REC --- A record name RECARY(1) --- A record array reference REC.RECFLD --- A reference to a substructure REC.RECFLDARY(1) --- A reference to a substructure array element RECARY(1).RECFLD --- A reference to a substructure in a record array element RECARY(1).RECFLDARY(1) --- A reference to a substructure array element in a record array 3 VIRTUAL The VIRTUAL statement is included for compatibility with PDP-11 FORTRAN. It has the same form and effect as the DIMENSION statement (see Help Topic: Statements DIMENSION). 3 HP_Fortran_POINTER This POINTER statement (formerly the Compaq Fortran POINTER statement) is different from the Fortran 95/90 POINTER statement. This POINTER statement establishes pairs of variables and pointers, in which each pointer contains the address of its paired variable. Statement format: POINTER ((pointer,pointee) [,(pointer,pointee)]... pointer Is a variable whose value is used as the address of the pointee. pointee Is a variable, array, array declarator, record structure, record array, or record array specification. The following are rules and behavior for the "pointer" argument: o Two pointers can have the same value, so pointer aliasing is allowed. o When used directly, a pointer is treated like an integer variable. A pointer occupies two numeric storage units, so it is a 64-bit quantity (INTEGER*8). o A pointer cannot be a pointee. o A pointer cannot appear in an ASSIGN statement and cannot have the following attributes: ALLOCATABLE PARAMETER EXTERNAL POINTER INTRINSIC TARGET A pointer can appear in a DATA statement with integer literals only. o Integers can be converted to pointers, so you can point to absolute memory locations. o A pointer variable cannot be declared to have any other data type. o A pointer cannot be a function return value. o You can give values to pointers by doing the following: - Retrieve addresses by using the LOC intrinsic function (or %LOC built-in function) - Allocate storage for an object by using the MALLOC intrinsic function or LIB$GET_VM For example: Using %LOC: Using MALLOC: integer i(10) integer i(10) integer i1 (10) /10*10/ pointer (p,i) pointer (p,i) p = malloc (40) p = %loc (i1) i(2) = i(2) + 1 i(2) = i(2) + 1 Using LIB$GET_VM: INTEGER I(10) INTEGER LIB$GET_VM, STATUS POINTER (P,I) STATUS = LIB$GET_VM(P,40) IF (.NOT. STATUS) CALL EXIT(STATUS) I(2) = I(2) + 1 The value in a pointer is used as the pointee's base address. The following are rules and behavior for the "pointee" argument: o A pointee is not allocated any storage. References to a pointee look to the current contents of its associated pointer to find the pointee's base address. o A pointee can appear in only one POINTER statement. o A pointee array can have fixed, adjustable, or assumed dimensions. o A pointee cannot appear in a COMMON, DATA, EQUIVALENCE, or NAMELIST statement and cannot have the following attributes: ALLOCATABLE POINTER AUTOMATIC SAVE INTENT STATIC OPTIONAL TARGET PARAMETER o A pointee cannot be a dummy argument. o A pointee cannot be a function return value. o A pointee cannot be a record field or an array element. o A pointee cannot be zero-sized. o A pointee cannot be an automatic object. o A pointee cannot be the name of a generic interface block. o If a pointee is of derived type, it must be of sequence type. 2 Data Each constant, variable, array, expression, or function reference in a Fortran statement represents typed data. The data type of these items can be inherent in their constructions, implied by convention, or explicitly declared. Each data type has a name, a set of associated values, a way to denote the values, and operations to manipulate and interpret these values. There are two categories of data types: intrinsic and derived. The names of the intrinsic data types are predefined and are always accessible. Derived data types are user-defined data types that are made up of intrinsic or derived data types. 3 Arrays An array is a set of scalar elements that have the same type and kind type parameters. Any object that is declared with an array specification is an array. Arrays can be declared with a type declaration statement, a DIMENSION statement, or a COMMON statement. An array can be referenced by element (using subscripts), by section (using a section subscript list), or as a whole. A section subscript list consists of subscripts, subscript triplets, or vector subscripts. At least one subscript in the list must be a subscript triplet or vector subscript. When an array name without any subscripts appears in an intrinsic operation (for example, addition), the operation applies to the whole array (all elements in the array). An array has the following properties: o Data type An array can have any intrinsic or derived type. The data type of an array is either specified in a type declaration statement, or implied by the first letter of its name. All elements of the array have the same type and kind type parameters. If a value assigned to an individual array element is not the same as the type of the array, it is converted to the array's type. o Rank The rank of an array is the number of dimensions in the array. An array can have up to seven dimensions. A rank-one array represents a column of data (a vector), a rank-two array represents a table of data arranged in columns and rows (a matrix), a rank-three array represents a table of data on multiple pages (or planes), and so forth. o Bounds Arrays have a lower and upper bound in each dimension. These bounds determine the range of values that can be used as subscripts for the dimension. The value of either bound can be positive, negative, or zero. The bounds of a dimension are defined in an array specification. o Size The size of an array is the total number of elements in the array (the product of the array's extents). The extent of a dimension is the number of elements in that dimension. It is determined as follows: upper bound - lower bound + 1. If the value of any of an array's extents is zero, the array has a size of zero. o Shape The shape of an array is determined by its rank and extents, and can be represented as a rank-one array (vector) where each element is the extent of the corresponding dimension. Two arrays with the same shape are said to be conformable. A scalar is conformable to an array of any shape. The name and rank of an array are constant and must be specified when the array is declared. The extent of each dimension can be constant, but does not need to be. The extents can vary during program execution if the array is a dummy argument array, an automatic array, an array pointer, or an allocatable array. A whole array is referenced by the array name. Individual elements in a named array are referenced by a scalar subscript or list of scalar subscripts (if there is more than one dimension). A section of a named array is referenced by a section subscript. Consider the following array declaration: INTEGER L(2:11,3) The properties of array L are as follows: Data type: INTEGER Rank: 2 (two dimensions) Bounds: First dimension: 2 to 11 Second dimension: 1 to 3 Size: 30 (the product of the extents: 10 x 3) Shape: 10 by 3 (a vector of the extents (10,3)) The following example shows other valid ways to declare this array: DIMENSION L(2:11,3) INTEGER, DIMENSION(2:11,3) :: L COMMON L(2:11,3) The following example shows references to array elements, array sections, and a whole array: REAL B(10) ! Declares a rank-one array with 10 elements INTEGER C(5,8) ! Declares a rank-two array with 5 elements ! in dimension one and 8 elements in ! dimension two ... B(3) = 5.0 ! Reference to an array element B(2:5) = 1.0 ! Reference to an array section consisting of ! elements: B(2), B(3), B(4), B(5) ... C(4,8) = I ! Reference to an array element C(1:3,3:4) = J ! Reference to an array section consisting of ! elements: C(1,3) C(1,4) ! C(2,3) C(2,4) ! C(3,3) C(3,4) B = 99 ! Reference to a whole array consisting of ! elements: B(1), B(2), B(3), B(4), B(5), ! B(6), B(7), B(8), B(9), and B(10) 4 Declarators An array specification (or array declarator) declares the shape of an array. It takes the following form: (array-spec) array-spec Is one of the following array specifications: Explicit-shape Assumed-shape Assumed-size Deferred-shape The array specification is appended to the name of the array when the array is declared. The following examples show different forms of array specifications: SUBROUTINE SUB(N, C, D, Z) REAL, DIMENSION(N, 15) :: IARRY ! An explicit-shape array REAL C(:), D(0:) ! An assumed-shape array REAL, POINTER :: B(:,:) ! A deferred-shape array pointer REAL :: Z(N,*) ! An assumed-size array REAL, ALLOCATABLE, DIMENSION(:) :: K ! A deferred-shape ! allocatable array 5 Explicit_Shape An explicit-shape array is declared with explicit values for the bounds in each dimension of the array. An explicit-shape specification takes the following form: [lower-bound:] upper-bound [,[lower-bound:] upper-bound ]... The lower bound (if present) and the upper bound are specification expressions that have a positive, negative, or zero value. If necessary, the bound value is converted to integer type. If the lower bound is not specified, it is assumed to be 1. The bounds can be specified as constant or nonconstant expressions, as follows: o If the bounds are constant expressions, the subscript range of the array in a dimension is the set of integer values between and including the lower and upper bounds. If the lower bound is greater than the upper bound, the range is empty, the extent in that dimension is zero, and the array has a size of zero. o If the bounds are nonconstant expressions, the array must be declared in a procedure. The bounds can have different values each time the procedure is executed, since they are determined when the procedure is entered. The bounds are not affected by any redefinition or undefinition of the specification variables that occurs while the procedure is executing. The following explicit-shape arrays can specify nonconstant bounds: - An automatic array (the array is a local variable) - An adjustable array (the array is a dummy argument to a subprogram) The following are examples of explicit-shape specifications: INTEGER I(3:8, -2:5) ! Rank-two array; range of dimension one is ... ! 3 to 8, range of dimension two is -2 to 5 SUBROUTINE SUB(A, B, C) INTEGER :: B, C REAL, DIMENSION(B:C) :: A ! Rank-one array; range is B to C 6 Automatic_Arrays An automatic array is an explicit-shape array that is a local variable. Automatic arrays are only allowed in function and subroutine subprograms, and are declared in the specification part of the subprogram. At least one bound of an automatic array must be a nonconstant specification expression. The bounds are determined when the subprogram is called. The following example shows automatic arrays: SUBROUTINE SUB1 (A, B) INTEGER A, B, LOWER COMMON /BOUND/ LOWER ... INTEGER AUTO_ARRAY1(B) ... INTEGER AUTO_ARRAY2(LOWER:B) ... INTEGER AUTO_ARRAY3(20, B*A/2) END SUBROUTINE 6 Adjustable_Arrays An adjustable array is an explicit-shape array that is a dummy argument to a subprogram. At least one bound of an adjustable array must be a nonconstant specification expression. The bounds are determined when the subprogram is called. The array specification can contain integer variables that are either dummy arguments or variables in a common block. When the subprogram is entered, each dummy argument specified in the bounds must be associated with an actual argument. If the specification includes a variable in a common block, it must have a defined value. The array specification is evaluated using the values of the actual arguments, as well as any constants or common block variables that appear in the specification. The size of the adjustable array must be less than or equal to the size of the array that is its corresponding actual argument. To avoid possible errors in subscript evaluation, make sure that the bounds expressions used to declare multidimensional adjustable arrays match the bounds as declared by the caller. In the following example, the function computes the sum of the elements of a rank-two array. Notice how the dummy arguments M and N control the iteration: FUNCTION MY_SUM(A, M, N) DIMENSION A(M, N) SUMX = 0.0 DO J = 1, N DO I = 1, M SUMX = SUMX + A(I, J) END DO END DO MY_SUM = SUMX END FUNCTION The following are examples of calls on SUM: DIMENSION A1(10,35), A2(3,56) SUM1 = MY_SUM(A1,10,35) SUM2 = MY_SUM(A2,3,56) 5 Assumed_Shape An assumed-shape array is a dummy argument array that assumes the shape of its associated actual argument array. An assumed-shape specification takes the following form: [lower-bound]: [,[lower-bound]:] ... The lower bound is a specification expression. If the lower bound is not specified, it is assumed to be 1. The rank of the array is the number of colons (:) specified. The value of the upper bound is the extent of the corresponding dimension of the associated actual argument array + lower-bound - 1. The following is an example of an assumed-shape specification: INTERFACE SUBROUTINE SUB(M) INTEGER M(:, 1:, 5:) END SUBROUTINE END INTERFACE INTEGER L(20, 5:25, 10) CALL SUB(L) SUBROUTINE SUB(M) INTEGER M(:, 1:, 5:) END SUBROUTINE Array M has the same extents as array L, but array M has bounds (1:20, 1:21, 5:14). Note that an explicit interface is required when calling a routine that expects an assumed-shape or pointer array. 5 Assumed_Size An assumed-size array is a dummy argument array that assumes the size (only) of its associated actual argument array; the rank and extents can differ for the actual and dummy arrays. An assumed-size specification takes the following form: [exp-shape-spec,] [exp-shape-spec,]... [lower-bound:] * The exp-shape-spec is an explicit-shape specification (see DATA ARRAY DECL EXPL in online Help). The lower bound and upper bound are specification expressions that have a positive, negative, or zero value. If necessary, the bound value is converted to integer type. If a lower bound is not specified, it is assumed to be 1. The asterisk (*) represents the upper bound of the last dimension. The rank of the array is the number of explicit-shape specifications plus 1. The size of the array is assumed from the actual argument associated with the assumed-size dummy array as follows: o If the actual argument is an array of type other than default character, the size of the dummy array is the size of the actual array. o If the actual argument is an array element of type other than default character, the size of the dummy array is a + 1 - s, where "s" is the subscript value and "a" is the size of the actual array. o If the actual argument is a default character array, array element, or array element substring, and it begins at character storage unit b of an array with n character storage units, the size of the dummy array is as follows: MAX(INT((n + 1 - b) / y), 0) The "y" is the length of an element of the dummy array. An assumed-size array can only be used as a whole array reference in the following cases: o When it is an actual argument in a procedure reference that does not require the shape o In the intrinsic function LBOUND Because the actual size of an assumed-size array is unknown, an assumed-size array cannot be used as any of the following in an I/O statement: o An array name in the I/O list o A unit identifier for an internal file o A run-time format specifier The following is an example of an assumed-size specification: SUBROUTINE SUB(A, N) REAL A, N DIMENSION A(1:N, *) ... 5 Deferred_Shape A deferred-shape array is an array pointer or an allocatable array. The array specification contains a colon (:) for each dimension of the array. No bounds are specified. The bounds (and shape) of allocatable arrays and array pointers are determined when space is allocated for the array during program execution. An array pointer is an array declared with the POINTER attribute. Its bounds and shape are determined when it is associated with a target by pointer assignment, or when the pointer is allocated by execution of an ALLOCATE statement. In pointer assignment, the lower bound of each dimension of the array pointer is the result of the LBOUND intrinsic function applied to the corresponding dimension of the target. The upper bound of each dimension is the result of the UBOUND intrinsic function applied to the corresponding dimension of the target. A pointer dummy argument can be associated only with a pointer actual argument. An actual argument that is a pointer can be associated with a nonpointer dummy argument. A function result can be declared to have the pointer attribute. An allocatable array is declared with the ALLOCATABLE attribute. Its bounds and shape are determined when the array is allocated by execution of an ALLOCATE statement. The following are examples of deferred-shape specifications: REAL, ALLOCATABLE :: A(:,:) ! Allocatable array REAL, POINTER :: C(:), D (:,:,:) ! Array pointers 4 Whole_Arrays A whole array is referenced by the name of the array (without any subscripts). It can be a named constant or a variable. If a whole array appears in a nonexecutable statement, the statement applies to the entire array. For example: INTEGER, DIMENSION(2:11,3) :: L ! Specifies the type and ! dimensions of array L If a whole array appears in an executable statement, the statement applies to all of the elements in the array. For example: L = 10 ! The value 10 is assigned to all the ! elements in array L WRITE *, L ! Prints all the elements in array L 4 Subscripts Arrays can be referenced by individual elements or by a range of elements (array sections). A subscript list (appended to the array name) indicates which array element or array section is being referenced. In the subscript list for an array section, at least one of the subscripts must be a subscript triplet or vector subscript. VSI Fortran permits intrinsic noninteger expressions for subscripts, but they are converted to integers before use (any fractional parts are truncated). 4 Elements An array element is one of the scalar data items that make up an array. A subscript list (appended to the array or array component) determines which element is being referred to. A reference to an array element takes the following form: array [(s-list)] array Is the name of an array. s-list Is a list of one or more subscripts. The number of subscripts must equal the rank of the array. Each subscript must be a scalar numeric expression with a value that is within the bounds of its dimension. Each array element inherits the type, kind type parameter, and certain attributes (INTENT, PARAMETER, and TARGET) of the parent array. An array element cannot inherit the POINTER attribute. If an array element is of type character, it can be followed by a substring range in parentheses; for example: ARRAY_D(1,2) (1:3) ! elements are substrings of length 3 However, by convention, such an object is considered to be a substring rather than an array element. The following are some valid array element references for an array declared as REAL B(10,20): B(1,3), B(10,10), and B(5,8). For information on arrays as structure components, see DATA DERIVED COMP in online Help. 5 Order_of_Elements The elements of an array form a sequence known as the array element order. The position of an element in this sequence is its subscript order value. The elements of an array are stored as a linear sequence of values. A one-dimensional array is stored with its first element in the first storage location and its last element in the last storage location of the sequence. A multidimensional array is stored so that the leftmost subscripts vary most rapidly. This is called the order of subscript progression. In an array section, the subscript order of the elements is their order within the section itself. For example, if an array is declared as B(20), the section B(4:19:4) consists of elements B(4), B(8), B(12), and B(16). The subscript order value of B(4) in the array section is 1; the subscript order value of B(12) in the section is 3. 4 Sections An array section is a portion of an array that is an array itself. It is an array subobject. A section subscript list (appended to the array or array component) determines which portion is being referred to. A reference to an array section takes the following form: array [(sect-s-list)] [(substring-range)] array Is the name of an array. sect-s-list Is a list of one or more section subscripts (subscripts, subscript triplets, or vector subscripts) indicating a set of elements along a particular dimension. At least one of the items in the section subscript list must be a subscript triplet or vector subscript. Each subscript and subscript triplet must be a scalar numeric expression. Each vector subscript must be a rank-one integer expression. substring-range Is a substring range in the form [expr]:[expr]. Each expression specified must be a scalar numeric expression. The array (or array component) preceding the substring range must be of type character. If no section subscript list is specified, the rank and shape of the array section is the same as the parent array. Otherwise, the rank of the array section is the number of vector subscripts and subscript triplets that appear in the list. Its shape is a rank-one array where each element is the number of integer values in the sequence indicated by the corresponding subscript triplet or vector subscript. If any of these sequences is empty, the array section has a size of zero. The subscript order of the elements of an array section is that of the array object that the array section represents. Each array section inherits the type, kind type parameter, and certain attributes (INTENT, PARAMETER, and TARGET) of the parent array. An array section cannot inherit the POINTER attribute. The following shows valid references to array sections: REAL, DIMENSION(20) :: B ... PRINT *, B(2:20:5) ! the section consists of elements ! B(2), B(7), B(12), and B(17) K = (/3, 1, 4/) B(K) = 0.0 ! section B(K) is a rank-one array with ! shape (3) and size 3. (0.0 is assigned to ! B(1), B(3), and B(4).) Consider the following declaration: CHARACTER(LEN=15) C(10,10) An array section referenced as C(:,:)(1:3) is an array of shape (10,10) whose elements are substrings of length 3 of the corresponding elements of C. 5 Triplets A subscript triplet consists of three parts: the first two parts designate a range of subscript values and the third part designates the increment (stride) between each value. It takes the following form: [subscript-1] : [subscript-2] [:stride] subscript-1 Is a scalar numeric expression representing the first value in the subscript sequence. If omitted, the declared lower bound of the dimension is used. subscript-2 Is a scalar numeric expression representing the last value in the subscript sequence. If omitted, the declared upper bound of the dimension is used. When indicating sections of an assumed-size array, this subscript must be specified. stride Is a scalar numeric expression representing the increment between successive subscripts in the sequence. It must have a nonzero value. If it is omitted, it is assumed to be 1. The stride has the following effects: o If the stride is positive, the subscript range starts with the first subscript and is incremented by the value of the stride, until the largest value less than or equal to the second subscript is attained. For example, if an array has been declared as B(6,3,2), the array section specified as B(2:4,1:2,2) is a rank-two array with shape (3,2) and size 6. It consists of the following six elements: B(2,1,2) B(2,2,2) B(3,1,2) B(3,2,2) B(4,1,2) B(4,2,2) If the first subscript is greater than the second subscript, the range is empty. o If the stride is negative, the subscript range starts with the value of the first subscript and is decremented by the absolute value of the stride, until the smallest value greater than or equal to the second subscript is attained. For example, if an array has been declared as A(15), the array section specified as A(10:3:-2) is a rank-one array with shape (4) and size 4. It consists of the following four elements: A(10) A(8) A(6) A(4) If the second subscript is greater than the first subscript, the range is empty. If a range specified by the stride is empty, the array section has a size of zero. A subscript in a subscript triplet need not be within the declared bounds for that dimension if all values used to select the array elements are within the declared bounds. For example, if an array has been declared as A(15), the array section specified as A(4:16:10) is valid. The section is a rank-one array with shape (2) and size 2. It consists of elements A(4) and A(14). If the subscript triplet does not specify bounds or stride, but only a colon (:), the entire declared range for the dimension is used. 5 Vector_Subscripts A vector subscript is a rank-one array of integer values (within the declared bounds for the dimension). It is used to select a sequence of elements from a parent array. The sequence does not have to be in order, and it can contain duplicate values. For example, A is a rank-two array of shape (4,6). B and C are rank-one arrays of shape (2) and (3), respectively, with the following values: B = (/1,4/) C = (/2,1,1/) ! Will result in a many-one ! array section Array section A(3,B) consists of elements A(3,1) and A(3,4). Array section A(C,1) consists of elements A(2,1), A(1,1), and A(1,1). Array section A(B,C) consists of the following elements: A(1,2) A(1,1) A(1,1) A(4,2) A(4,1) A(4,1) An array section with a vector subscript that has two or more elements with the same value is called a many-one array section. A many-one section must not appear on the left of the equals sign in an assignment statement, or as an input item in a READ statement. The following assignments to C also show examples of vector subscripts: INTEGER A(2), B(2), C(2) ... B = (/1,2/) C(B) = A(B) C = A((/1,2/)) An array section with a vector subscript must not be any of the following: o An internal file o An actual argument associated with a dummy array that is defined or redefined (if the INTENT attribute is specified, it must be INTENT(IN)) o The target in a pointer assignment statement If the sequence specified by the vector subscript is empty, the array section has a size of zero. 4 Constructors An array constructor is a sequence of scalar values that is interpreted as a rank-one array. The array element values are those specified in the sequence. An array constructor takes the following form: (/ac-value-list/) ac-value-list Is a list of one or more expressions or implied-do loops. Each ac-value must have the same type and kind type parameter. An implied-do loop in an array constructor takes the following form: (ac-value-expr, do-variable = expr1, expr2 [,expr3]) ac-value-expr Is a scalar expression evaluated for each value of the d-variable to produce an array element value. do-variable Is the name of a scalar integer variable. Its scope is that of the implied-do loop. expr Is a scalar integer expression. The expr1 and expr2 specify a range of values for the loop; expr3 specifies the stride. The array constructor has the same type as the ac-value-list expressions. If the sequence of values specified by the array constructor is empty (there are no expressions or the implied-do loop produces no values), the rank-one array has a size of zero. The ac-value specifies the following: o If it is a scalar expression, its value specifies an element of the array constructor. o If it is an array expression, the values of the elements of the expression, in array element order, specify the corresponding sequence of elements of the array constructor. o If it is an implied-do loop, it is expanded to form an array constructor value sequence under the control of the DO variable, as in the DO construct. If every expression in an array constructor is a constant expression, the array constructor is a constant expression. If an implied-do loop is contained within another implied-do loop (nested), they cannot have the same DO variable (do-variable). There are three forms for an ac-value, as follows: C1 = (/4,8,7,6/) ! A scalar expression C2 = (/B(I, 1:5), B(I:J, 7:9)/) ! An array expression C3 = (/(I, I=1, 4)/) ! An implied-do loop You can also mix these forms, for example: C4 = (/4, A(1:5), (I, I=1, 4), 7/) To define arrays of more than one dimension, use the RESHAPE intrinsic function. The following are alternative forms for array constructors: o Square brackets (instead of parentheses and slashes) to enclose array constructors; for example, the following two array constructors are equivalent: INTEGER C(4) C = (/4,8,7,6/) C = [4,8,7,6] o A colon-separated triplet (instead of an implied-do loop) to specify a range of values and a stride; for example, the following two array constructors are equivalent: INTEGER D(3) D = (/1:5:2/) ! Triplet form D = (/(I, I=1, 5, 2)/) ! Implied-do loop form The following example shows an array constructor using an implied-do loop: INTEGER ARRAY_C(10) ARRAY_C = (/(I, I=30, 48, 2)/) The values of ARRAYC are the even numbers 30 through 48. The following example shows an array constructor of derived type that uses a structure constructor: TYPE EMPLOYEE INTEGER ID CHARACTER(LEN=30) NAME END TYPE EMPLOYEE TYPE(EMPLOYEE) CC_4T(4) CC_4T = (/EMPLOYEE(2732,"JONES"), EMPLOYEE(0217,"LEE"), & EMPLOYEE(1889,"RYAN"), EMPLOYEE(4339,"EMERSON")/) The following example shows how the RESHAPE intrinsic function is used to create a multidimensional array: E = (/2.3, 4.7, 6.6/) D = RESHAPE(SOURCE = (/3.5,(/2.0,1.0/),E/), SHAPE = (/2,3/)) D is a rank-two array with shape (2,3) containing the following elements: 3.5 1.0 4.7 2.0 2.3 6.6 4 Dynamic_Data Allocatable arrays and pointer targets can be dynamically allocated (created) and deallocated (freed), by using the ALLOCATE and DEALLOCATE statements, respectively. Pointers are associated with targets by pointer assignment or by allocating the target. They can be dynamically disassociated from targets by using the NULLIFY statement. 3 Constants A constant is a fixed value. The value of a constant can be a numeric value, a logical value, or a character string. A constant that has a name is a named constant. A named constant can be of any type, including derived type, and it can be array-valued. A named constant has the PARAMETER attribute and is specified in a type declaration statement or PARAMETER statement. A constant that does not have a name is a literal constant. A literal constant must be of intrinsic type and it cannot be array-valued. There are nine types of literal constants: integer, real, complex, binary, octal, hexadecimal, logical, character, and Hollerith. Binary, octal, hexadecimal, and Hollerith constants have no data type; they assume a data type that conforms to the context in which they are used. 4 Binary You can use this type of constant wherever numeric constants are allowed; it assumes a numeric data type according to its context. A binary constant has one of these forms: B'd[d...]' B"d[d...]" d Is a binary (base 2) digit (0 or 1). You can specify up to 128 binary digits in a binary constant. 4 Character A character constant is a string of printable ASCII characters enclosed by delimiters. It takes one of the following forms: [k_]'[c...]' [C] [k_]"[c...]" [C] k Is an optional kind type parameter (1 is the default). It must be followed by an underscore. c Is an ASCII character. C Is a C string specifier. If no kind type parameter is specified, the type is default character. The length of the character constant is the number of characters between the delimiters. In the apostrophe format, two consecutive apostrophes represent a single apostrophe. In the quotation mark format, two consecutive quotation marks represent a single quotation mark. The length of a character constant must be in the range 0 to 2000. 5 C_Strings String values in the C language are terminated with null characters (CHAR(0)) and can contain nonprintable characters (such as a backspace). Nonprintable characters are specified by escape sequences. An escape sequence is denoted by using the backslash (\) as an escape character, followed by a single character indicating the nonprintable character desired. This type of string is specified by using a standard string constant followed by the character C. The standard string constant is then interpreted as a C-language constant. Backslashes are treated as escapes, and a null character is automatically appended to the end of the string (even if the string already ends in a null character). The following C-style escape sequences are allowed in character constants: Escape Sequence Represents --------------- ---------- \a or \A A bell \b or \B A backspace \f or \F A formfeed \n or \N A new line \r or \R A carriage return \t or \T A horizontal tab \v or \V A vertical tab \x"hh" or \X"hh" A hexadecimal bit pattern \"ooo" An octal bit pattern \0 A null character \\ A backslash If a character constant contains any other escape sequence, the backslash is ignored. A C string must also be a valid Fortran string. If the string is delimited by apostrophes, apostrophes in the string itself must be represented by two consecutive apostrophes (''). For example, the escape sequence \'string causes a compiler error because Fortran interprets the apostrophe as the end of the string. The correct form is \''string. If the string is delimited by quotation marks, quotation marks in the string itself must be represented by two consecutive quotation marks (""). The sequences \"ooo" and \x"hh" allow any ASCII character to be given as a one- to three-digit octal or a one- to two-digit hexadecimal character code. Each octal digit must be in the range 0 to 7, and each hexadecimal digit must be in the range 0 to F. For example, the C strings '\010'C and '\x08'C) both represent a backspace character followed by a null character. The C string '\\abcd'C) is equivalent to the string '\abcd' with a null character appended. The string ''C represents the ASCII null character. 4 Complex A complex constant consists of a pair of real or integer constants. The two constants are separated by a comma and enclosed in parentheses. The first constant represents the real part of the number and the second constant represents the imaginary part. VSI Fortran provides three kind type parameters for data of type complex: COMPLEX(KIND=4) (or COMPLEX*8), COMPLEX(KIND=8) (or COMPLEX*16), and COMPLEX(KIND=16). COMPLEX(KIND=8) is DOUBLE COMPLEX. The type specifier for the complex type is COMPLEX; the type specifier for the double complex type is DOUBLE COMPLEX. If a kind type parameter is specified, the complex constant has the kind specified. If no kind type parameter is specified, the kind type of both parts is default real, and the constant is of type default complex. A COMPLEX (COMPLEX(KIND=4) or COMPLEX*8) constant has the form: (c,c) c Is an integer or REAL (REAL(KIND=4) or REAL*4) constant A DOUBLE COMPLEX (COMPLEX(KIND=8) or COMPLEX*16) constant has the form: (c,c) c Is an integer, REAL (REAL(KIND=4) or REAL*4), or DOUBLE PRECISION (REAL(KIND=8) or REAL*8) constant. At least one of the pair must be a DOUBLE PRECISION constant. A COMPLEX(KIND=16) or COMPLEX*32 constant has the form: (c,c) c Is an integer, REAL (REAL(KIND=4) or REAL*4), DOUBLE PRECISION (REAL(KIND=8) or REAL*8), or REAL (KIND=16) (or REAL*16) constant. At least one of the pair must be a a REAL(KIND=16)constant. Note that the comma and parentheses are required. 4 Hexadecimal You can use this type of constant wherever numeric constants are allowed; it assumes a numeric data type according to its context. A hexadecimal constant has one of these forms: Z'd[d...]' Z"d[d...]" d Is a hexadecimal (base 16) digit in the range 0 - 9, or a letter in the range A - F, or a - f You can specify up to 128 bits in hexadecimal (32 hexadecimal digits) constants. Leading zeros are ignored. 4 Hollerith A Hollerith constant is a string of printable characters preceded by a character count and the letter H. It is used only in numeric expressions and has the form: nHc[c...] n Is an unsigned, nonzero integer constant stating the number of characters in the string (including tabs and spaces). c Is a printable ASCII character. A Hollerith constant can be a string of 1 to 2000 characters and is stored as a byte string, one character per byte. Hollerith constants have no data type, but assume a numeric data type according to the context in which they are used. They assume data types according to the following rules: o When the constant is used with a binary operator, including the assignment operator, the data type of the constant is the data type of the other operand. o When a specific data type is required, that type is assumed for the constant. o When the constant is used as an actual argument, no data type is assumed. When the length of the constant is less than the length implied by the data type, blanks are appended to the constant on the right. When the length of the constant is greater than the length implied by the data type, the constant is truncated on the right. If any characters other than blank characters are truncated, an error occurs. 4 Integer An integer constant is a whole number with no decimal point. It can have a leading sign and is interpreted as a decimal number. VSI Fortran provides four kind type parameters for data of type integer: INTEGER(KIND=1) (or INTEGER*1), INTEGER(KIND=2) (or INTEGER*2), INTEGER(KIND=4) (or INTEGER*4), and INTEGER(KIND=8) (or INTEGER*8). The type specifier for the integer type is INTEGER. If a kind type parameter is specified, the integer has the kind specified. If a kind type parameter is not specified, integer constants are interpreted as follows: o If the integer constant is within the default integer kind, the kind is default integer. o If the integer constant is outside the default integer kind, the kind type of the integer constant is the smallest integer kind which holds the constant. Integer constants take the following form: [s]n[n...][_k] s Is a sign; required if negative (-), optional if positive (+). n Is a decimal digit (0 through 9). Any leading zeros are ignored. k Is an optional kind type parameter (1 for INTEGER(KIND=1), 2 for INTEGER(KIND=2), 4 for INTEGER(KIND=4), and 8 for INTEGER(KIND=8)). It must be preceded by an underscore (_). An unsigned constant is assumed to be nonnegative. Integers are expressed in decimal values (base 10) by default. To specify a constant that is not in base 10, use the following syntax: [s][[base] #]nnn... s Is a sign; required if negative (-), optional if positive (+). base Is any constant from 2 through 36. If "base" is omitted but # is specified, the integer is interpreted in base 16. If both "base" and # are omitted, the integer is interpreted in base 10. For bases 11 through 36, the letters A through Z represent numbers greater than 9. For example, for base 36, A represents 10, B represents 11, C represents 12, and so on, through Z, which represents 35. The case of the letters is not significant. For example, the following integers are all assigned a value equal to 3994575 decimal: I = 2#1111001111001111001111 K = #3CF3CF n = +17#2DE110 index = 36#2DM8F You can use integer constants to assign values to data. The integer data types have the following ranges: BYTE Same range as INTEGER*1 INTEGER*1 Signed integers: -128 to 127 (-2**7 to 2**7-1) (1 byte) Unsigned integers: 0 to 255 (2**8-1) INTEGER*2 Signed integers: -32768 to 32767 (2 bytes) (-2**15 to 2**15-1) Unsigned integers: 0 to 65535 (2**16-1) INTEGER*4 Signed integers: -2147483648 to 2147483647 (4 bytes) (-2**31 to 2**31-1) Unsigned integers: 0 to 4294967295 (2**32-1) INTEGER*8 Signed integers: -9223372036854775808 to (8 bytes) 9223372036854775807 (-2**63 to 2**63-1) NOTE1: The value of an integer constant must be within INTEGER(KIND=8) range. NOTE2: The "unsigned" ranges above are allowed for assignment to variables of these types, but the data type is treated as signed in arithmetic operations. 4 Logical A logical constant represents only the logical values true or false. It takes one of these forms: .TRUE.[_k] .FALSE.[_k] k Is an optional kind type parameter (1 for LOGICAL(KIND=1), 2 for LOGICAL(KIND=2), 4 for LOGICAL(KIND=4), and 8 for LOGICAL(KIND=8)). It must be preceded by an underscore (_). The type specifier for the logical type is LOGICAL. If a kind type parameter is specified, the logical constant has the kind specified. If no kind type parameter is specified, the kind type of the constant is default logical. Note that logical data type ranges correspond to their comparable integer data type ranges. For example, the LOGICAL*2 range is the same as the INTEGER*2 range. 4 Octal You can use this type of constant wherever numeric constants are allowed; it assumes a numeric data type according to its context. An octal constant has one of these forms: O'd[...d]' O"d[...d]" d Is an octal (base 8) digit in the range 0 - 7. You can specify up to 128 bits in octal (43 octal digits) constants. Leading zeros are ignored. 4 Real A real constant approximates the value of a mathematical real number. The value of the constant can be positive, zero, or negative. VSI Fortran provides three kind type parameters for data of type real: REAL(KIND=4) (or REAL*4), REAL(KIND=8) (or REAL*8), and REAL(KIND=16) (or REAL*16). REAL(KIND=8) is DOUBLE PRECISION. If DOUBLE PRECISION is used, a kind type parameter must not be specified for the constant. The type specifier for the real (single-precision) type is REAL; the type specifier for the double precision type is DOUBLE PRECISION. If a kind type parameter is specified, the real constant has the kind specified. If a kind type parameter is not specified, the kind is default real. The following is the general form of a real constant with no exponent part: [s]n[n...][_k] A real constant with an exponent part has one of the following forms: [s]n[n...]E[s]nn...[_k] [s]n[n...]D[s]nn... [s]n[n...]Q[s]nn... s Is a sign; required if negative (-), optional if positive (+). n Is a decimal digit (0 through 9). A decimal point must appear if the real constant has no exponent part. k Is an optional kind type parameter (4 for REAL(KIND=4), 8 for REAL(KIND=8), or 16 for REAL(KIND=16)). It must be preceded by an underscore (_). Leading zeros (zeros to the left of the first nonzero digit) are ignored in counting significant digits. For example, in the constant 0.00001234567, all of the nonzero digits, and none of the zeros, are significant. (See the following sections for the number of significant digits each kind type parameter typically has). The exponent represents a power of 10 by which the preceding real or integer constant is to be multiplied (for example, 1.0E6 represents the value 1.0 * 10**6). A real constant with no exponent part is (by default) a single-precision (REAL(KIND=4)) constant. You can change this default behavior by specifying the compiler option /ASSUME=FPCONSTANT. If the real constant has no exponent part, a decimal point must appear in the string (anywhere before the optional kind type parameter). If there is an exponent part, a decimal point is optional in the string preceding the exponent part; the exponent part must not contain a decimal point. The exponent letter E denotes a single-precision real (REAL(KIND=4) or REAL*4) constant, unless the optional kind type parameter specifies otherwise. For example, -9.E2_8 is a double-precision constant (which can also be written as -9.D2). The exponent letter D denotes a double-precision real (REAL(KIND=8) or REAL*8) constant. The exponent letter Q denotes a quad-precision real (REAL(KIND=16) or REAL*16) constant. A minus sign must appear before a negative real constant; a plus sign is optional before a positive constant. Similarly, a minus sign must appear between the exponent letter (E, D, or Q) and a negative exponent, whereas a plus sign is optional between the exponent letter and a positive exponent. If the real constant includes an exponent letter, the exponent field cannot be omitted, but it can be zero. To specify a real constant using both an exponent letter and a kind type parameter, the exponent letter must be E, and the kind type parameter must follow the exponent part. 5 DOUBLE_PRECISION See DATA CONSTANTS REAL REAL_8 in this Help file. 5 REAL_4 REAL(KIND=4) or REAL*4 A single-precision REAL constant occupies four bytes of memory. The number of digits is unlimited, but typically only the leftmost seven digits are significant. Either VAX F_floating or IEEE S_floating format is used, depending on the compiler option specified. 5 REAL_8 DOUBLE PRECISION (REAL(KIND=8) or REAL*8) A DOUBLE PRECISION constant has more than twice the accuracy of a REAL number, and greater range. A DOUBLE PRECISION constant occupies eight bytes of memory. The number of digits that precede the exponent is unlimited, but typically only the leftmost 15 digits are significant. Either VAX D_floating, G_floating, or IEEE T_floating format is used, depending on the compiler option specified. 5 REAL_16 REAL(KIND=16) or REAL*16 A REAL(KIND=16) constant has more than four times the accuracy of a REAL number, and a greater range. A REAL(KIND=16) constant occupies 16 bytes of memory. The number of digits that precede the exponent is unlimited, but typically only the leftmost 33 digits are significant. 4 Type_of_BOH_Constants Binary, octal, and hexadecimal constants are "typeless" numeric constants. They assume data types based on their usage, according to the following rules: o When the constant is used with a binary operator, including the assignment operator, the data type of the constant is the data type of the other operand. o When a specific data type is required, that type is assumed for the constant. o When the constant is used as an actual argument, if the bit constant is greater than 4 bytes, INTEGER*8 is assumed; otherwise, INTEGER*4 is assumed. o When the constant is used in any other context, an INTEGER*4 data type is assumed (unless a compiler option indicating integer size specifies otherwise). These constants specify up to 16 bytes of data. When the length of the constant is less than the length implied by the data type, the leftmost digits have a value of zero. When the length of the constant is greater than the length implied by the data type, the constant is truncated on the left. An error results if any nonzero digits are truncated. 3 Derived_Types Like intrinsic data types, a Fortran 95/90 derived data type has a name, a set of associated values, a way to denote the values, and operations to manipulate and interpret these values. The names of the intrinsic data types are predefined, while the names of derived types are defined in derived-type definitions. A derived-type definition specifies the name of the type and the types of its components. A derived type can be resolved into "ultimate" components that are either of intrinsic type or are pointers. The set of values for a specific derived type consists of all possible sequences of component values permitted by the definition of that derived type. Structure constructors are used to specify values of derived types. Nonintrinsic assignment for derived-type entities must be defined by a subroutine with an ASSIGNMENT interface. Any operation on derived-type entities must be defined by a function with an OPERATOR interface. Arguments and function values can be of any intrinsic or derived type. 4 Type_Definitions A derived-type definition specifies the name of a user-defined type and the types of its components. It takes the following form: TYPE [[, PRIVATE or PUBLIC] :: ] name [PRIVATE or SEQUENCE]... comp-def [comp-def]... END TYPE [name] name Is the name of the derived type. It must not be the same as the name of any intrinsic type, or the same as the name of a derived type that can be accessed from a module. comp-def There must be at least one. It takes the following form: type [ [, attr-list] ::] comp [(a-spec)] [*char-len] [init_ex] type Is a type specifier. It can be an intrinsic type or a previously defined derived type. (If the POINTER attribute follows this specifier, the type can also be any accessible derived type, including the type being defined.) attr-list Is an optional list of component attributes POINTER or DIMENSION. You can specify one or both attributes. If DIMENSION is specified, it can be followed by an array specification. comp Is the name of the component being defined. a-spec Is an optional array specification, enclosed in parentheses. If POINTER is specified, the array is deferred-shape; otherwise, it is explicit-shape. In an explicit-shape specification, each bound must be a constant scalar integer expression. char-len Is an optional scalar integer literal constant; it must be preceded by an asterisk (*). This parameter can only be specified if the component is of type CHARACTER. init_ex Is an initialization expression or, for pointer objects, =>NULL(). If a name is specified following the END TYPE statement, it must be the same name that follows TYPE in the derived type statement. Within a scoping unit, a derived-type name can only be defined once. If the same derived-type name appears in a derived-type definition in another scoping unit, it is treated independently. A component name has the scope of the derived-type definition only. Therefore, the same name can be used in another derived-type definition in the same scoping unit. Two entities can have the same derived type in the following cases: o If they are both declared to be of the same derived type, and the derived-type definition can be accessed from the same module, the same scoping unit, or a host scoping unit. o If they are both declared to be of the same derived type, and the derived-type definition can be accessed from the same scoping unit or a host scoping unit. o If they are both declared in a derived-type definition specifying SEQUENCE (they both have sequence type). A sequence type can be defined in each scoping unit that needs to access the type. Each derived-type definition must specify the same name, the keyword SEQUENCE, and have components that agree in order, name, and attributes. (No private components are allowed in a sequence type.) The same PRIVATE or SEQUENCE statements can only appear once in a given derived-type definition. If SEQUENCE is present, all derived types specified in component definitions must be sequence types. The PUBLIC or PRIVATE keywords can only appear if the derived-type definition is in the specification part of a module. The POINTER or DIMENSION attribute can only appear once in a given comp-def. A component is an array if the component definition contains a DIMENSION attribute or an array specification. If the component definition contains an array specification, the array bounds should be specified there; otherwise, they must be specified following the DIMENSION attribute. If an initialization expression ("init_ex") appears for a nonpointer component, the component (in any object of the type) is initially defined with the value determined from the initialization expression. The initialization expression is evaluated in the scoping unit of the type definition. The initialization expression overrides any default initial value specified for the component. Explicit initialization in a type declaration statement overrides default initialization. If POINTER appears in the comp-def, the component is a pointer. Pointers can have an association status of associated, disassociated, or undefined. If no default initialization status is specified, the status of the pointer is undefined. To specify disassociated status for a pointer component, use =>NULL(). 4 Components A reference to a component of a derived-type structure takes the following form: parent [%component [(s-list)]]... %component [(s-list)] parent Is the name of a scalar or array of derived type. The percent sign (%) is called a component selector. component Is the name of a component of the immediately preceding parent or component. s-list Is a list of one or more subscripts. If the list contains subscript triplets or vector subscripts, the reference is to an array section. Each subscript must be a scalar numeric expression with a value that is within the bounds of its dimension. The number of subscripts in any s-list must equal the rank of the immediately preceding parent or component. Each parent or component (except the rightmost) must be of derived type. The parent or one of the components can have nonzero rank (be an array). Any component to the right of a parent or component of nonzero rank must not have the POINTER attribute. The rank of the structure component is the rank of the part (parent or component) with nonzero rank (if any); otherwise, the rank is zero. The type and type parameters (if any) of a structure component are those of the rightmost part name. The structure component must not be referenced or defined before the declaration of the parent object. If the parent object has the INTENT, TARGET, or PARAMETER attribute, the structure component also has the attribute. 5 Examples The following example shows a derived-type definition with two components: TYPE EMPLOYEE INTEGER ID CHARACTER(LEN=40) NAME END TYPE EMPLOYEE The following shows how to declare a variable CONTRACT of type EMPLOYEE: TYPE(EMPLOYEE) :: CONTRACT Note that both examples started with the keyword TYPE. The first (initial) statement of a derived-type definition is called a derived-type statement, while the statement that declares a derived-type object is called a TYPE statement. The following example shows how to reference component ID of parent structure CONTRACT: CONTRACT%ID The following example shows a derived type with a component that is a previously defined type: TYPE DOT REAL X, Y END TYPE DOT .... TYPE SCREEN TYPE(DOT) C, D END TYPE SCREEN The following declares a variable of type SCREEN: TYPE(SCREEN) M Variable M has components M%C and M%D (both of type DOT); M%C has components M%C%X and M%C%Y of type REAL. The following example shows a derived type with a component that is an array: TYPE CAR_INFO INTEGER YEAR CHARACTER(LEN=15), DIMENSION(10) :: MAKER CHARACTER(LEN=10) MODEL, BODY_TYPE*8 REAL PRICE END TYPE ... TYPE(CAR_INFO) MY_CAR Note that MODEL has a character length of 10, but BODYTYPE has a character length of 8. You can assign a value to a component of a structure; for example: MY_CAR%YEAR = 1985 The following shows an array structure component: MY_CAR%MAKER In the preceding example, if a subscript list (or substring) was appended to MAKER, the reference would not be to an array structure component, but to an array element or section. Consider the following: TYPE CHARGE INTEGER PARTS(40) REAL LABOR REAL MILEAGE END TYPE CHARGE TYPE(CHARGE) MONTH TYPE(CHARGE) YEAR(12) Some valid array references for this type follow: MONTH%PARTS(I) ! An array element MONTH%PARTS(I:K) ! An array section YEAR(I)%PARTS ! An array structure component ! (a whole array) YEAR(J)%PARTS(I) ! An array element YEAR(J)%PARTS(I:K) ! An array section YEAR(J:K)%PARTS(I) ! An array section YEAR%PARTS(I) ! An array section The following example shows a derived type with a pointer component that is of the type being defined: TYPE NUMBER INTEGER NUM TYPE(NUMBER), POINTER :: BEFORE_NUM TYPE(NUMBER), POINTER :: AFTER_NUM END TYPE A type such as this can be used to construct linked lists of objects of type NUMBER. The following example shows a private type: TYPE, PRIVATE :: SYMBOL LOGICAL TEST CHARACTER(LEN=50) EXPLANATION END TYPE SYMBOL This type is private to the module. The module can be used by another scoping unit, but type SYMBOL is not available. The following example shows a derived-type definition that is public with components that are private: MODULE MATTER TYPE ELEMENTS PRIVATE INTEGER C, D END TYPE ... END MODULE MATTER In this case, components C and D are private to type ELEMENTS, but type ELEMENTS is not private to MODULE MATTER. Any program unit that uses the module MATTER can declare variables of type ELEMENTS, and pass as arguments values of type ELEMENTS. This design allows you to change components of a type without affecting other program units that use the module. If a derived type is needed in more than one program unit, the definition should be placed in a module and accessed by a USE statement whenever it is needed, as follows: MODULE STUDENTS TYPE STUDENT_RECORD ... END TYPE CONTAINS SUBROUTINE COURSE_GRADE(...) TYPE(STUDENT_RECORD) NAME ... END SUBROUTINE END MODULE STUDENTS ... PROGRAM SENIOR_CLASS USE STUDENTS TYPE(STUDENT_RECORD) ID ... END PROGRAM Program SENIOR_CLASS has access to type STUDENT_RECORD, because it uses module STUDENTS. Module procedure COURSE_GRADE also has access to type STUDENT_RECORD, because the derived-type definition appears in its host. 4 Constructors A structure constructor lets you specify scalar values of a derived type. It takes the following form: d-name (expr-list) d-name Is the name of the derived type. expr-list Is a list of expressions specifying component values. The values must agree in number and order with the components of the derived type. If necessary, values are converted (according to the rules of assignment), to agree with their corresponding components in type and kind type parameters. A structure constructor must not appear before its derived type is defined. If a component of the derived type is an array, the shape in the expression list must conform to the shape of the component array. If a component of the derived type is a pointer, the value in the expression list must evaluate to an object that would be a valid target in a pointer assignment statement. (A constant is not a valid target in a pointer assignment statement.) If all the values in a structure constructor are constant expressions, the constructor is a derived-type constant expression. 5 Examples Consider the following derived-type definition: TYPE EMPLOYEE INTEGER ID CHARACTER(LEN=40) NAME END TYPE EMPLOYEE This can be used to produce the following structure constructor: EMPLOYEE(3472, "John Doe") The following example shows a type with a component of derived type: TYPE ITEM REAL COST CHARACTER(LEN=30) SUPPLIER CHARACTER(LEN=20) ITEM_NAME END TYPE ITEM TYPE PRODUCE REAL MARKUP TYPE(ITEM) FRUIT END TYPE PRODUCE In this case, you must use an embedded structure constructor to specify the values of that component; for example: PRODUCE(.70, ITEM (.25, "Daniels", "apple")) 3 Expressions An expression represents either a data reference or a computation, and is formed from operators, operands, and parentheses. The result of an expression is either a scalar value or an array of scalar values. If the value of an expression is of intrinsic type, it has a kind type parameter. (If the value is of intrinsic type CHARACTER, it also has a length parameter.) If the value of an expression is of derived type, it has no kind type parameter. An operand is a scalar or array. An operator can be either intrinsic or defined. An intrinsic operator is known to the compiler and is always available to any program unit. A defined operator is described explicitly by a user in a function subprogram and is available to each program unit that uses the subprogram. The simplest form of an expression (a primary) can be any of the following: o A constant; for example, 4.2 o A subobject of a constant; for example, 'LMNOP'(2:4) o A variable; for example, VAR1 o A structure constructor; for example, EMPLOYEE(3472, "JOHN DOE") o An array constructor; for example, (/12.0,16.0/) o A function reference; for example, COS(X) o Another expression in parentheses; for example, (I+5) Any variable or function reference used as an operand in an expression must be defined at the time the reference is executed. If the operand is a pointer, it must be associated with a target object that is defined. An integer operand must be defined with an integer value rather than a statement label value. All of the characters in a character data object reference must be defined. When a reference to an array or an array section is made, all of the selected elements must be defined. When a structure is referenced, all of the components must be defined. In an expression that has intrinsic operators with an array as an operand, the operation is performed on each element of the array. In expressions with more than one array operand, the arrays must be conformable (they must have the same shape). The operation is applied to corresponding elements of the arrays, and the result is an array of the same shape (the same rank and extents) as the operands. In an expression that has intrinsic operators with a pointer as an operand, the operation is performed on the value of the target associated with the pointer. For defined operators, operations on arrays and pointers are determined by the procedure defining the operation. A scalar is conformable with any array. If one operand of an expression is an array and another operand is a scalar, it is as if the value of the scalar were replicated to form an array of the same shape as the array operand. The result is an array of the same shape as the array operand. The ranking assigned to each numeric intrinsic data type follows: Data Type Ranking --------- ------- LOGICAL*1 and BYTE lowest LOGICAL*2 . LOGICAL*4 . LOGICAL*8 . INTEGER*1 . INTEGER*2 . INTEGER*4 . INTEGER*8 . REAL (REAL*4) . REAL*16 . DOUBLE PRECISION (REAL*8) . COMPLEX (COMPLEX*8) . DOUBLE COMPLEX (COMPLEX*16) . COMPLEX*32 highest 4 Numeric Numeric (arithmetic) expressions are formed with numeric operands and numeric operators, and yield a single numeric value. The term numeric includes logical data, because logical data is treated as integer data when used in a numeric context. (.TRUE. is -1; .FALSE. is 0.) The numeric operators are as follows: Operator Description ----------------------- ** exponentiation (evaluated right to left) * multiplication / division + addition - subtraction You can use parentheses to force an order of evaluation. 4 Character Character expressions consist of character items and character operators. Evaluation of a character expression yields a single value of character data type. A character expression has the form: character operand[//character operand]... The concatenation operator (//) is the only character operator. Concatenation is from left to right. 4 Defined_Operations A defined operation is unary or binary. It is defined by a function subprogram containing a generic interface block with the specifier OPERATOR. A defined operation is not an intrinsic operation. However, you can use a defined operation to extend the meaning of an intrinsic operator. For defined unary operations, the function must contain one argument. For defined binary operations, the function must contain two arguments. Interpretation of the operation is provided by the function that defines the operation. A Fortran 95/90 defined operator can contain up to 31 letters, and is enclosed in periods (.). Its name cannot be the same name as any of the following: o The intrinsic operators .NOT., .AND., .OR., .XOR., .EQV., .NEQV., .EQ., .NE., .GT., .GE., .LT., and .LE. o The logical literal constants .TRUE. or .FALSE.. No two intrinsic operators can follow one another, but an intrinsic or binary operator can be followed by a defined unary operator. The result of a defined operation can have any type. The type of the result (and its value) must be specified by the defining function. The following examples show expressions containing defined operators: .COMPLEMENT. A X .PLUS. Y .PLUS. Z M * .MINUS. N 4 Initialization An initialization expression must evaluate at compile time to a constant. It is used to specify an initial value for an entity. In an initialization expression, each operation is intrinsic and each operand is one of the following: o A constant or subobject of a constant o An array constructor where each element, and the bounds and strides of each implied-do are expressions whose primaries are initialization expressions o A structure constructor whose components are initialization expressions o An elemental intrinsic function reference of type integer or character, whose arguments are initialization expressions of type integer or character o A reference to one of the following inquiry functions: BIT_SIZE MINEXPONENT DIGITS PRECISION EPSILON RADIX HUGE RANGE ILEN SHAPE KIND SIZE LBOUND TINY LEN UBOUND MAXEXPONENT Each function argument must be one of the following: - An initialization expression - A variable whose kind type parameter and bounds are not assumed or defined by an ALLOCATE statement, pointer assignment, or an expression that is not an initialization expression o A reference to one of the following transformational functions (each argument must be an initialization expression): REPEAT RESHAPE SELECTED_INT_KIND SELECTED_REAL_KIND TRANSFER TRIM o A reference to the transformational function NULL o An implied-do variable within an array constructor where the bounds and strides of the corresponding implied-do are initialization expressions o Another initialization expression enclosed in parentheses Each subscript, section subscript, and substring starting and ending point must be an initialization expression. In an initialization expression, the exponential operator (**) must have a power of type integer. If an initialization expression invokes an inquiry function for a type parameter or an array bound of an object, the type parameter or array bound must be specified in a prior specification statement (or to the left of the inquiry function in the same statement). 4 Logical Logical expressions can contain one or more logical operators and logical, integer, or relational operands. The following are logical operators: Operator Meaning --------------------------- .AND. Logical conjunction: the expression A .AND. B is true if both A and B are true. .OR. Logical disjunction (inclusive OR): the ex- pression A .OR. B is true if either A, B, or both, are true. .XOR. Same as .NEQV. .NEQV. Logical inequivalence (or exclusive OR): the expression A .NEQV. B is true if either A or B is true, but false if both are true. .EQV. Logical equivalence: the expression A .EQV. B is true if both A and B are true, or both are false. .NOT. Logical negation: the expression .NOT. A is true if A is false and false if A is true. 4 Operator_Precedence The following shows the precedence of all intrinsic and defined operators: Category Operator Precedence --------------------------------------------------- N/A Defined Unary Operators Highest Numeric ** . Numeric * or / . Numeric Unary + or - . Numeric Binary + or - . Character // . Relational .EQ.,.NE.,.LT.,.LE.,.GT.,.GE. . ==, /=, <, <=, >, >= . Logical .NOT. . Logical .AND. . Logical .OR. . Logical .XOR., .EQV., .NEQV. . N/A Defined Binary Operators Lowest 4 Relational Relational expressions consist of two or more expressions whose values are compared to determine whether the relationship stated by the relational operator is satisfied. The expression is reduced to a logical value (true or false). The following are relational operators: Operator Meaning ------------------------------------------ .LT. or < Less than .LE. or <= Less than or equal to .EQ. or == Equal to .NE. or /= Not equal to .GT. or > Greater than .GE. or >= Greater than or equal to NOTE: Expressions of COMPLEX data type can use only .EQ. and .NE. operators. 4 Specification A specification expression is a restricted expression that is of type integer and has a scalar value. This type of expression appears only in the declaration of array bounds and character lengths. In a restricted expression, each operation is intrinsic and each operand is one of the following: o A constant or subobject of a constant o A variable that is one of the following: - A dummy argument that does not have the OPTIONAL or INTENT (OUT) attribute (or the subobject of such a variable) - In a common block (or the subobject of such a variable) - Made accessible by use or host association (or the subobject of such a variable) o A structure constructor whose components are restricted expressions o An implied-do variable within an array constructor where the bounds and strides of the corresponding implied-do are initialization expressions o A reference to one of the following inquiry functions: BIT_SIZE NWORKERS DIGITS PRECISION EPSILON PROCESSORS_SHAPE HUGE RADIX ILEN RANGE KIND SHAPE LBOUND SIZE LEN SIZEOF MAXEXPONENT TINY MINEXPONENT UBOUND NUMBER_OF_PROCESSORS Each function argument must be one of the following: - A restricted expression - A variable whose properties inquired about are not dependent on the upper bound of the last dimension of an assumed-size array, are not defined by an expression that is a restricted expression, or are not definable by an ALLOCATE or pointer assignment statement. o A reference to any other intrinsic function where each argument is a restricted expression. o A reference to a specification function (see below) where each argument is a restricted expression o An array constructor where each element, and bounds and strides of each implied-do are expressions whose primaries are restricted expressions o Another restricted expression enclosed in parentheses Each subscript, section subscript, and substring starting and ending point must be a restricted expression. Specification functions can be used in specification expressions to indicate the attributes of data objects. A specification function is a pure function. It cannot have a dummy procedure argument or be any of the following: o An intrinsic function o An internal function o A statement function o Defined as RECURSIVE A variable in a specification expression must have its type and type parameters (if any) specified in one of the following ways: o By a previous declaration in the same scoping unit o By the implicit typing rules currently in effect for the scoping unit o By host or use association If a variable in a specification expression is typed by the implicit typing rules, its appearance in any subsequent type declaration statement must confirm the implied type and type parameters. If a specification expression invokes an inquiry function for a type parameter or an array bound of an object, the type parameter or array bound must be specified in a prior specification statement (or to the left of the inquiry function in the same statement). 3 Intrinsic_Types VSI Fortran provides the following intrinsic data types: o INTEGER (4 kind type parameters) - a whole number o REAL (3 kind type parameters) - a floating point number (a whole number, a decimal fraction, or a combination) o DOUBLE PRECISION - a REAL kind type parameter that has more than twice the degree of accuracy in its representation, and greater range o COMPLEX (3 kind type parameters) - a pair of REAL values representing a complex number (the first part of the number is the real part, the second is the imaginary part) o DOUBLE COMPLEX - a COMPLEX kind type parameter with DOUBLE PRECISION real and imaginary parts o LOGICAL (4 kind type parameters)- a logical value, .TRUE. or .FALSE. o CHARACTER - a sequence of characters o BYTE - a one-byte value equivalent to INTEGER(KIND=1) 4 CHARACTER A character string is a contiguous sequence of bytes in memory. A character string is specified by two attributes: the address of the first byte of the string and the length of the string in bytes. The length of the string must be in the range 1 through 65535. Hollerith constants are stored internally, one character per byte. 4 COMPLEX Real and complex numbers are floating-point representations. COMPLEX(KIND=4) (or COMPLEX*8) data is eight contiguous bytes aligned on an arbitrary byte boundary. The low-order four bytes contain REAL(KIND=4) (or REAL*4) data that represents the real part of the complex number. The high-order four bytes contain REAL data that represents the imaginary part of the complex number. For information on the ranges of REAL data, see REAL (within the DATA CONSTANTS section of online Help). DOUBLE COMPLEX (COMPLEX(KIND=8) or COMPLEX*16) data is 16 contiguous bytes aligned on an arbitrary byte boundary. The low-order bytes contain DOUBLE PRECISION data that represents the real part of the complex number. The high-order eight bytes contain DOUBLE PRECISION data that represents the imaginary part of the complex data. For information on the ranges of DOUBLE PRECISION data, see DOUBLE_PRECISION (within the DATA CONSTANTS section of online Help). COMPLEX(KIND=16) (or COMPLEX*32) data is 32 contiguous bytes aligned on an arbitrary byte boundary. The low-order bytes contain REAL(KIND=16) (or REAL*16) data that represents the real part of the complex number. The high-order bytes contain REAL*16 data that represents the imaginary part of the complex number. For information on the ranges of REAL*16 data, see REAL (within the DATA CONSTANTS section of online Help). 4 INTEGER Integer numbers are whole numbers. For information on the ranges of INTEGER data, see INTEGER (within the DATA CONSTANTS section of online Help). INTEGER*2, INTEGER*4, and INTEGER*8 values are stored in two's complement form. Note that logical data type ranges correspond to their comparable integer data type ranges. For example, in LOGICAL*2 L, the range for L is the same as the range for INTEGER*2 integers. 4 LOGICAL Logical values start on an arbitrary byte boundary and are stored in one, two, or four contiguous bytes. The low-order bit (bit 0) determines the value. If bit 0 is set, the value is .TRUE.; if bit 0 is clear, the value is .FALSE. The remaining bits are undefined. When a logical value is stored in memory, all of its bits are stored. For example, consider the following: LOGICAL*4 L1, L2, L3 L1 = L2 .AND. L3 This example does a full 32-bit AND of L2 and L3, and stores all 32 resulting bits in L1. 4 REAL Real and complex numbers are floating-point representations. The exponent for REAL(KIND=4) (or REAL*4) (F_floating) and DOUBLE PRECISION (REAL(KIND=8) or REAL*8) (D_floating) formats is stored in binary excess 128 notation. Binary exponents from -127 to 127 are represented by the binary equivalents of 1 through 255. The exponent for the DOUBLE PRECISION G_floating format and T_floating format is stored in binary excess 1024 notation. The exponent for the REAL*16 format is stored in binary excess 16384 notation. In DOUBLE PRECISION (G_floating) format, binary exponents from -1023 to 1023 are represented by the binary equivalents of 1 through 2047. In REAL*16 format, binary exponents from -16383 to 16383 are represented by the binary equivalents of 1 through 32767. For floating-point format, fractions are represented in sign-magnitude notation, with the binary radix point to the left of the most significant bit for F_floating, D_floating, and G_floating, and to the right of the most significant bit for S_floating and T_floating. Fractions are assumed to be normalized, and therefore the most significant bit is not stored. This bit is assumed to be 1 unless the exponent is 0. in which case the value represented is either zero or is a reserved operand. REAL(KIND=4) (or REAL*4) numbers occupy four contiguous bytes and the precision is approximately one part in 2**23, that is, typically 7 decimal digits. DOUBLE PRECISION (D_floating) numbers occupy eight contiguous bytes and the precision is approximately one part in 2**55, that is, typically 16 decimal digits. DOUBLE PRECISION G_floating numbers occupy eight contiguous bytes and the precision is approximately one part in 2**52, that is, typically 15 decimal digits. REAL*16 (H_floating) numbers occupy sixteen contiguous bytes and the precision is approximately 2**112, that is, typically 33 decimal digits. For more information on real data type ranges, see DATA CONSTANTS REAL and DATA CONSTANTS DOUBLE_PRECISION in this Help file. 3 Substrings A character substring is a contiguous segment of a character variable, character array element, or character field reference. It has one of the following forms: v([e1]:[e2]) a(s[,s]...)([e1]:[e2]) v Is a character variable name a Is a character array name s Is a subscript expression e1 Is a numeric expression specifying the leftmost character position of the substring e2 Is a numeric expression specifying the rightmost character position of the substring Both e1 and e2 must be within the range 1,2, ..., len, where len is the length of the parent character string. If e1 exceeds e2, the substring has length zero. 3 Variables A variable is a data object whose value can be changed at any point in a program. It can be any of the following: o A scalar name A scalar is a single object that has a single value; it can be of any intrinsic or user-defined type. o An array name An array is a collection of scalar elements of any intrinsic or derived type. All elements must be have the same type and kind type parameter. o A subobject designator A subobject is part of an object. The following are subobjects: An array element An array section A structure component A substring For example, B(3) is a subobject (array element) designator for array B. A subobject cannot be a variable if its parent object is a constant. The name of a variable is associated with a single storage location. Variables are classified by data type, as constants are. The data type of a variable indicates the type of data it contains, including its precision, and implies its storage requirements. When data of any type is assigned to a variable, it is converted to the data type of the variable (if necessary). A variable is usually defined in a type declaration statement or DATA statement. But during program execution, events can occur to cause variables to be defined or redefined (such as assignment statements and READ statements), or undefined (such as an I/O error). Scalar variables are assigned data types explicitly in type declaration statements or IMPLICIT statements, or they can have implicit data types. 4 Implicit_Typing By default, all variables with names beginning with I, J, K, L, M, or N are assumed to be integer variables. Variables beginning with any other letter are assumed to be real variables. Names beginning with a dollar sign ($) are implicitly INTEGER. You can override the default data type implied in a name by specifying data type explicitly in either an IMPLICIT statement or a type declaration statement. Note: You cannot change the implicit type of a name beginning with a dollar sign in an IMPLICIT statement. 4 Explicit_Typing Type declaration statements explicitly specify the data type of scalar variables. For example, the following statements associate VAR1 with an 8-byte complex storage location, and VAR2 with an 8-byte double-precision storage location: COMPLEX VAR1 DOUBLE PRECISION VAR2 You can explicitly specify the data type of a scalar variable only once. An explicit data type specification takes precedence over the type specified by an IMPLICIT statement. If no explicit data type specification appears, any variable with a name that begins with the letter in the range specified in the IMPLICIT statement becomes the data type of the variable. Character type declaration statements specify that given variables represent character values with the length specified. For example, the following statements associate the variable names INLINE, NAME, and NUMBER with storage locations containing character data of lengths 72, 12, and 9, respectively: CHARACTER*72 INLINE CHARACTER NAME*12, NUMBER*9 In single subprograms, assumed-length character arguments can be used to process character strings with different lengths. The assumed-length character argument has its length specified with an asterisk, for example: CHARACTER*(*) CHARDUMMY The argument CHARDUMMY assumes the length of the actual argument. 2 Format_Specifiers A format appearing in an input or output (I/O) statement specifies the form of data being transferred and the data conversion (editing) required to achieve that form. The format specified can be explicit or implicit. Explicit format is indicated in a format specification that appears in a FORMAT statement or a character expression (the expression must evaluate to a valid format specification). The format specification contains edit descriptors, which can be data edit descriptors, control edit descriptors, or string edit descriptors. Implicit format is determined by the processor and is specified using list-directed or namelist formatting. List-directed formatting is specified with an asterisk (*); namelist formatting is specified with a namelist group name. List-directed formatting can be specified for advancing, sequential files and internal files. Namelist formatting can be specified only for advancing, sequential files. 3 Default_Data_Descriptors The defaults for data edit descriptors follow: Field Descriptor List Element w d e -------------------------------------------------------------- I,B,O,Z,G BYTE,INTEGER*1,LOGICAL*1 7 I,B,O,Z,G INTEGER*2,LOGICAL*2 7 I,B,O,Z,G INTEGER*4,LOGICAL*4 12 I,B,O,Z,G INTEGER*8,LOGICAL*8 23 O,Z REAL*4 12 O,Z REAL*8 23 O,Z REAL*16 44 O,Z CHARACTER*n MAX(7,3*n) L,G LOGICAL*1,LOGICAL*2, 2 LOGICAL*4,LOGICAL*8 F,E,EN,ES,G,D REAL*4,COMPLEX*8 15 7 2 F,E,EN,ES,G,D REAL*8,COMPLEX*16 25 16 2 F,E,EN,ES,G,D REAL*16,COMPLEX*32 42 33 3 A,G LOGICAL*1 1 A,G LOGICAL*2,INTEGER*2 2 A,G LOGICAL*4,INTEGER*4 4 A,G LOGICAL*8,INTEGER*8 8 A,G REAL*4,COMPLEX*8 4 A,G REAL*8,COMPLEX*16 8 A,G REAL*16,COMPLEX*32 16 A,G CHARACTER*n n 3 General_Form The general form of a FORMAT statement follows: FORMAT (q1 f1s1 f2s2 ... fnsn qn) qn Is zero or more slash (/) record terminators. fn Is a data edit descriptor, a control edit descriptor, or a group of data or control edit descriptors enclosed in parentheses. sn Is a field separator (a comma or slash). A comma can be omitted in the following cases: o Between a P edit descriptor and an immediately following F, E, EN, ES, D, or G edit descriptor. o Before a slash (/) record terminator (if there is no optional repeat specification) o After a slash (/) record terminator. o Before or after a colon (:) edit descriptor. In data transfer I/O statements, a format specifier ([FMT=]format) can be a character expression that is a character array, character array element, or character constant. This type of format is also called a run-time format because it can be constructed or altered during program execution. The expression must evaluate to a character string whose leading part is a valid format specification (including the enclosing parentheses). Variable format expressions must not appear in this kind of format specification. 4 Data_Edit_Format A data edit descriptor takes one of the following forms: [r]c [r]cw [r]cw.m [r]cw.d [r]cw.d[Ee] r Is an optional repeat count. (If you omit "r", the repeat count is assumed to be 1.) c Is a format code (I,B,O,Z,F,E,EN,ES,D,G,L, or A). w Is the total number of digits in the field (the field width). m Is the minimum number of digits that must appear in the field (including leading zeros). d Is the number of digits to the right of the decimal point. E Identifies an exponent field. e Is the number of digits in the exponent. The ranges for "r", "w", "m", "d", and "e" are as follows: Term Range ---- __________ r 1 to 2147483647 (2**31-1) w 1 to 2147483647 m 0 to 32767 (2**15-1) d 0 to 32767 e 1 to 32767 The terms must all be positive, unsigned, integer constants or variable format expressions. You cannot use PARAMETER constants for "r", "w", "m", "d", or "e". 4 Control_Edit_Format A control edit descriptor takes one of the following forms: c nc cn c Is a format code (X, T, TL, TR, SP, SS, S, BN, BZ, P, /, '...', "...", Q, \, $, or :). n Is an optional number of character positions. The term "n" must be a positive, unsigned, integer constant or a variable format expression. For all format codes (except P), the value of "n" must be within the range 1 through 2147483647 (2**31-1); actual useful ranges may be constrained by record sizes (RECL) and the file system. The P edit descriptor is an exception to the general control edit descriptor syntax. It is preceded by a scale factor, rather than a character position specifier. The value of "n" for P must be within the range -128 to 127. Control edit descriptors can be grouped in parentheses and preceded by a group repeat specification. 4 Character_String_Format The character string edit descriptors are the character constant and H edit descriptor. The character constant edit descriptor ('string' or "string") causes string to be output to an external record. (For more information on the H edit descriptor, see FORMAT H in online Help.) Although no string edit descriptor can be preceded by a repeat specification, a parenthesized group of string edit descriptors can be preceded by a repeat specification. 3 Format_Descriptors A format descriptor can be one of the following: o Data edit descriptor Causes the transfer or conversion of data to or from its internal representation. The part of a record that is input or output and formatted with data edit descriptors a field. The data edit descriptors are: I, B, O, Z, F, E, EN, ES, D, G, L, and A. o Control edit descriptor Either directly determines how text is displayed or affects the conversions performed by subsequent data edit descriptors. The control edit descriptors are: T, TL, TR, X, S, SP, SS, BN, BZ, P, :, /, $, and Q. o String edit descriptor Controls the output of character strings. The string edit descriptors are the character constant and H edit descriptor. Format descriptors are generally separated by commas, but you can also use the slash (/) edit descriptor to separate them. A slash terminates input or output of the current record and initiates a new record; for example: WRITE (6,40) K,L,M,N,O,P 40 FORMAT (3I6.6/I6,2F8.4) The preceding statements are equivalent to the following: WRITE (6,40) K,L,M 40 FORMAT (3I6.6) WRITE (6,50) N,O,P 50 FORMAT (I6,2F8.4) Multiple slashes cause the system to bypass input records or output blank records. If "n" consecutive slashes appear between two field or edit descriptors, (n-1) records are skipped on input, or (n-1) blank records are output. The first slash terminates the current record. The second slash terminates the first skipped or blank record, and so on. However, "n" slashes at the beginning or end of a format specification result in "n" skipped or blank records. This is because the opening and closing parentheses of the format specification are themselves a record initiator and terminator, respectively. 3 Nested_and_Group_Repeats Format specifications can include nested format specifications enclosed in parentheses; for example: 15 FORMAT (E7.2,I8,I2,(A5,I6)) 35 FORMAT (A6,(L8(3I2)),A) A group repeat specification can precede a nested group of edit descriptors. For example, the following statements are equivalent, and the second statement shows a group repeat specification: 50 FORMAT (I8,I8,F8.3,E15.7,F8.3,E15.7,F8.3,E15.7,I5,I5) 50 FORMAT (2I8,3(F8.3,E15.7),2I5) If a nested group does not show a repeat count, a default count of 1 is assumed. Normally, the string edit descriptors and control edit descriptors cannot be repeated (except for slash), but any of these descriptors can be enclosed in parentheses and preceded by a group repeat specification. For example, the following statements are valid: 76 FORMAT ('MONTHLY',3('TOTAL')) 100 FORMAT (I8,4(T7),A4) 3 Reversion When the last closing parenthesis of the format specification is reached, format control determines whether more I/O list elements are to be processed. If not, format control terminates. However, if additional list elements remain, part or all of the format specification is reused in a process called format reversion. In format reversion, the current record is terminated, a new one is initiated, and format control reverts to the group repeat specification whose opening parenthesis matches the next-to-last closing parenthesis of the format specification. If the format does not contain a group repeat specification, format control returns to the initial opening parenthesis of the format specification. Format control continues from that point. 3 Variable_Format_Expressions By enclosing an expression in angle brackets, you can use it in a FORMAT statement wherever you can use an integer (except as the specification of the number of characters in the H field). For example: 20 FORMAT (I) When the format is scanned, the preceding statement performs an I (integer) data transfer with a field width of J+1. The expression is reevaluated each time it is encountered in the normal format scan. The following rules apply to variable format expressions: - If the expression is not of integer data type, it is converted to integer data type before being used. - The expression can be any valid Fortran expression, including function calls and references to dummy arguments. - The value of a variable format expression must obey the restrictions on magnitude applying to its use in the format, or an error occurs. - Variable format expressions are not permitted in run-time formats. Variable format expressions can also be used in character format specifications. Variable format expressions are evaluated each time they are encountered in the scan of the format. If the value of the variable used in the expression changes during the execution of the I/O statement, the new value is used the next time the format item containing the expression is processed. 3 Data_Edit The specific forms for data edit descriptors follow: +-----------------------------------+ | Function | Format | +--------------------+--------------+ | Integer | Iw[.m] | | Binary | Bw[.m] | | Octal | Ow[.m] | | Hexadecimal | Zw[.m] | | Real number | Fw.d | | Exponential form | Ew.d[Ee] | | D exponential form | Dw.d | | G exponential form | Gw.d[Ee] | | Scientific form | ESw.d[Ee] | | Engineering form | ENw.d[Ee] | | Logical | Lw | | Character | A[w] | +--------------------+--------------+ NOTE: Transfer complex numbers as two real (F, E, ES, EN, D, or G) numbers. 3 Control_Edit The specific forms for control edit descriptors follow: +--------------------------+--------------+ | Function | Format | +--------------------------+--------------+ | Scale factor | kP | | Blanks are null (input) | BN | | Blanks are zero (input) | BZ | | Characters in input | Q | | Plus sign (always) | SP | | Plus sign (never) | SS | | Default plus sign | S | | Skip spaces (same as TRn)| nX | | Position (Tab) | Tn | | Relative left tab | TLn | | Relative right tab | TRn | | Carriage control | $ or \ | | Terminate list | : | | Terminate record | / | +--------------------------+--------------+ 3 String_Edit The specific forms for string edit descriptors follow: +--------------------------+--------------+ | Function | Format | +--------------------------+--------------+ | Character constant | 'string' | | | or | | | "string" | | Hollerith | nHstring | +--------------------------+--------------+ 3 Carriage_Control When the first character of a formatted record is transferred to an output file or printer, it can be interpreted as a carriage control character (and not printed) if the file is opened with CARRIAGECONTROL='FORTRAN' in effect. The I/O system recognizes the characters listed below as carriage control characters and does not print them. Character Meaning --------- ----------------------------------------- '+' Overprinting: Outputs the record (at the current position in the current line) and a carriage return. ' ' One line feed: Outputs the record (at the beginning of the following line) and a carriage return. '0' Two line feeds: Outputs the record (after skipping a line) and a carriage return. '1' Next page: Outputs the record (at the beginning of a new page) and a carriage return. '$' Prompting: Outputs the record (at the beginning of the following line), but no carriage return. ASCII NULL Overprinting with no advance: Outputs the record (at the current position in the current line), but no carriage return. (ASCII NULL is specified as CHAR(0).) Any other character is interpreted as a blank and is deleted from the print line. If you accidentally omit a carriage control character, the first character of the record is not printed. 3 $_or_\ In a format specification, the dollar sign ($) and backslash (\) characters modify the carriage control specified by the first character of the record. They only affect carriage control for formatted files, and have no effect on input. If the first character of the record is a blank or a plus sign (+) the dollar sign and backslash descriptors suppress carriage return (after printing the record). For terminal device I/O, when this trailing carriage return is suppressed, a response follows output on the same line. If the first character of the record is 0, 1, or ASCII NUL, the dollar sign and backslash descriptors have no effect. 3 : Terminates format control if no more items are in the I/O list. If I/O list items remain, the colon edit descriptor has no effect. 3 A A[w] (Character Editing) If the corresponding I/O list element has a character data type, character data is transmitted. If it has any other data type, Hollerith data is transmitted. The value of "w" must be less than or equal to 2**31-1. The G edit descriptor can be used to edit character data; it follows the same rules as Aw. On input, the A edit descriptor transfers "w" characters or Hollerith values from the external record and assigns them to the corresponding list element. If the input value contains fewer characters than "w", it is padded on the right with blanks. If the input value contains excessive characters, it is truncated on the left. If the variable is numeric, the ASCII value of each character is placed in each byte of the variable, starting at the low-order byte. On output, the A edit descriptor transfers the contents of the corresponding I/O list element to an external field "w" characters long. If the output value contains fewer characters than "w", it is padded on the left with blanks. If the output value contains excess characters, it is truncated on the right (for numbers, the high-order bytes are lost). If the output value is numeric or untyped, the ASCII value of each byte of the variable, starting at the low-order byte, is transferred to the record. The "w" can be omitted and defaults to the number of characters in the character variable or the number of bytes in the numeric variable. 3 BN (Blank Control Editing) Causes embedded and trailing blanks to be ignored within a numeric input field. Leading blanks are always ignored, and an all blank field is always treated as zero. It affects all subsequent I, B, O, Z, F, E, EN, ES, D, and G editing (in the same FORMAT statement) until another blank editing descriptor occurs. The BN and BZ descriptors supersede the default interpretation of blanks during execution of a particular input data transfer statement. 3 BZ (Blank Control Editing) Causes embedded and trailing blanks to be treated as zeros within a numeric input field. (Leading blanks are always ignored.) An all-blank field is treated as zero. It affects all subsequent I, B, O, Z, F, E, EN, ES, D, and G editing (in the same FORMAT statement) until another blank editing descriptor occurs. The BN and BZ descriptors supersede the default interpretation of blanks during execution of a particular input data transfer statement. 3 D Dw.d (Exponential Editing) On input, D performs the same as F format. On output, D performs the same as E format, except that the letter D replaces the letter E preceding the exponent and the size of the exponent is fixed at 2. 3 E Ew.d[Ee] (Exponential Editing) On input, E performs the same as F format. On output, E transfers the value of the corresponding I/O list element, rounded to "d" decimal digits and right-justified to an external field "w" characters long. "d" specifies the size of the fraction and "e" specifies the size of the exponent. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. The term "w" must be large enough to include all of the following: a minus sign (when necessary) or a plus sign (if SP editing is in effect), a zero, a decimal point, "d" digits, and an exponent. Therefore, to accommodate all possible components of the standard form, the term "w" must be greater than or equal to "d"+7; if "e" is present, "w" must be greater than or equal to "d"+"e"+5. However, "w" can be as small as "d"+5 or "d"+"e"+3 and still allow formatting of the value without error, if optional fields are omitted. In this case, the sign is omitted (if the value is positive and SP editing is not in effect) and the zero to the left of the decimal point is also omitted, if necessary. 3 EN ENw.d[Ee] (Exponential Editing: Engineering form) On input, EN performs the same as F format. On output, EN transfers the value of the corresponding I/O list element, rounded to "d" decimal digits and right-justified to an external field "w" characters long. The real value is output in engineering notation, where the decimal exponent is divisible by 3 and the absolute value of the significand is greater than or equal to 1 and less than 1000 (unless the output value is zero). "d" specifies the size of the fraction and "e" specifies the size of the exponent. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. The term "w" must be large enough to include all of the following: a minus sign (when necessary) or a plus sign (if SP editing is in effect), one to three digits, zero, a decimal point, "d" digits, and an exponent. Therefore, to accommodate all possible components of the standard form, the term "w" must be greater than or equal to "d"+9. The exponent field width ("e") is optional; if omitted, the default is value is 2. If "e" is specified, the "w" should be greater than or equal to "d"+"e"+5. 3 ES ESw.d[Ee] (Exponential Editing: Scientific form) On input, ES performs the same as F format. On output, E transfers the value of the corresponding I/O list element, rounded to "d" decimal digits and right-justified to an external field "w" characters long. The real value is output in scientific notation, where the absolute value of the significand is greater than or equal to 1 and less than 10 (unless the output value is zero). "d" specifies the size of the fraction and "e" specifies the size of the exponent. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. The term "w" must be large enough to include all of the following: a minus sign (when necessary) or a plus sign (if SP editing is in effect), one digit, a decimal point, "d" digits, and an exponent. Therefore, to accommodate all possible components of the standard form, the term "w" must be greater than or equal to "d"+7; if "e" is present, "w" must be greater than or equal to "d"+"e"+5. The exponent field width ("e") is optional; if omitted, the default is value is 2. If "e" is specified, the "w" should be greater than or equal to "d"+"e"+5. 3 F Fw.d (Fixed Floating Editing) On input, F transfers "w" characters from the external field and assigns them, as a real value, to the corresponding I/O list element (which must be real data type). If the first nonblank character of the external field is a minus sign, the field is treated as a negative value. If the first nonblank character is a plus sign or if no sign appears in the field, the field is treated as a positive value. If the field contains neither a decimal point nor an exponent, it is treated as a real number of "w" digits, in which the rightmost "d" digits are to the right of the decimal point, with leading zeros assumed if necessary. If the field contains an explicit decimal point, the location of the decimal point overrides the location specified by the field descriptor. If the field contains an exponent, that exponent is used to establish the magnitude of the value before it is assigned to the list element. On output, F transfers the value of the corresponding I/O list element, rounded to "d" decimal positions and right-justified, to an external field that is "w" characters long. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. The term "w" must be large enough to include all of the following: a minus sign (when necessary) or a plus sign (if SP editing is in effect), at least one digit to the left of the decimal point, a decimal point, and "d" digits to the right of the decimal. Therefore, "w" must be greater than or equal to "d"+3. 3 G Gw.d[Ee] (General Floating Editing) On input, G performs the same as F format. On output, G transfers the value of the corresponding I/O list element, rounded to "d" decimal positions, and right-justified, to an external field that is "w" characters long. The form in which the value is written is a function of the magnitude of the value, as given below: Data Magnitude Equivalent Conversion -------------- -------------------- 0 < m < 0.1 - 0.5x10**-d-1 Ew.d[Ee] m = 0 F(w-n).(d-1),n('b') 0.1 - 0.5x10**-d-1 <= m < 1 - 0.5x10**-d F(w-n).d, n('b') 1 - 0.5x10**-d <= m < 10 - 0.5x10**-d+1 F(w-n).(d-1), n('b') 10 - 0.5x10**-d+1 <= n < 100 - 0.5x10**-d+2 F(w-n).(d-2), n('b') . . . . . . 10**d-2 - 0.5x10**-2 <= m < 10**d-1 - 0.5x10**-1 F(w-n).1, n('b') 10**d-1 - 0.5x10**-1 <= m < 10**d - 0.5 F(w-n).0, n('b') m >= 10**d - 0.5 Ew.d[Ee] The 'b' is a blank following the numeric data representation. For Gw.d, n('b') is 4 blanks. For Gw.dEe, n('b') is "e"+2 blanks. The term "w" must be greater than or equal to d+7 to allow for the following: a sign (optional if the value is positive and descriptor SP is not in effect), one digit to the left of the decimal point, a decimal point, "d" digits to the right of the decimal point, and either a 4-digit or an "e"+2-digit exponent. If "e" is specified, "w" must be greater than or equal to "d"+"e"+5. 3 H nHc1c2c2...cn (Hollerith Editing) On input, transfers "n" characters from the external record to the field descriptor itself. The first character appears immediately after the H. Any characters in the field descriptor prior to the input operation are replaced by the input characters. On output, transfers "n" characters following the letter H from the field descriptor to the external field. NOTE This feature has been deleted in Fortran 95; it was an obsolescent feature in Fortran 90. HP Fortran fully supports features deleted in Fortran 95. 3 I Iw[.m] (Integer Editing) On input, I transfers "w" characters from the external field and assigns them, as an integer value, to the corresponding I/O list element (which must be integer or logical data type). The external data must have the form of an integer constant; it cannot contain a decimal point or exponent field. If the first nonblank character of the external field is a minus sign, the field is treated as a negative value. If the first nonblank character is a plus sign or if no sign appears in the field, the field is treated as a positive value. On output, I transfers the value of the corresponding I/O list element, right-justified, to an external field that is "w" characters long. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. "w" must be large enough to include a possible minus sign. If "m" is present, the external field consists of at least "m" digits and, if necessary, is zero filled on the left. 3 L Lw (Logical Editing) On input, L transfers "w" characters from the external field and assigns a logical value to the corresponding I/O list element (which must be integer or logical data type). If the first nonblank characters of the field are T, t, .T, or .t, the value .TRUE. is assigned to the corresponding I/O list element; if the first nonblank characters are F, f, .F, or .f, the value .FALSE. is assigned. An all blank field is assigned the value .FALSE. Any other value in the external field produces an error. The logical constants .TRUE. and .FALSE. are acceptable input forms. On output, L transfers either the letter T (if the value of the corresponding I/O list element is .TRUE.) or the letter F (if the value is .FALSE.) to an external field that is "w" characters long. The letter T or F is in the rightmost position of the field, preceded by w-1 spaces. 3 O Ow[.m] (Octal Editing) On input, O transfers "w" characters from the external field and assigns them, as an octal value, to the corresponding I/O list element (which can be any data type). The external field can contain only the numerals 0 though 7; it cannot contain a sign, a decimal point, or exponent field. An all blank field is treated as a value of zero. If the value of the external field exceeds the range of the corresponding list element, an error occurs. On output, O transfers the octal value of the corresponding I/O list element, right-justified, to an external field that is "w" characters long. No signs are transmitted; a negative value is transmitted in internal form. If the value does not fill the field, leading spaces are inserted; if the value is too large for the field, the entire field is filled with asterisks. If "m" is present, the external field consists of at least "m" digits and, if necessary, is zero filled on the left. "w" must be large enough to include a possible minus sign. If "m" is present, the external field consists of at least "m" digits and, if necessary, is zero filled on the left. 3 P nP (Scale Factor Editing) The scale factor lets you alter, during input or output, the location of the decimal point both in real values and in the two parts of complex values. The "n" is a signed or unsigned integer constant, in the range -128 to 127, that specifies the number of positions to the left or right that the decimal point is to move. A scale factor can appear anywhere in a format specification, but must precede the first F, E, D, EN, ES, or G field descriptor that is to be associated with it and affects all subsequent real field descriptors in the same FORMAT statement (unless another scale factor appears). On input the scale factor of any of the F, E, D, EN, ES, and G field descriptors multiplies the data by 10**-n and assigns it to the corresponding I/O list element. For example a 2P scale factor multiplies an input value by .01; a -2P multiplies an input value by 100. However, if the external field contains an explicit exponent, the scale factor has no effect. E, D, EN, ES, and G field descriptors alter the form in which data is transferred. On input a positive scale factor moves the decimal point to the left and a negative scale factor moves the decimal point to the right; on output, the effect is the reverse. 4 F_editing nPFw.d On output, the value of the I/O list element is multiplied by 10**n before transfer to the external record. Thus, a positive scale factor moves the decimal point to the right; a negative scale factor moves the decimal point to the left. Thus, the F descriptor alters the magnitude of the data. 4 E_editing nPEw.d On output, the basic real constant part of the I/O list element is multiplied by 10**n, and "n" is subtracted from the exponent. For a positive scale factor, "n" must be less than d+2 or an output conversion error occurs. Thus, a positive scale factor moves the decimal point to the right and decreases the exponent; a negative scale factor moves the decimal point to the left and increases the exponent. 4 D_editing nPDw.d On output, the basic real constant part of the I/O list element is multiplied by 10**n, and "n" is subtracted from the exponent. For a positive scale factor, "n" must be less than d+2 or an output conversion error occurs. Thus, a positive scale factor moves the decimal point to the right and decreases the exponent; a negative scale factor moves the decimal point to the left and increases the exponent. 4 EN_editing On output, the scale factor has no effect on EN editing. 4 ES_editing On output, the scale factor has no effect on ES editing. 4 G_editing nPGw.d On output, the effect for the G field descriptor is suspended if the magnitude of the data to be output is within the effective range of the descriptor (because the G field descriptor supplies its own scaling function). It functions as an E field descriptor if the magnitude of the data is outside its range. In this case, the scale factor has the same effect as for the E field descriptor. 3 Q (Query Remaining Character Count) On input, Q obtains the number of characters remaining in the input record to be transferred during a read operation. The following example uses the Q descriptor to determine the size of the input record: READ(5,'(Q,A)') LEN, REC(1:LEN) On output, the Q descriptor has no effect, except that the corresponding I/O item is skipped. 3 S (Normal Signing) Restores the option of producing plus characters (+) in numeric output fields. The S descriptor counters the action of either the SP or SS descriptor by restoring to the processor the discretion of producing plus characters on an optional basis. This descriptor affects fields all that follow it, until an SP or SS is encountered. The S descriptor affects all subsequent I, F, E, D, and G editing (in the same FORMAT statement) during the execution of an output statement. 3 SP (Always + Signs) Causes the processor to produce a leading plus character (+) in any position where this character would otherwise be optional. This descriptor affects all (suppress + signs) fields that follow it, until an S or SS is encountered. The SP descriptor affects all subsequent I, F, E, D, and G editing (in the same FORMAT statement) during the execution of an output statement. 3 SS (Suppress Sign) Causes the processor to suppress a leading plus character from any position where this character would otherwise be optional. It has the opposite effect of the SP field descriptor. The SS descriptor affects all subsequent I, F, E, D, and G editing (in the same FORMAT statement) during the execution of an output statement. This descriptor affects all fields that follow it, until an S or SS is encountered. 3 Slash [r]/ Terminates data transfer for the current record and starts data transfer for a new record. The "r" is an optional repeat specification. Multiple slashes cause the system to skip input records or to output blank records, as follows: o When "n" consecutive slashes appear between two edit descriptors, "n"-1 records are skipped on input, or "n"-1 blank records are output. The first slash terminates the current record. The second slash terminates the first skipped or blank record, and so on. o When "n" consecutive slashes appear at the beginning or end of a format specification, "n" records are skipped or "n" blank records are output, because the opening and closing parentheses of the format specification are themselves a record initiator and terminator, respectively. 3 T Tn (Tab to Position n) On input, starts the next read operation at the character position (within the record) indicated by position n. For example, if an input statement reads a record containing: ABC XYZ and this record is under the control of the FORMAT statement: 10 FORMAT (T7,A3,T1,A3) On execution, the input statement would first read the characters XYZ and then read the characters ABC. On output, starts the next write operation at the character position n in the external record. The position specified must be an integer in the range 1 through the size of the record. 3 TL TLn (Tab Left n Positions) Indicates that the next character to be transferred to or from a record is the "n"th character to the left of the current character. The value of "n" must be greater than or equal to 1. If the value of "n" is greater than or equal to the current character position, the first character in the record is specified. 3 TR TRn (Tab Right n Positions) Indicates that the next character to be transferred to or from a record is the "n"th character to the right of the current character. The value of "n" must be greater than or equal to 1. 3 X nX (Skip Right n Positions) The X field descriptor functions the same as the TR field descriptor. On input, X starts the next read operation after skipping "n" character positions. If X is the last format item, it will have no effect. On output, X starts the next write operation after skipping the "n" character positions. Intervening characters are not written over. If X is the last format code executed, it will have no effect. The position specified must be in integer in the range 1 through the size of the record. 3 Z Zw[.m] (Hexadecimal Editing) On input, Z transfers "w" characters from the external field and assigns them, as a hexadecimal value, to the corresponding I/O list element (which can be any data type). The input value must be in the form of a hexadecimal constant. Each input character corresponds to four bits in the variable, high order to low order. If the input value contains more characters than specified by "w", an error occurs. If the input value contains fewer characters, it is padded with zeros on the left before being converted. On output, Z transfers the number of hexadecimal characters specified by "w" from a variable or constant to the record. The rightmost characters represent the low-order bits. If the variable or constant contains more characters than "w" specifies, the value is set to all asterisks (an error occurs). If the variable or constant contains fewer characters, the value is padded on the left with spaces. "m" specifies the minimum number of characters (with zero padding) that the value can contain. "m" must be an integer in the range 1 through 255. "w" must be large enough to include a possible minus sign. If "m" is present, the external field consists of at least "m" digits and, if necessary, is zero filled on the left. 2 Intrinsic_Procedures 3 ABS ABS (number) Class: Elemental function - Generic Returns the absolute value of the argument. The absolute value of a complex number, (X,Y), is the real value: (X**2 + Y**2)**(1/2). +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 1 | ABS | -- | INTEGER*1 | INTEGER*1 | | | | IIABS | INTEGER*2 | INTEGER*2 | | |see note1 | IABS | INTEGER*4 | INTEGER*4 | | | | KIABS | INTEGER*8 | INTEGER*8 | | | | ABS | REAL*4 | REAL*4 | | | | DABS | REAL*8 | REAL*8 | | | | QABS | REAL*16 | REAL*16 | | |see note2 | CABS | COMPLEX*8 | REAL*4 | | | | CDABS | COMPLEX*16 | REAL*8 | | | | ZABS | COMPLEX*16 | REAL*8 | | | | CQABS | COMPLEX*32 | REAL*16 | +------+----------+----------+------------+-------------+ Note1: Or JIABS. For compatibility with older versions of Fortran, IABS can also be specified as a generic function. Note2: The setting of compiler options specifying real size can affect CABS. 3 ACHAR ACHAR (integer-number) Class: Elemental function - Generic Returns the character in a specified position of the ASCII character set, even if the processor's default character set is different. It is the inverse of the IACHAR function. In HP Fortran, ACHAR is equivalent to the CHAR function. The result is of type character of length 1 with the kind type parameter value of KIND ('A'). If I has a value within the range 0 to 127, the result is the character in position I of the ASCII character set. 3 ACOS ACOS (real-number) Class: Elemental function - Generic Returns the arc cosine of the argument in radians. The absolute value of the argument must be less than or equal to 1. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ACOS | ACOS | REAL*4 | REAL*4 | | | | DACOS | REAL*8 | REAL*8 | | | | QACOS | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ACOSD ACOSD (real-number) Class: Elemental function - Generic Returns the arccosine of the argument in degrees. The value of the argument must be between 0 (exclusive) and 1 (inclusive). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ACOSD | ACOSD | REAL*4 | REAL*4 | | | | DACOSD | REAL*8 | REAL*8 | | | | QACOSD | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ADJUSTL ADJUSTL (string) Class: Elemental function - Generic Adjusts a character string to the left, removing leading blanks and inserting trailing blanks. The result is of type character with the same length and kind type parameter as "string". 3 ADJUSTR ADJUSTR (string) Class: Elemental function - Generic Adjusts a character string to the right, removing trailing blanks and inserting leading blanks. The result is of type character with the same length and kind type parameter as "string". 3 AIMAG AIMAG (complex-number) Class: Elemental function - Generic Returns the imaginary part of a complex number. If Z has the value (x, y), the result has the value "y". This function can also be specified as IMAG. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | AIMAG | AIMAG | COMPLEX*8 | REAL*4 | | | | DIMAG | COMPLEX*16 | REAL*8 | | | | QIMAG | COMPLEX*32 | REAL*16 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect AIMAG. 3 AINT AINT (real-number[,kind]) Class: Elemental function - Generic Returns the largest integer whose absolute value does not exceed the absolute value of the argument and has the same sign as the argument. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | AINT | AINT | REAL*4 | REAL*4 | | | | DINT | REAL*8 | REAL*8 | | | | QINT | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ALL ALL (mask [,dim]) Class: Transformational function - Generic Determines if all values are true in an entire array or in a specified dimension of an array. The "mask" must be a logical array. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "mask". The result is a logical array with the same kind type parameter as "mask". The result is scalar if "dim" is absent or "mask" has rank one. Otherwise, the result is an array with rank that is one less than "mask", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "mask". The result of ALL (mask) has the value true if all elements of "mask" are true or "mask" has size zero. The result has the value false if any element of "mask" is false. If "mask" has rank one, ALL (mask, dim) has the same value as ALL (mask). Otherwise, the value of element (s1, s2,..., s"dim"-1, s"dim"+1,..., sn) of ALL (mask, dim) is equal to ALL (mask (s1, s2,..., s"dim"-1, :, s"dim"+1, ..., sn). Examples: ALL ((/.TRUE., .FALSE., .TRUE./)) has the value false. ALL ((/.TRUE., .TRUE., .TRUE./)) has the value true. Consider the following arrays: Array A Array B |1 5 7| |0 5 7| |3 6 8| |2 6 9| ALL (A .NE. B, DIM=1) has the value (true, false, true). ALL (A .NE. B, DIM=2) has the value (true, true). 3 ALLOCATED ALLOCATED (array) Class: Inquiry function - Generic Indicates whether an allocatable array is currently allocated. The "array" must be an allocatable array. The result has the value true if ARRAY is currently allocated, false if ARRAY is not currently allocated, or undefined if its allocation status is undefined. The setting of integer size compiler options can affect this function. Example: REAL, ALLOCATABLE, DIMENSION (:,:,:) :: E PRINT *, ALLOCATED (E) ! Returns the value false ALLOCATE (E (12, 15, 20)) PRINT *, ALLOCATED (E) ! Returns the value true 3 AMAX0 See the MAX intrinsic function. 3 AMIN0 See the MIN intrinsic function. 3 ANINT ANINT (real-number [,kind]) Class: Elemental function - Generic Returns the value of the integer nearest to the value of the argument. If real number x is greater than zero, ANINT (x) has the value AINT (x + 0.5). If x is less than or equal to zero, ANINT (x) has the value AINT (x - 0.5). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ANINT | ANINT | REAL*4 | REAL*4 | | | | DNINT | REAL*8 | REAL*8 | | | | QNINT | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ See also the NINT intrinsic function. 3 ANY ANY (mask [,dim]) Class: Transformational function - Generic Determines if any value is true in an entire array or in a specified dimension of an array. The "mask" must be a logical array. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "mask". The result is a logical array with the same kind type parameter as "mask". The result is scalar if "dim" is absent or "mask" has rank one. Otherwise, the result is an array with rank that is one less than "mask", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "mask". The result of ANY (mask) has the value true if any elements of "mask" are true. The result has the value false if no element of "mask" is true or "mask" has size zero. If "mask" has rank one, ANY (mask, dim) has the same value as ANY (mask). Otherwise, the value of element (s1, s2,..., s"dim"-1, s"dim"+1,..., sn) of ANY (mask, dim) is equal to ANY (mask (s1, s2,..., s"dim"-1, :, s"dim"+1, ..., sn). Examples: ANY ((/.FALSE., .FALSE., .TRUE./)) has the value true. Consider the following arrays: Array A Array B |1 5 7| |0 5 7| |3 6 8| |2 6 9| ANY (A .NE. B, DIM=1) has the value (true, false, true). ANY (A .NE. B, DIM=2) has the value (true, true). 3 ASIN ASIN (real-number) Class: Elemental function - Generic Returns the arcsine of the argument in radians. The absolute value of the argument must be less than or equal to 1. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ASIN | ASIN | REAL*4 | REAL*4 | | | | DASIN | REAL*8 | REAL*8 | | | | QASIN | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ASIND ASIND (real-number) Class: Elemental function - Generic Returns the arc sine of the argument in degrees. The value of the argument must be between 0 (exclusive) and 1 (inclusive). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ASIND | ASIND | REAL*4 | REAL*4 | | | | DASIND | REAL*8 | REAL*8 | | | | QASIND | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ASM (Alpha only) ASM (character [, any-type-arg]) Class: Nonelemental function - Generic Lets you use assembler instructions in an executable program. The first argument is a character constant or a concatenation of character constants containing the assembler instructions. The optional second argument can be of any type. It can be a source or destination argument for the instruction, for example. Arguments are passed by value. If you want to pass an argument by reference (for example, a whole array, a character string, or a record structure), you can use the %REF built-in function. Labels are allowed, but all references must be from within the same ASM function. This lets you set up looping constructs, for example. Cross-jumping between ASM functions is not permitted. In general, an ASM function can appear anywhere that an intrinsic function can be used. Since the supplied assembly code, assembly directives, or assembly data is integrated into the code stream, the compiler may choose to use different registers, better code sequences, and so on, just as if the code were written in Fortran. You do not have absolute control over instruction sequences and registers, and the compiler may intersperse other code together with the ASM code for better performance. Better code sequences may be substituted by the optimizer if it chooses to do so. Only register names beginning with a dollar sign ($) or percent sign (%) are permitted. For more information on register name conventions, see the OpenVMS operating system documentation set. +---------+-------------------+-------------+ | Generic | Specific | Result Type | +---------+-------------------+-------------+ | ASM | ASM (see Note1) | INTEGER*8 | | | FASM (see Note2) | REAL*4 | | | DASM (see Note2) | REAL*8 | +---------+-------------------+-------------+ Note1: The value must be stored in register $0 by the user code. Note2: The value must be stored in register $F0 by the user code. Example: Consider the following: ! Concatenation is recommended for clarity. ! Notice that ";" separates instructions. ! nine=9 type *, asm('addq %0, $17, $0;'// ! Adds the first two arguments 1 'ldq $22, %6;'// ! and puts the answer in 1 'ldq $23, %7;'// ! register $0 1 'ldq $24, %8;'// ! 1 'mov $0, %fp;'// ! Comments are not allowed in the 1 'addq $18, %fp, $0;'// ! constant, but are allowed here 1 'addq $19, $0, $0;'// 1 'addq $20, $0, $0;'// 1 'addq $21, $0, $0;'// 1 'addq $22, $0, $0;'// 1 'addq $23, $0, $0;'// 1 'addq $24, $0, $0;', 1 1,2,3,4,5,6,7,8,nine) ! The actual arguments to the ! ASM (usually by value) end This example shows an integer ASM function that adds up 9 values and returns the sum as its result. Note that the user stores the function result in register $0. All arguments are passed by value. The arguments not passed in registers can be named %6, %7, and %8, which correspond to the actual arguments 7, 8, and 9 (since %0 is the first argument). Notice that you can reference reserved registers like %fp. The compiler creates the appropriate argument list. So, in this example, the first argument value (1) will be available in register $16, and the eighth argument value (8) will be available in %7, which is actually 8($30). 3 ASSOCIATED ASSOCIATED (pointer [,target]) Class: Inquiry function - Generic Returns the association status of its pointer argument or indicates whether the pointer is associated with the target. The pointer must not have an undefined association status. The "target" can be a pointer or target. If only POINTER appears, the result is true if it is currently associated with a target; otherwise, the result is false. If TARGET also appears and is a target, the result is true if POINTER is currently associated with TARGET; otherwise, the result is false. If TARGET is a pointer, the result is true if both POINTER and TARGET are currently associated with the same target; otherwise, the result is false. (If either POINTER or TARGET is disassociated, the result is false.) The setting of integer size compiler options can affect this function. Examples: Consider the following: REAL, TARGET, DIMENSION (0:50) :: TAR REAL, POINTER, DIMENSION (:) :: PTR PTR => TAR PRINT *, ASSOCIATED (PTR, TAR) ! Returns the value true The subscript range for PTR is 0:50. Consider the following pointer assignment statements: (1) PTR => TAR (:) (2) PTR => TAR (0:50) (3) PTR => TAR (0:49) For statements 1 and 2, ASSOCIATED (PTR, TAR) is true because TAR has not changed (the subscript range for PTR in both cases is 1:51, following the rules for deferred-shape arrays). For statement 3, ASSOCIATED (PTR, TAR) is false because the upper bound of PTR has changed. Consider the following: REAL, POINTER, DIMENSION (:) :: PTR2, PTR3 ALLOCATE (PTR2 (0:15)) PTR3 => PTR2 PRINT *, ASSOCIATED (PTR2, PTR3) ! Returns the value true ... NULLIFY (PTR2) NULLIFY (PTR3) PRINT *, ASSOCIATED (PTR2, PTR3) ! Returns the value false 3 ATAN ATAN (real-number) Class: Elemental function - Generic Returns the arc tangent of the argument in radians. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ATAN | ATAN | REAL*4 | REAL*4 | | | | DATAN | REAL*8 | REAL*8 | | | | QATAN | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ATAND ATAND (real-number) Class: Elemental function - Generic Returns the arc tangent of the argument in degrees. The value of the argument must be greater than 0. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ATAND | ATAND | REAL*4 | REAL*4 | | | | DATAND | REAL*8 | REAL*8 | | | | QATAND | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ATAN2 ATAN2 (real-number, real-number) Class: Elemental function - Generic Returns the arc tangent of the quotient of the two arguments in radians. If both arguments are zero, the result is undefined. If the first argument is positive, the result is positive. If the first argument is negative, the result is negative. If the first argument is zero, the result is zero. If the second argument is zero, the absolute value of the result is pi/2. The range of the result is -pi < result <= pi. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | ATAN2 | ATAN2 | REAL*4 | REAL*4 | | | | DATAN2 | REAL*8 | REAL*8 | | | | QATAN2 | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 ATAN2D ATAN2D (real-number, real-number) Class: Elemental function - Generic Returns the arc tangent of the quotient of the two arguments in degrees. If both arguments are zero, the result is undefined. If the first argument is positive, the result is positive. If the first argument is negative, the result is negative. If the first argument is zero, the result is zero. If the second argument is zero, the absolute value of the result is 90 degrees. The value of the argument must be greater than zero. The range of the result is -180 degrees < result <= 180 degrees. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | ATAN2D | ATAN2D | REAL*4 | REAL*4 | | | | DATAN2D | REAL*8 | REAL*8 | | | | QATAN2D | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 BIT_SIZE BIT_SIZE (integer) Class: Inquiry function - Generic Returns the number of bits in an integer type. The result value is the number of bits ("s") defined by the bit model for integers with the kind type parameter of the argument. For information on the bit model, see the HP Fortran for OpenVMS Language Reference Manual. Example: BIT_SIZE (1_2) has the value 16 because the INTEGER*2 type contains 16 bits. 3 BTEST BTEST (integer, position) Class: Elemental function - Generic Returns a logical value of true if the bit within the integer specified by position is set to 1 (bit test). The low-order bit is position 0. +------+---------+----------------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------------+------------+-------------+ | 2 | | -- | INTEGER*1 | LOGICAL*4 | | | | BITEST | INTEGER*2 | LOGICAL*2 | | | BTEST | BTEST(see note)| INTEGER*4 | LOGICAL*4 | | | | BKTEST | INTEGER*8 | LOGICAL*8 | +------+---------+----------------+------------+-------------+ NOTE: Or BJTEST 3 CEILING CEILING (real-number [,KIND]) Class: Elemental function - Generic Returns the smallest integer greater than or equal to its argument. The result is of type default integer (unless KIND specifies a different integer KIND). The value of the result is equal to the smallest integer greater than or equal to the real-number. The result is undefined if the value cannot be represented in the default integer range. 3 CHAR CHAR (integer [,kind]) Class: Elemental function - Generic Returns the character in the specified position of the processor's character set. It is the inverse of the function ICHAR. The input value must be in the range 0 to n - 1, where "n" is the number of characters in the processor's character set. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | -- | -- | INTEGER*1 | CHARACTER | | | | -- | INTEGER*2 | CHARACTER | | | | CHAR | INTEGER*4 | CHARACTER | | | | -- | INTEGER*8 | CHARACTER | +------+---------+----------+------------+-------------+ This function cannot be passed as an actual argument. 3 CMPLX CMPLX (number [,number] [,kind]) Class: Elemental function - Generic Converts the argument(s) into a complex value. If one argument is specified, the argument is converted into the real part of the complex value and the imaginary part becomes zero. If two arguments are specified, the first argument is converted into the real part of the complex value and the second argument is converted into the imaginary part of the complex value. If two arguments are specified, they must have the same data type. The setting of compiler options specifying real size can affect this function. +-------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +-------+---------+----------+------------+-------------+ | 1,2 | CMPLX | CMPLX | INTEGER*2 | COMPLEX*8 | | 1,2 | | CMPLX | INTEGER*4 | COMPLEX*8 | | 1,2 | | CMPLX | REAL*4 | COMPLEX*8 | | 1,2 | | CMPLX | REAL*8 | COMPLEX*8 | | 1,2 | | CMPLX | REAL*16 | COMPLEX*8 | | 1 | | CMPLX | COMPLEX*8 | COMPLEX*8 | | 1 | | CMPLX | COMPLEX*16 | COMPLEX*8 | +-------+---------+----------+------------+-------------+ This function cannot be passed as an actual argument. 3 CONJG CONJG (complex-number) Class: Elemental function - Generic Returns the complex conjugate of the argument. If the argument is (X,Y), its complex conjugate is (X,-Y). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | CONJG | CONJG | COMPLEX*8 | COMPLEX*8 | | | | DCONJG | COMPLEX*16 | COMPLEX*16 | | | | QCONJG | COMPLEX*32 | COMPLEX*32 | +------+---------+----------+------------+-------------+ 3 COS COS (number) Class: Elemental function - Generic Returns the cosine of the argument. The argument must be in radians; it is treated modulo 2*pi. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | COS | COS | REAL*4 | REAL*4 | | | | DCOS | REAL*8 | REAL*8 | | | | QCOS | REAL*16 | REAL*16 | | |see note | CCOS | COMPLEX*8 | COMPLEX*8 | | | | CDCOS | COMPLEX*16 | COMPLEX*16 | | | | ZCOS | COMPLEX*16 | COMPLEX*16 | | | | CQCOS | COMPLEX*32 | COMPLEX*32 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect CCOS. 3 COSD COSD (number) Class: Elemental function - Generic Returns the cosine of the argument. The argument must be in degrees; it is treated modulo 360. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | COSD | COSD | REAL*4 | REAL*4 | | | | DCOSD | REAL*8 | REAL*8 | | | | QCOSD | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 COSH COSH (real-number) Class: Elemental function - Generic Returns the hyperbolic cosine of the argument. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | COSH | COSH | REAL*4 | REAL*4 | | | | DCOSH | REAL*8 | REAL*8 | | | | QCOSH | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 COTAN COTAN (real-number) Class: Elemental function - Generic Returns the cotangent of the argument. The argument cannot be zero. It must be in radians and is treated as modulo 2*pi. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | COTAN | COTAN | REAL*4 | REAL*4 | | | | DCOTAN | REAL*8 | REAL*8 | | | | QCOTAN | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 COTAND COTAND (real-number) Class: Elemental function - Generic Returns the cotangent of the argument. The argument must be in degrees; it is treated modulo 360. +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 1 | COTAND | COTAND | REAL*4 | REAL*4 | | | | DCOTAND | REAL*8 | REAL*8 | | | | QCOTAND | REAL*16 | REAL*16 | +------+----------+----------+------------+-------------+ 3 COUNT COUNT (mask [,dim] [,kind]) Class: Transformational function - Generic Counts the number of true elements in an entire array or in a specified dimension of an array. The "mask" must be a logical array. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "mask". The "kind" must be a scalar integer initialization expression. The result is integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The result is a scalar if "dim" is absent or "mask" has rank one. Otherwise, the result is an array with rank that is one less than "mask", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "mask". The result of COUNT (mask) is a value equal to the number of true elements of "mask". If mask has size zero, the result is zero. If "mask" has rank one, COUNT (mask, dim) has the same value as COUNT (mask). Otherwise, the value of element (s1, s2,..., s"dim"-1, s"dim"+1,..., sn) of COUNT (mask, dim) is equal to COUNT (mask (s1, s2,..., s"dim"-1, :, s"dim"+1, ...,sn). Examples: COUNT ((/.TRUE., .FALSE., .TRUE./)) has the value 2. COUNT ((/.TRUE., .TRUE., .TRUE./)) has the value 3. Consider the following arrays: Array A Array B |1 5 7| |0 5 7| |3 6 8| |2 6 9| COUNT (A .NE. B, DIM=1) has the value (2, 0, 1). COUNT (A .NE. B, DIM=2) has the value (1, 2). 3 CPU_TIME CPU_TIME (time) Class: Subroutine Returns a processor-dependent approximation of the processor time (in seconds). Argument "time" must be scalar and of real type. It is an INTENT(OUT) argument. If a meaningful time cannot be returned, a processor-dependent negative value is returned. Example: REAL time_begin, time_end ... CALL CPU_TIME(time_begin) ... !some operation coding CALL CPU_TIME(time_end) PRINT (*,*) 'Time of operation was ', time_begin - time_end, ' seconds' 3 CSHIFT CSHIFT (array, shift [,dim]) Class: Transformational function - Generic Performs a circular shift on a rank-one array, or performs circular shifts on all the complete rank-one sections along a given dimension of an array of rank two or greater. Elements shifted off one end are inserted at the other end. Different sections can be shifted by different amounts and in different directions. The "shift" can be a scalar integer or array with rank one less than "array". The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". If "dim" is omitted, it is assumed to be 1. The result is an array with the same type, type parameters, and shape as "array". If "array" has rank one, element i of the result is array (1 + MODULO (i + "shift" - 1, SIZE (array))). If "array" has rank greater than 1, section (s1, s2, ...s"dim"-1, :, s"dim"+1, ..., sn) of the result has a value equal to CSHIFT (array(s1, s2, ..., s"dim"-1, :, s"dim"+1, ..., sn), sh, 1), where "sh" is "shift" or shift(s1, s2, ..., s"dim"-1, s"dim"+1,..., sn). The value of "shift" determines the amount and direction of the circular shift. A positive integer causes a shift to the left (in rows) or up (in columns). A negative integer causes a shift to the right (in rows) or down (in columns). Examples: V is the array (1, 2, 3, 4, 5, 6). CSHIFT (V, SHIFT=2) shifts V circularly to the left by 2 positions, producing the value (3, 4, 5, 6, 1, 2). CSHIFT (V, SHIFT= -2) shifts V circularly to the right by 2 positions, producing the value (5, 6, 1, 2, 3, 4). M is the array Consider the following array: Array M |1 2 3| |4 5 6| |7 8 9| CSHIFT (M, SHIFT = 1, DIM = 2) produces the result: |2 3 1| |5 6 4| |8 9 7| CSHIFT (M, SHIFT = -1, DIM = 1) produces the result |7 8 9| |1 2 3| |4 5 6| CSHIFT (M, SHIFT = (/1, -1, 0/), DIM = 2) produces the result |2 3 1| |6 4 5| |7 8 9| 3 DATE DATE (buf) Class: Subroutine Returns the current date as set within the system. The date is returned as a 9-byte ASCII character string as follows: dd-mmm-yy The "buf" is a 9-byte variable, array, array element, or character substring. If "buf" is numeric type and smaller than 9 bytes, data corruption can occur. If "buf" is character type, its associated length is passed to the subroutine. If "buf" is smaller than 9 bytes, the subroutine truncates the date to fit in the specified length. If a CHARACTER array is passed, the subroutine stores the date in the first array element, using the element length, not the length of the entire array. For example, consider the following: CHARACTER*1 DAY(9) ... CALL DATE(DAY) The length of the first array element in CHARACTER array DAY is passed to the DATE subroutine. The subroutine then truncates the date to fit into the one-character element, producing an incorrect result. 3 DATE_AND_TIME DATE_AND_TIME ([date] [,time] [,zone] [,values]) Class: Subroutine Returns character data on the real-time clock and date in a form compatible with the representations defined in Standard ISO 8601:1988. Optional arguments (all are INTENT(OUT)): o The "date" must be scalar and of type default character; its length must be at least 8 to contain the complete value. Its leftmost 8 characters are set to a value of the form CCYYMMDD, where: CC is the century YY is the year within the century MM is the month within the year DD is the day within the month o The "time" must be scalar and of type default character; its length must be at least 10 to contain the complete value. Its leftmost 10 characters are set to a value of the form hhmmss.sss, where: hh is the hour of the day mm is the minutes of the hour ss.sss is the seconds and milliseconds of the minute o The "zone" must be scalar and of type default character; its length must be at least 5 to contain the complete value. Its leftmost 5 characters are set to a value of the form + or - hhmm, where "hh" and "mm" are the time difference with respect to Coordinated Universal Time (UTC) in hours and parts of an hour expressed in minutes, respectively. o The "values" must be of type default integer and of rank one. Its size must be at least 8. The values returned in "values" are as follows: values (1) is the 4-digit year values (2) is the month of the year values (3) is the day of the month values (4) is the time difference with respect to Coordinated Universal Time (UTC) in minutes values (5) is the hour of the day (range 0 to 23) values (6) is the minutes of the hour (range 0 to 59). values (7) is the seconds of the minute (range 0 to 59). values (8) is the milliseconds of the second (range 0 to 999). VALUES (5) through (8) are in local time. Example: Consider the following example executed on 2000 March 28 at 11:04:14.5: INTEGER DATE_TIME (8) CHARACTER (LEN = 12) REAL_CLOCK (3) CALL DATE_AND_TIME (REAL_CLOCK (1), REAL_CLOCK (2), & REAL_CLOCK (3), DATE_TIME) This assigns the value "20000328" to REALCLOCK (1), the value "110414.500" to REALCLOCK (2), and the value "-0500" to REALCLOCK (3). The following values are assigned to DATETIME: 2000, 3, 28, -300, 11, 4, 14, and 500. 3 DBLE DBLE (number) Class: Elemental function - Generic Converts a number into a REAL*8 value. +------+-----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+-----------+----------+------------+-------------+ | 1 | DBLE | -- | INTEGER*1 | REAL*8 | | | | -- | INTEGER*2 | REAL*8 | | | | -- | INTEGER*4 | REAL*8 | | | | -- | INTEGER*8 | REAL*8 | | | | DBLE | REAL*4 | REAL*8 | | | | -- | REAL*8 | REAL*8 | | | | DBLEQ | REAL*16 | REAL*8 | | | | -- | COMPLEX*8 | REAL*8 | | | | -- | COMPLEX*16 | REAL*8 | | | | -- | COMPLEX*32 | REAL*8 | +------+-----------+----------+------------+-------------+ These functions cannot be passed as actual arguments. 3 DCMPLX DCMPLX (number [,number]) Class: Elemental function - Generic Converts the argument(s) into a double complex value. If one argument is specified, the argument is converted into the real part of the complex value and the imaginary part becomes zero. If two arguments are specified, the first argument is converted into the real part of the complex value and the second argument is converted into the imaginary part of the complex value. If two arguments are specified, they must have the same data type. +-------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +-------+----------+----------+------------+-------------+ | 1,2 | DCMPLX | -- | INTEGER*1 | COMPLEX*16 | | 1,2 | | -- | INTEGER*2 | COMPLEX*16 | | 1,2 | | -- | INTEGER*4 | COMPLEX*16 | | 1,2 | | -- | INTEGER*8 | COMPLEX*16 | | 1,2 | | -- | REAL*4 | COMPLEX*16 | | 1,2 | | -- | REAL*8 | COMPLEX*16 | | 1,2 | | -- | REAL*16 | COMPLEX*16 | | 1 | | -- | COMPLEX*8 | COMPLEX*16 | | 1 | | -- | COMPLEX*16 | COMPLEX*16 | +-------+----------+----------+------------+-------------+ This function cannot be passed as an actual argument. 3 DFLOAT DFLOAT (integer) Class: Elemental function - Generic Converts an integer into a double precision value. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | DFLOAT | -- | INTEGER*1 | REAL*8 | | | | DFLOTI | INTEGER*2 | REAL*8 | | | | DFLOTJ | INTEGER*4 | REAL*8 | | | | DFLOTK | INTEGER*8 | REAL*8 | +------+---------+----------+------------+-------------+ These functions cannot be passed as actual arguments. 3 DIGITS DIGITS (number) Class: Inquiry function - Generic Returns the number of significant binary digits for numbers of the same type and kind type parameter as the argument. The argument can be an integer or real number (scalar or array valued). The result is type default integer. The models for integer and real numbers are described in the HP Fortran for OpenVMS Language Reference Manual. Example: If X is of type REAL*4, DIGITS (X) has the value 24. 3 DIM DIM (number, number) Class: Elemental function - Generic Returns the value of the first argument minus the minimum (MIN) of the two arguments. +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 2 | | -- | INTEGER*1 | INTEGER*1 | | | | IIDIM | INTEGER*2 | INTEGER*2 | | |see note | IDIM | INTEGER*4 | INTEGER*4 | | | | KIDIM | INTEGER*8 | INTEGER*8 | | | | DIM | REAL*4 | REAL*4 | | | | DDIM | REAL*8 | REAL*8 | | | | QDIM | REAL*16 | REAL*16 | +------+----------+----------+------------+-------------+ NOTE: Or JIDIM 3 DIMAG See the AIMAG function. 3 DOT_PRODUCT DOT_PRODUCT (vector-a, vector-b) Class: Transformational function - Generic The "vector"s are rank-one arrays of integer, real, complex, or logical type. The result is a scalar; its type depends on "vector"s. If "vector-a" is of type integer or real, the result value is SUM (vector-a * vector-b). If "vector-a" is of type complex, the result value is SUM (CONJG (vector-a) * vector-b). If "vector-a" is of type logical, the result has the value ANY (vector-a .AND. vector-b). If either rank-one array has size zero, the result is zero if the array is of numeric type, and false if the array is of logical type. Examples: DOT_PRODUCT ((/1, 2, 3/), (/3, 4, 5/)) has the value 26 (calculated as follows: ((1 x 3) + (2 x 4) + (3 x 5)) = 26) DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), ((1.0, 4.0) /))) has the value (17.0, 4.0). DOT_PRODUCT ((/ .TRUE., .FALSE. /), (/ .FALSE., .TRUE. /)) has the value false. 3 DPROD DPROD (real4-number, real4-number) Class: Elemental function - Specific Returns the product of two REAL*4 values as a REAL*8 value. This function cannot be passed as an actual argument. 3 DREAL DREAL (dbl-complex-number) Class: Elemental function - Specific Converts the real part of a double complex argument to double precision type. 3 EOF EOF (integer) Class: Inquiry function - Generic Checks whether a file is at or beyond the end-of-file record. The argument represents a unit specifier corresponding to an open file. It cannot be zero unless you have reconnected unit zero to a unit other than the screen or keyboard. The value of the result is .TRUE. if the file connected to A is at or beyond the end-of-file record; otherwise, .FALSE.. This function cannot be passed as an actual argument. Examples: Consider the following: ! Creates a file of random numbers, reads them back REAL x, total INTEGER count OPEN (1, FILE = 'TEST.DAT') DO I = 1, 20 CALL RANDOM_NUMBER(x) WRITE (1, '(F6.3)') x * 100.0 END DO CLOSE(1) OPEN (1, FILE = 'TEST.DAT') DO WHILE (.NOT. EOF(1)) count = count + 1 READ (1, *) value total = total + value END DO 100 IF ( count .GT. 0) THEN WRITE (*,*) 'Average is: ', total / count ELSE WRITE (*,*) 'Input file is empty ' END IF STOP END 3 EOSHIFT EOSHIFT (array, shift [,boundary] [,dim]) Class: Transformational function - Generic Performs an end-off shift on a rank-one array, or performs end-off shifts on all the complete rank-one sections along a given dimension of an array of rank two or greater. Elements are shifted off at one end of a section and copies of a boundary value are filled in at the other end. Different sections can have different boundary values and can be shifted by different amounts and in different directions. The "array" can be of any type. The "shift" can be a scalar integer or an array with a rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". The "boundary" must be of the same type and kind type parameter as "array". It can be a scalar or an array with a shape that is one less than that of "array" and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn). If "boundary is omitted, it is assumed to have the following values: "array" type "boundary" value ------------ ---------------- integer 0 real 0.0 complex (0.0, 0.0) logical false character (len) "len" blanks The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". If omitted, it is assumed to be 1. The result is an array with the same type, kind type parameter, and shape as "array" The value of "shift" determines the amount and direction of the end-off shift. A positive integer causes a shift to the left (in rows) or up (in columns). If an element is shifted off the beginning of a vector, the "boundary" value is placed at the end of the vector. A negative integer causes a shift to the right (in rows) or down (in columns). If an element is shifted off the end of a vector, the "boundary" value is placed at the beginning of the vector. Examples: Consider that V is the array (1, 2, 3, 4, 5, 6). EOSHIFT (V, SHIFT=2) shifts the array to the left by 2 positions, producing the value (3, 4, 5, 6, 0, 0). EOSHIFT (V, SHIFT= -3, BOUNDARY= 99) shifts the array to the right by 3 positions, and uses the boundary value of 99, producing the value (99, 99, 99, 1, 2, 3). Consider that M is the following array: |1 2 3| |4 5 6| |7 8 9| EOSHIFT (M, SHIFT = 1, BOUNDARY = '*', DIM=2) produces the result: |2 3 *| |5 6 *| |8 9 *| EOSHIFT (M, SHIFT = -1, DIM = 1) produces the result: |0 0 0| |1 2 3| |4 5 6| EOSHIFT (M, SHIFT = (/1, -1, 0/), BOUNDARY = (/ '*', '?', '/' /), DIM=2) produces the result: |2 3 *| |? 4 5| |7 8 9| 3 EPSILON EPSILON (real) Class: Inquiry function - Generic Returns a positive model number that is almost negligible compared to unity in the model representing real numbers. The argument can be scalar or array valued. The model for real numbers is described in the HP Fortran for OpenVMS Language Reference Manual. Example: If X is REAL*4 type, EPSILON (X) has the value 2**-23. 3 ERRSNS ERRSNS ([io-err] [,sys-err] [,stat] [,unit] [,cond]) Class: Subroutine Returns information about the last Fortran error that occurred. The arguments are all return values and must be defined as integer variables or array elements: io-err Stores the most recent Fortran error number that occurred during program execution. The value is zero if no error has occurred. sys-err Stores the most recent RMS STS status code. stat Stores the most recent RMS STV status value. This status value provides additional status information. unit Stores the logical unit number (if the last the last error was an I/O error). cond Stores the actual processor value. This value is always zero. If you specify INTEGER*2 arguments, only the low-order 16 bits of information are returned or adjacent data can be overwritten. Because of this, it is best to use INTEGER*4 arguments. The saved error information is set to zero after each call to ERRSNS. 3 EXIT EXIT ([exit-status]) Class: Subroutine Terminates the program, closes all files, and returns control to the operating system. The optional argument specifies the exit-status value of the program. 3 EXP EXP (exponent) Class: Elemental function - Generic Returns e**X, where X is the value of the argument. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | EXP | EXP | REAL*4 | REAL*4 | | | | DEXP | REAL*8 | REAL*8 | | | | QEXP | REAL*16 | REAL*16 | | |see note | CEXP | COMPLEX*8 | COMPLEX*8 | | | | CDEXP | COMPLEX*16 | COMPLEX*16 | | | | ZEXP | COMPLEX*16 | COMPLEX*16 | | | | CQEXP | COMPLEX*32 | COMPLEX*32 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect CEXP. 3 EXPONENT EXPONENT (real-number) Class: Elemental function - Generic Returns the exponent part of the argument when represented as a model number. The result is of type default integer. If the argument is not equal to zero, the result value is the exponent part of the argument. The exponent must be within default integer range; otherwise, the result is undefined. If the argument is zero, the exponent of the argument is zero. For more information on the exponent part in the real model, see the HP Fortran for OpenVMS Language Reference Manual. Examples: EXPONENT (2.0) has the value 2. If 4.1 is a REAL*4 value, EXPONENT (4.1) has the value 3. 3 FLOAT See the REAL function. 3 FLOOR FLOOR (real-number [,KIND]) Class: Elemental function - Generic Returns the greatest integer less than or equal to its argument. The result is of type default integer (unless KIND specifies a different integer KIND). The result value is equal to the greatest integer less than or equal to the argument. The result is undefined if the value cannot be represented in the default integer range. Examples: FLOOR (4.8) has the value 4. FLOOR (-5.6) has the value -6. 3 FP_CLASS FP_CLASS (real-number) Class: Elemental function - Generic Returns the class of an IEEE real (S_floating, T_floating, or X_floating) argument. The result is of type default integer. The return values are defined in module "FORSYSDEF". For information on the location of this file, see the HP Fortran for OpenVMS User Manual. Example: FP_CLASS (4.0_8) has the value 4 (FOR_K_FP_POS_NORM, a normal positive number). 3 FRACTION FRACTION (real-number) Class: Elemental function - Generic Returns the fractional part of the model representation of the argument value. The result type is the same as the argument. The real model is described in the HP Fortran for OpenVMS Language Reference Manual. Example: If 3.0 is a REAL*4 value, FRACTION (3.0) has the value 0.75. 3 FREE FREE (integer) Class: Intrinsic subroutine Frees a block of memory that is currently allocated. The argument must be of type INTEGER*8. This value is the starting address of the memory to be freed, previously allocated by the MALLOC intrinsic function. If the freed address was not previously allocated by MALLOC, or if an address is freed more than once, results are unpredictable. Examples: Consider the following: INTEGER(4) ADDR, SIZE SIZE = 1024 ! Size in bytes ADDR = MALLOC(SIZE) ! Allocate the memory CALL FREE(ADDR) ! Free it END 3 HUGE HUGE (number) Class: Inquiry function - Generic Returns the largest number in the model representing the same type and kind type parameter as the argument. The argument can be integer or real; it can be scalar or array valued. The result type is scalar of the same type and kind type parameter as the argument. The integer and real models are described in the HP Fortran for OpenVMS Language Reference Manual. Example: If X is REAL*4 type, HUGE (X) has the value (1 - 2**-24) x 2**128. 3 IABS See the ABS function. 3 IACHAR IACHAR (character) Class: Elemental function - Generic Returns the position of a character in the ASCII character set, even if the processor's default character set is different. In VSI Fortran, IACHAR is equivalent to the ICHAR function. The argument must have a length of 1. The result is of type default integer. 3 IAND IAND (integer, integer) Class: Elemental function - Generic Performs a logical AND of the arguments on a bit by bit basis (bitwise AND). This function can also be specified as AND. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | IAND | -- | INTEGER*1 | INTEGER*1 | | | | IIAND | INTEGER*2 | INTEGER*2 | | | | JIAND | INTEGER*4 | INTEGER*4 | | | | KIAND | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 IARGCOUNT IARGCOUNT () Class: Inquiry function - Specific Returns the count of actual arguments passed to the current routine. The result is of type default integer. Functions with a type of CHARACTER, COMPLEX(KIND=8), REAL(KIND=16), and COMPLEX(KIND=16) have an extra argument added that is used to return the function value. Formal (dummy) arguments that can be omitted must be declared VOLATILE. Formal arguments of type CHARACTER cannot be omitted. Formal arguments that are adjustable arrays cannot be omitted. The standard way to pass and detect omitted arguments is to use the Fortran 95 features of OPTIONAL arguments and the PRESENT intrinsic function. Note that a declaration must be visible within the calling routine. The following example shows the IARGCOUNT intrinsic: CALL SUB (A,B) ... SUBROUTINE SUB (X,Y,Z) VOLATILE Z TYPE *, IARGCOUNT() ! Displays the value 2 3 IARGPTR IARGPTR () Class: Inquiry function - Specific Returns a pointer to the actual argument list for the current routine. IARGPTR takes no arguments and returns an INTEGER*8 address of the calling-standard defined "argument block". The first element in the array contains the argument count; subsequent elements contain the INTEGER(KIND=8) address of the actual arguments. Formal (dummy) arguments which can be omitted must be declared VOLATILE. The following example shows the IARGPTR intrinsic: C Test IARGPTR intrinsic function. EXTERNAL TEST_ARGPTR INTEGER*4 X,Y,Z,FOO X = 10 Y = 20 Z = 100 FOO = 4 PRINT 80, %LOC(X), %LOC(Y), %LOC(Z), %LOC(FOO) 80 FORMAT (' Argument addresses: ',4(1X, Z16)) CALL TEST_ARGPTR (4, X, Y, Z, FOO) END OPTIONS /EXTEND_SOURCE SUBROUTINE TEST_ARGPTR (N_ARGS) POINTER (II, I_ARGN) INTEGER*8 I_ARGN POINTER (I_PTR, I_VAL) INTEGER I_VAL II = IARGPTR() ! Get address of arg block II = II + SIZEOF (II) ! Get address of address of first arg DO I = 1, N_ARGS+1 I_PTR = I_ARGN ! Get address of actual from homed ! arg list print 90, I, I_PTR, I_VAL 90 format ( ' Argument ',I2, ' address = ',Z16, ', contents = ',Z16) II = II + SIZEOF (II) ! Get address of address of next arg END DO RETURN END 3 IBCHNG IBCHNG (integer, position) Class: Elemental function - Generic Returns the reverse of the value of a specified bit in an integer. The low-order bit is position 0. Examples: Consider the following: INTEGER J, K J = IBCHNG(10, 2) ! returns 14 = 1110 K = IBCHNG(10, 1) ! returns 8 = 1000 3 IBCLR IBCLR (integer, position) Class: Elemental function - Generic Returns the value of the first argument with the specified bit set to 0 (bit clear). The low-order bit is position 0. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | IBCLR | -- | INTEGER*1 | INTEGER*1 | | | | IIBCLR | INTEGER*2 | INTEGER*4 | | | | JIBCLR | INTEGER*4 | INTEGER*4 | | | | KIBCLR | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 IBITS IBITS (integer, start-position, length) Class: Elemental function - Generic Returns the value of the bits of the first argument specified by start-position and number of bits. The low-order bit is position 0. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 3 | IBITS | -- | INTEGER*1 | INTEGER*1 | | | | IIBITS | INTEGER*2 | INTEGER*2 | | | | JIBITS | INTEGER*4 | INTEGER*4 | | | | KIBITS | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 IBSET IBSET (integer, position) Class: Elemental function - Generic Returns the value of the first argument with the specified bit set to 1 (bit set). The low-order bit is position 0. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | IBSET | -- | INTEGER*1 | INTEGER*1 | | | | IIBSET | INTEGER*2 | INTEGER*2 | | | | JIBSET | INTEGER*4 | INTEGER*4 | | | | KIBSET | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 ICHAR ICHAR (character) Class: Elemental function - Generic Returns the position of a character in the processor's character set. The argument must have a length of 1. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | -- | -- | CHARACTER | INTEGER*2 | | | | ICHAR | CHARACTER | INTEGER*4 | | | | -- | CHARACTER | INTEGER*8 | +------+---------+----------+------------+-------------+ This function cannot be passed as an actual argument. 3 IDATE IDATE (month, day, year) Class: Subroutine Returns three integer values representing the current date. The month is represented as the number of the month (1 - 12). The day is represented as the day of the month. The year is represented as the last two digits of the year. 3 IDIM See the DIM function. 3 IDINT See the INT function. 3 IDNINT See the NINT function 3 IEOR IEOR (integer, integer) Class: Elemental function - Generic Performs an exclusive OR of the arguments on a bit by bit basis (bit exclusive OR). This function can also be specified as XOR. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | IEOR | -- | INTEGER*1 | INTEGER*1 | | | | IIEOR | INTEGER*2 | INTEGER*2 | | | | JIEOR | INTEGER*4 | INTEGER*4 | | | | KIEOR | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 IFIX See the INT function. 3 ILEN ILEN (integer) Class: Elemental function - Generic Returns the length (in bits) of the two's complement representation of an integer. The result type is the same as the argument. Examples: ILEN (4) has the value 3. ILEN (-4) has the value 2. 3 IMAG See the AIMAG intrinsic function. 3 INDEX INDEX (string, substring [,back] [,kind]) Class: Elemental function - Generic Returns the starting position of the substring as an INTEGER*4 or INTEGER*8 value. "string" and "substring" are of type character, "back" is of type logical, and "kind" is a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "back" is absent or false, the leftmost substring is found. If "back" is true, the rightmost substring is found. Examples: INDEX ('FORTRAN', 'O', BACK = .TRUE.) has the value 2. INDEX ('XXXX', " ", BACK = .TRUE.) has the value 0. INDEX ('XXXX', "", BACK = .TRUE.) has the value 5. 3 INT INT (number [,kind]) Class: Elemental function - Generic Returns the largest integer whose absolute value does not exceed the absolute value of the argument and has the same sign as the argument. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that shown in the following table. If the processor cannot represent the result value in the kind of the result, the result is undefined. +------+-----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+-----------+----------+------------+-------------+ | 1 | INT | -- | INTEGER*1 | INTEGER*2 | | | | -- | INTEGER*1 | INTEGER*4 | | | | -- | INTEGER*1 | INTEGER*8 | | | | -- | INTEGER*2 | INTEGER*4 | | | | -- | INTEGER*2 | INTEGER*8 | | | | -- | INTEGER*4 | INTEGER*4 | | | | -- | INTEGER*4 | INTEGER*8 | | | | -- | INTEGER*8 | INTEGER*8 | | |see note1 | IIFIX | REAL*4 | INTEGER*2 | | | | IINT | REAL*4 | INTEGER*2 | | |see note2 | IFIX | REAL*4 | INTEGER*4 | | | | JFIX | INTEGER*1 | INTEGER*4 | | | | | INTEGER*2 | INTEGER*4 | | | | | INTEGER*4 | INTEGER*4 | | | | | INTEGER*8 | INTEGER*4 | | | | | REAL*4 | INTEGER*4 | | | | | REAL*8 | INTEGER*4 | | | | | REAL*16 | INTEGER*4 | | | | | COMPLEX*8 | INTEGER*4 | | | | | COMPLEX*16 | INTEGER*4 | | | | | COMPLEX*32 | INTEGER*4 | | |see note3 | INT | REAL*4 | INTEGER*4 | | | | KIFIX | REAL*4 | INTEGER*8 | | | | KINT | REAL*4 | INTEGER*8 | | | | IIDINT | REAL*8 | INTEGER*2 | | |see note4 | IDINT | REAL*8 | INTEGER*4 | | | | KIDINT | REAL*4 | INTEGER*8 | | | | IIQINT | REAL*16 | INTEGER*2 | | |see note5 | IQINT | REAL*16 | INTEGER*4 | | | | KIQINT | REAL*16 | INTEGER*8 | | | | -- | COMPLEX*8 | INTEGER*2 | | | | -- | COMPLEX*8 | INTEGER*4 | | | | -- | COMPLEX*8 | INTEGER*8 | | | | -- | COMPLEX*16 | INTEGER*2 | | | | -- | COMPLEX*16 | INTEGER*4 | | | | -- | COMPLEX*16 | INTEGER*8 | | | | -- | COMPLEX*32 | INTEGER*2 | | | | -- | COMPLEX*32 | INTEGER*4 | | | | -- | COMPLEX*32 | INTEGER*8 | | | | INT1 | INTEGER*1 | INTEGER*1 | | | | | INTEGER*2 | INTEGER*1 | | | | | INTEGER*4 | INTEGER*1 | | | | | INTEGER*8 | INTEGER*1 | | | | | REAL*4 | INTEGER*1 | | | | | REAL*8 | INTEGER*1 | | | | | REAL*16 | INTEGER*1 | | | | | COMPLEX*8 | INTEGER*1 | | | | | COMPLEX*16 | INTEGER*1 | | | | | COMPLEX*32 | INTEGER*1 | | | | INT2 | INTEGER*1 | INTEGER*2 | | | | | INTEGER*2 | INTEGER*2 | | | | | INTEGER*4 | INTEGER*2 | | | | | INTEGER*8 | INTEGER*2 | | | | | REAL*4 | INTEGER*2 | | | | | REAL*8 | INTEGER*2 | | | | | REAL*16 | INTEGER*2 | | | | | COMPLEX*8 | INTEGER*2 | | | | | COMPLEX*16 | INTEGER*2 | | | | | COMPLEX*32 | INTEGER*2 | | | | INT4 | INTEGER*1 | INTEGER*4 | | | | | INTEGER*2 | INTEGER*4 | | | | | INTEGER*4 | INTEGER*4 | | | | | INTEGER*8 | INTEGER*4 | | | | | REAL*4 | INTEGER*4 | | | | | REAL*8 | INTEGER*4 | | | | | REAL*16 | INTEGER*4 | | | | | COMPLEX*8 | INTEGER*4 | | | | | COMPLEX*16 | INTEGER*4 | | | | | COMPLEX*32 | INTEGER*4 | | | | INT8 | INTEGER*1 | INTEGER*8 | | | | | INTEGER*2 | INTEGER*8 | | | | | INTEGER*4 | INTEGER*8 | | | | | INTEGER*8 | INTEGER*8 | | | | | REAL*4 | INTEGER*8 | | | | | REAL*8 | INTEGER*8 | | | | | REAL*16 | INTEGER*8 | | | | | COMPLEX*8 | INTEGER*8 | | | | | COMPLEX*16 | INTEGER*8 | | | | | COMPLEX*32 | INTEGER*8 | +------+-----------+----------+------------+-------------+ Note1: This function can also be specified as HFIX. Note2: For compatibility with older versions of Fortran, IFIX can also be specified as a generic function. Note3: Or JINT. Note4: Or JIDINT. For compatibility with older versions of Fortran, IDINT can also be specified as a generic function. Note5: Or JIQINT. For compatibility with older versions of Fortran, IQINT can also be specified as a generic function. These functions cannot be passed as actual arguments. The setting of compiler options specifying integer size can affect INT, IDINT, and IQINT. The setting of compiler options specifying integer size and real size can affect IFIX. 3 INT_PTR_KIND INT_PTR_KIND() Class: Inquiry function - Specific Returns the INTEGER KIND that will hold an address. This is a specific function that has no generic function associated with it. It must not be passed as an actual argument. The result is of type default integer. The result is a scalar with the value equal to the value of the kind parameter of the integer data type that can represent an address on the host platform. The value is 8. The following example shows the INT_PTR_KIND intrinsic: REAL A(100) POINTER (P, A) INTEGER (KIND=INT_PTR_KIND()) SAVE_P P = MALLOC (400) SAVE_P = P 3 IOR IOR (integer, integer) Class: Elemental function - Generic Performs a logical OR of the arguments on a bit by bit basis (bitwise inclusive OR). This function can also be specified as OR. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | IOR | -- | INTEGER*1 | INTEGER*1 | | | | IIOR | INTEGER*2 | INTEGER*2 | | | | JIOR | INTEGER*4 | INTEGER*4 | | | | KIOR | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 IQINT See the INT function. 3 IQNINT See the NINT function. 3 ISHA ISHA (integer, shift) Class: Elemental function - Generic Arithmetically shifts an integer left or right by a specified number of bits. The "shift" is of type integer; it is the direction and distance of shift. The result type is the same as "integer". If "shift" is positive, the shift is to the left; if "shift" is negative, the shift is to the right. If "shift" is zero, no shift is performed. Bits shifted out from the left or from the right, as appropriate, are lost. If the shift is to the left, zeros are shifted in on the right. If the shift is to the right, copies of the sign bit (0 for non-negative "integer"; 1 for negative "integer") are shifted in on the left. The kind of integer is important in arithmetic shifting because sign varies among integer representations (see the following example). If you want to shift a one-byte or two-byte argument, you must declare it as INTEGER(1) or INTEGER(2). Examples: Consider the following: INTEGER(1) i, res1 INTEGER(2) j, res2 i = -128 ! equal to 10000000 j = -32768 ! equal to 10000000 00000000 res1 = ISHA (i, -4) ! returns 11111000 = -8 res2 = ISHA (j, -4) ! returns 11111000 00000000 = -2048 3 ISHC ISHC (integer, shift) Class: Elemental function - Generic Rotates an integer left or right by specified number of bits. Bits shifted out one end are shifted in the other end. No bits are lost. The "shift" is of type integer; it is the direction and distance of rotation. If "shift" is positive, "integer" is rotated left "shift" bits. If "shift" is negative, "integer" is rotated right "shift" bits. Bits shifted out one end are shifted in the other. No bits are lost. The kind of integer is important in circular shifting. With an INTEGER(4) argument, all 32 bits are shifted. If you want to rotate a one-byte or two-byte argument, you must declare it as INTEGER(1) or INTEGER(2). Examples: Consider the following: INTEGER(1) i, res1 INTEGER(2) j, res2 i = 10 ! equal to 00001010 j = 10 ! equal to 00000000 00001010 res1 = ISHC (i, -3) ! returns 01000001 = 65 res2 = ISHC (j, -3) ! returns 01000000 00000001 = 16385 3 ISHFT ISHFT (integer, shift) Class: Elemental function - Generic Performs a bitwise logical shift - the "shift" is the no-of-positions. The integer is shifted left (if "shift" is positive) or right (if "shift" is negative) by ABS(shift) bits. If ABS(shift) is greater than or equal to the length in bits of the integer argument, the result is zero. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | ISHFT | -- | INTEGER*1 | INTEGER*1 | | | | IISHFT | INTEGER*2 | INTEGER*2 | | | | JISHFT | INTEGER*4 | INTEGER*4 | | | | KISHFT | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ Bits shifted out are lost. Zeros are shifted in from the opposite end. 3 ISHFTC ISHFTC (integer, shift [,size]) Class: Elemental function - Generic Performs a bitwise circular shift - "shift" is the no-of-positions and "size" is the no-of-bits. The rightmost "size" bits of the integer argument are circularly shifted by "shift" places; bits in the integer argument beyond the value specified by "size" are unaffected. If "shift is positive, the shift is to the left; if negative, the shift is to the right. If "size" is omitted, it is assumed to have the value BIT_SIZE (integer). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 3 | ISHFTC | IISHFTC | INTEGER*2 | INTEGER*4 | | | | JISHFTC | INTEGER*4 | INTEGER*4 | | | | KISHFTC | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 ISHL ISHL (integer, shift) Class: Elemental function - Generic Logically shifts an integer left or right by the specified bits. Zeros are shifted in from the opposite end. The "shift" is of type integer; it is the direction and distance of shift. Unlike circular or arithmetic shifts, which can shift ones into the number being shifted, logical shifts shift in zeros only, regardless of the direction or size of the shift. The integer kind, however, still determines the end that bits are shifted out of, which can make a difference in the result (see the following example). Examples: Consider the following: INTEGER(1) i, res1 INTEGER(2) j, res2 i = 10 ! equal to 00001010 j = 10 ! equal to 00000000 00001010 res1 = ISHL (i, 5) ! returns 01000000 = 64 res2 = ISHL (j, 5) ! returns 00000001 01000000 = 320 3 ISIGN See the SIGN function. 3 ISNAN ISNAN (real-number) Class: Elemental function - Generic Tests whether IEEE REAL*4 (S_floating) and REAL*8 (T_floating) numbers are Not-a-Number (NaN) values. To use this function, compiler option /FLOAT=IEEE_FLOAT must be set. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | ISNAN | -- | REAL*4 | LOGICAL*4 | | | | | REAL*8 | LOGICAL*4 | +------+---------+----------+------------+-------------+ 3 KIND KIND (number) Class: Inquiry function - Generic Returns the value of the kind type parameter of the argument. For more information on kind type parameters, see the reference manual. The argument can be of any intrinsic type. The result is a scalar of type default integer. Examples: KIND (0.0) has the kind type value of default real type. KIND (12) has the kind type value of default integer type. 3 LBOUND LBOUND (array, [,dim] [,kind]) Class: Inquiry function - Generic Returns the lower bounds for all dimensions of an array, or the lower bound for a specified dimension. The "array" cannot be an allocatable array that is not allocated, or a disassociated pointer. The "dim" is a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is present, the result is a scalar. Otherwise, the result is a rank-one array with one element for each dimension of "array". Each element in the result corresponds to a dimension of "array". If "array" is an array section or an array expression that is not a whole array or array structure component, each element of the result has the value 1. The setting of compiler options that specify integer size can affect the result of this function. Examples Consider the following: REAL ARRAY_A (1:3, 5:8) REAL ARRAY_B (2:8, -3:20) LBOUND (ARRAY_A) is (1, 5). LBOUND (ARRAY_A, DIM=2) is 5. LBOUND (ARRAY_B) is (2, -3). LBOUND (ARRAY_B (5:8, :)) is (1,1) because the arguments are array sections. 3 LEADZ LEADZ (integer) Class: Elemental function - Generic Returns the number of leading zeros in the binary representation of the integer argument. The result type is the same as the argument. Example: Consider the following: INTEGER*8 J, TWO PARAMETER (TWO=2) DO J= -1, 40 TYPE *, LEADZ(TWO**J) ! Prints 64 down to 23 (leading zeros) ENDDO END 3 LEN LEN (string [,kind]) Class: Inquiry function - Generic Returns the number of characters in the argument. The argument must be a character expression. The "kind" must be a scalar integer initialization expression. The result is an INTEGER*4 or INTEGER*8 value. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The setting of compiler options that specify integer size can affect the result of this function. 3 LEN_TRIM LEN_TRIM (string [,kind]) Class: Elemental function - Generic Returns the length of the character argument without counting trailing blank characters. The "string" must be of type character. The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. Examples: LEN_TRIM (' C D ') has the value 7. LEN_TRIM (' ') has the value 0. 3 LGE LGE (string-a, string-b) Class: Elemental function - Generic Returns a value of true if the first character string is lexically greater than or equal to the second character string, based on the ASCII collating sequence - even if the processor's default collating sequence is different. In VSI Fortran, LGE is equivalent to the >= operator. The ASCII collating sequence determines the relationship between the arguments. The arguments must be character expressions. The result is a LOGICAL*4 value. This function cannot be passed as an actual argument. 3 LGT LGT (string-a, string-b) Class: Elemental function - Generic Returns a value of true if the first character string is greater than the second character string, based on the ASCII collating sequence - even if the processor's default collating sequence is different. In VSI Fortran, LGT is equivalent to the > operator. The ASCII collating sequence determines the relationship between the arguments. The arguments must be character expressions. The result is a LOGICAL*4 value. This function cannot be passed as an actual argument. 3 LLE LLE (string-a, string-b) Class: Elemental function - Generic Returns a value of true if the first character string is less than or equal to the second character string, based on the ASCII collating sequence - even if the processor's default collating sequence is different. In VSI Fortran, LLE is equivalent to the <= operator. The ASCII collating sequence determines the relationship between the arguments. The arguments must be character expressions. The result is a LOGICAL*4 value. This function cannot be passed as an actual argument. 3 LLT LLT (string-a, string-b) Class: Elemental function - Generic Returns a value of true if the first character string is less than the second character string, based on the ASCII collating sequence - even if the processor's default collating sequence is different. In VSI Fortran, LLT is equivalent to the < operator. The ASCII collating sequence determines the relationship between the arguments. The arguments must be character expressions. The result is a LOGICAL*4 value. This function cannot be passed as an actual argument. 3 LOC LOC (arg) Class: Inquiry function - Generic Returns the internal address of a storage item. The argument can be a variable, an array or record field reference, a procedure, or a constant; it can be of any data type. It must not be the name of an internal procedure or statement function. If it is a pointer, it must be defined and associated with a target. The result is of type INTEGER*8. The value of the result represents the address of the data object or, in the case of pointers, the address of its associated target. If the argument is not valid, the result is undefined. On Open VMS systems, in the case of global symbolic constants, LOC returns the value of the constant rather than an address. The LOC intrinsic serves the same purpose as the %LOC built-in function. This function cannot be passed as an actual argument. 3 LOG LOG (number) Class: Elemental function - Generic Returns the natural log (base e) of a real or complex argument. If the argument is real, its value must be greater than zero. If the argument is complex, its value must not be (0.,0.). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | LOG | ALOG | REAL*4 | REAL*4 | | | | DLOG | REAL*8 | REAL*8 | | | | QLOG | REAL*16 | REAL*16 | | | | CLOG | COMPLEX*8 | COMPLEX*8 | | | | CDLOG | COMPLEX*16 | COMPLEX*16 | | | | ZLOG | COMPLEX*16 | COMPLEX*16 | | | | CQLOG | COMPLEX*32 | COMPLEX*32 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect ALOG and CLOG. 3 LOG10 LOG10 (real-number) Class: Elemental function - Generic Returns the common log (base 10) of the argument. The argument must be greater than zero. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | LOG10 | ALOG10 | REAL*4 | REAL*4 | | | | DLOG10 | REAL*8 | REAL*8 | | | | QLOG10 | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect ALOG10. 3 LOGICAL LOGICAL (logical-exp, [,kind]) Class: Elemental function - Generic Converts the logical value of the argument to a logical of different kind type parameters. The setting of integer size compiler options can affect this function. Examples: LOGICAL (L .OR. .NOT. L) has the value true and is of type default logical regardless of the kind type parameter of logical variable L. LOGICAL (.FALSE., 2) has the value false, with the kind type parameter of INTEGER(KIND=2). 3 MALLOC MALLOC (integer) Class: Elemental function - Specific Allocates a block of memory. The argument must be of type integer. This value is the size in bytes of memory to be allocated. If the argument is INTEGER*8, a 64-bit (P3) space is allocated. The result is of type INTEGER*8. The result is the starting address of the allocated memory. The memory allocated can be freed by using the FREE intrinsic function. This function cannot be passed as an actual argument. Examples: Consider the following: INTEGER(4) SIZE REAL(4) STORAGE(*) POINTER (ADDR, STORAGE) ! ADDR will point to STORAGE SIZE = 1024 ! Size in bytes ADDR = MALLOC(SIZE) ! Allocate the memory CALL FREE(ADDR) ! Free it END 3 MATMUL MATMUL (matrix-a, matrix-b) Class: Transformational function - Generic Performs matrix multiplication of numeric or logical matrices. The "matrix"s can be arrays of rank one or two. At least one argument must be rank two. The size of the first (or only) dimension of "matrix-b" must equal the last (or only) dimension of "matrix-a". The type of the resulting array depends on the data types of the arguments. The rank and shape of the result follows: o If "matrix-a" has shape (n,m) and "matrix-b" has shape (m,k), the result is a rank-two array with shape (n,k). o If "matrix-a" has shape (m) and "matrix-b" has shape (m,k), the result is a rank-one array with shape (k). o If "matrix-a" has shape (n,m) and "matrix-b" has shape (m), the result is a rank-one array with shape (n). Examples: Consider the following: A is the matrix |2 3 4|, B is the matrix |2 3|, |3 4 5| |3 4| |4 5| X is vector (1, 2), and Y is vector (1, 2, 3). The result of MATMUL (A, B) is the matrix-matrix product AB with the value |29 38| |38 50| The result of MATMUL (X, A) is the vector-matrix product XA with the value (8, 11, 14). The result of MATMUL (A, Y) is the matrix-vector product AY with the value (20, 26). 3 MAX MAX (number, number [, ...]) Class: Elemental function - Generic Returns the greatest of the values specified in the argument list. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | n | MAX | -- | INTEGER*1 | INTEGER*1 | | | | -- | INTEGER*1 | REAL*4 | | | | IMAX0 | INTEGER*2 | INTEGER*2 | | | | AIMAX0 | INTEGER*2 | REAL*4 | | |see note1| MAX0 | INTEGER*4 | INTEGER*4 | | |see note2| AMAX0 | INTEGER*4 | REAL*4 | | | | KMAX0 | INTEGER*8 | INTEGER*8 | | | | AKMAX0 | INTEGER*8 | REAL*4 | | | | IMAX1 | REAL*4 | INTEGER*2 | | |see note3| MAX1 | REAL*4 | INTEGER*4 | | | | KMAX1 | REAL*4 | INTEGER*8 | | | | AMAX1 | REAL*4 | REAL*4 | | | | DMAX1 | REAL*8 | REAL*8 | | | | QMAX1 | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ Note1: Or JMAX0. Note2: Or AJMAX0. AMAX0 is the same as REAL(MAX). For compatibility with older versions of Fortran, AMAX0 can also be specified as a generic function. Note3: Or JMAX1. MAX1 is the same as INT(MAX). For compatibility with older versions of Fortran, MAX1 can also be specified as a generic function. These functions cannot be passed as actual arguments. The setting of compiler options specifying integer size can affect MAX1. The setting of compiler options specifying real size can affect AMAX1. 3 MAX0 See the MAX function. 3 MAX1 See the MAX function. 3 MAXEXPONENT MAXEXPONENT (real-arg) Class: Inquiry function - Generic Returns the maximum exponent in the model representing the same type and kind type parameter as the argument. The argument can be scalar or array valued. The model for real numbers is described in the HP Fortran for OpenVMS Language Reference Manual. Example: If X is REAL*4 type, MAXEXPONENT (X) has the value 128. 3 MAXLOC MAXLOC (array [,dim] [,mask] [,kind]) Class: Transformational function - Generic Returns the location of the maximum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. The "array" can be of type integer or real. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" must be a logical array conformable with "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is absent, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The result of MAXLOC (array) is a rank-one array whose elements form the subscript of the location of the element with the maximum value in "array". The result of MAXLOC (array, mask=mask) is a rank-one array whose elements form the subscript of the location of the element with the maximum value corresponding to the condition specified by "mask". If more than one element has maximum value, the element whose subscripts are returned is the first such element, taken in array element order. If "array" has size zero, or every element of "mask" has the value .FALSE., the value of the result is undefined. Examples: The value of MAXLOC ((/3, 7, 4, 7/)) is 2. Consider that A is the array | 4 0 -3 2| | 3 1 -2 6| |-1 -4 5 -5| MAXLOC (A, MASK=A .LT. 5) has the value (1, 1). This is true even if A has a declared bound other than 1. MAXLOC (A, DIM=1) has the value (1, 2, 3, 2). MAXLOC (A, DIM=2) has the value (1, 4, 3). 3 MAXVAL MAXVAL (array [,dim] [,mask] Class: Transformational function - Generic Returns the maximum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. The array can be of type integer or real. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" must be a logical array conformable with "array". The result is the same data type as "array". The result is a logical array with the same kind type parameter as "array". The result is a scalar if "dim" is absent or "array" has rank one. Otherwise, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". The result of MAXVAL (array) has a value equal to the maximum value of all the elements in "array". The result of MAXVAL (array, mask=mask) has a value equal to the maximum value of the elements in "array" corresponding to the condition specified by "mask". If "array" has size zero or if there are no true elements in "mask," the result has the value of the negative number of the largest magnitude supported by the processor for numbers of the type and kind type parameter of "array". Examples: The value of MAXVAL ((/2, 3, 4/)) is 4. The value of MAXVAL (B, MASK=B .LT. 0.0) finds the maximum of the negative elements of B. Consider that C is the array |2 3 4| |5 6 7| MAXVAL (C, DIM=1) has the value (5, 6, 7). MAXVAL (C, DIM=2) has the value (4, 7). 3 MERGE MERGE (tsource, fsource, mask) Class: Elemental function - Generic Selects between two values or between corresponding elements in two arrays, according to the condition specified by a logical mask. The "tsource" and "fsource" can be scalars or arrays; they must have the same type and type parameters. The "mask" is a logical array. The result type is the same as "tsource". The value of "mask" determines whether the result value is taken from "tsource" (if "mask" is true) or "fsource" (if "mask" is false). Examples: For MERGE (1.0, 0.0, R < 0), if R is -3 the merge has the value 1.0, while if R is 7 the merge has the value 0.0. Consider that TSOURCE is the array |1 3 5|, FSOURCE is the |2 4 6| array |8 9 0|, and MASK is the array |F T T|. |1 2 3| |T T F| MERGE (TSOURCE, FSOURCE, MASK) produces the result: |8 3 5|. |2 4 3| 3 MIN MIN (number, number [, ...]) Class: Elemental function - Generic Returns the lowest of the values specified in the argument list. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | n | MIN | -- | INTEGER*1 | INTEGER*1 | | | | -- | INTEGER*1 | REAL*4 | | | | IMIN0 | INTEGER*2 | INTEGER*2 | | | | AIMIN0 | INTEGER*2 | REAL*4 | | |see note1| MIN0 | INTEGER*4 | INTEGER*4 | | |see note2| AMIN0 | INTEGER*4 | REAL*4 | | | | KMIN0 | INTEGER*8 | INTEGER*8 | | | | AKMIN0 | INTEGER*8 | REAL*4 | | | | IMIN1 | REAL*4 | INTEGER*2 | | |see note3| MIN1 | REAL*4 | INTEGER*4 | | | | KMIN1 | REAL*4 | INTEGER*8 | | | | AMIN1 | REAL*4 | REAL*4 | | | | DMIN1 | REAL*8 | REAL*8 | | | | QMIN1 | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ Note1: Or JMIN0. Note2: Or AJMIN0. AMIN0 is the same as REAL(MIN). For compatibility with older versions of Fortran, AMIN0 can also be specified as a generic function. Note3: Or JMIN1. MIN1 is the same as INT(MIN). For compatibility with older versions of Fortran, MIN1 can also be specified as a generic function. These functions cannot be passed as actual arguments. The setting of compiler options specifying integer size can affect MIN1. The setting of compiler options specifying real size can affect AMIN1. 3 MIN0 See the MIN function. 3 MIN1 See the MIN function. 3 MINEXPONENT MINEXPONENT (real-arg) Class: Inquiry function - Generic Returns the minimum exponent in the model representing the same type and kind type parameter as the argument. The argument can be scalar or array valued. The model for real numbers is described in the HP Fortran for OpenVMS Language Reference Manual. Example: If X is REAL*4 type, MINEXPONENT (X) has the value -125. 3 MINLOC MINLOC (array [,dim] [,mask] [,kind]) Class: Transformational function - Generic Returns the location of the minimum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. The "array" can be of type integer or real. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" must be a logical array conformable with "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is absent, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The result of MINLOC (array) is a rank-one array whose elements form the subscript of the location of the element with the minimum value in "array". The result of MINLOC (array, mask=mask) is a rank-one array whose elements form the subscript of the location of the element with the minimum value corresponding to the condition specified by "mask". If more than one element has minimum value, the element whose subscripts are returned is the first such element, taken in array element order. If "array" has size zero, or every element of "mask" has the value .FALSE., the value of the result is undefined. Examples: The value of MINLOC ((/3, 1, 4, 1/)) is 2. Consider that A is the array | 4 0 -3 2| | 3 1 -2 6| |-1 -4 5 -5| MINLOC (A, MASK=A .GT. -5) has the value (3, 2). This is true even if A has a declared bound other than 1. MAXLOC (A, DIM=1) has the value (3, 3, 1, 3). MAXLOC (A, DIM=2) has the value (3, 3, 4). 3 MINVAL MINVAL (array [,dim] [,mask] Class: Transformational function - Generic Returns the minimum value of all elements in an array, a set of elements in an array, or elements in a specified dimension of an array. The array can be of type integer or real. The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" must be a logical array conformable with "array". The result is the same data type as "array". The result is a logical array with the same kind type parameter as "array". The result is a scalar if "dim" is absent or "array" has rank one. Otherwise, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". The result of MINVAL (array) has a value equal to the minimum value of all the elements in "array". The result of MINVAL (array, mask=mask) has a value equal to the minimum value of the elements in "array" corresponding to the condition specified by "mask". If "array" has size zero or if there are no true elements in "mask," the result has the value of the positive number of the largest magnitude supported by the processor for numbers of the type and kind type parameter of "array". Examples: The value of MINVAL ((/2, 3, 4/)) is 2. The value of MINVAL (B, MASK=B .GT. 0.0) finds the minimum of the positive elements of B. Consider that C is the array |2 3 4| |5 6 7| MINVAL (C, DIM=1) has the value (2, 3, 4). MINVAL (C, DIM=2) has the value (2, 5). 3 MOD MOD (dividend, divisor) Class: Elemental function - Generic Divides the first argument by the second and returns the remainder. +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 2 | MOD | -- | INTEGER*1 | INTEGER*1 | | | | IMOD | INTEGER*2 | INTEGER*2 | | |see note1 | MOD | INTEGER*4 | INTEGER*4 | | | | KMOD | INTEGER*8 | INTEGER*8 | | |see note2 | AMOD | REAL*4 | REAL*4 | | | | DMOD | REAL*8 | REAL*8 | | | | QMOD | REAL*16 | REAL*16 | +------+----------+----------+------------+-------------+ Note1: Or JMOD. Note2: The setting of compiler options specifying real size can affect AMOD. 3 MODULO MODULO (number-a, number-b) Class: Elemental function - Generic Returns the modulo of the arguments. The arguments can be integer or real type. They must both be the same type and kind type parameter. The result is the same type as the arguments. If "number-a" is of type integer and "number-b" is not equal to zero, the value of the result is "number-a" - FLOOR(REAL("number-a")/REAL("number-b")) * "number-b". If "number-a" is of type real and "number-b" is not equal to zero, the value of the result is "number-a" - FLOOR("number-a"/"number-b"). If "number-b" is equal to zero, the result is undefined. Examples: MODULO (7, 3) has the value 1. MODULO (9, -6) has the value -3. MODULO (-9, 6) has the value 3. 3 MULT_HIGH MULT_HIGH (integer*8, integer*8) Class: Elemental function - Specific A function that multiplies two 64-bit unsigned integers. The result is of type INTEGER*8. The result value is the upper (leftmost) 64 bits of the 128-bit unsigned result. This function cannot be passed as an actual argument. Consider the following: INTEGER(8) I,J,K I=2_8**53 J=2_8**51 K = MULT_HIGH (I,J) PRINT *,I,J,K WRITE (6,1000)I,J,K 1000 FORMAT (' ', 3(Z,1X)) END This example prints the following: 9007199254740992 2251799813685248 1099511627776 20000000000000 8000000000000 10000000000 3 MY_PROCESSOR MY_PROCESSOR () Class: Inquiry function - Specific Returns the identifying number of the calling process. This is a specific function that has no generic function associated with it. It must not be passed as an actual argument. The result is a scalar of type default integer. The result value is the identifying number of the physical processor from which the call is made. The value is in the range 0 to "n"-1, where "n" is the value returned by NUMBER_OF_PROCESSORS. 3 MVBITS MVBITS (from, frompos, len, to, topos) Class: Elemental subroutine Copies a sequence of bits (a bit field) from one location to another. The following arguments can be of any integer data type: from Represents the location from which a bit field is transferred. frompos Identifies the first bit position in the field transferred from "from". It must not be negative. "frompos" + "len" must be less than or equal to BIT_SIZE (from). len Identifies the length of the field transferred from "from". It must not be negative. to Represents the location to which a bit field is transferred. It must have the same kind parameter as "from". "to" is set by copying the sequence of bits of length "len", starting at position "frompos" of "from" to position "topos" of "to". No other bits of "to" are altered. On return, the "len" bits of "to" (starting at "topos") are equal to the value that "len" bits of "from" (starting at "frompos") had on entry. topos Identifies the starting position (within "to") for the bits being transferred. It must not be negative. "topos" + "len" must be less than or equal to BIT_SIZE (to).) You can also specify the following specific subroutines: IMVBITS All arguments must be INTEGER*2. JMVBITS Arguments can be INTEGER*2 or INTEGER*4; at least one must be INTEGER*4. KMVBITS Arguments can be INTEGER*2, INTEGER*4, or INTEGER*8; at least one must be INTEGER*8. 3 NEAREST NEAREST (real-number-a, real-number-b) Class: Elemental function - Generic Returns the nearest different number (representable on the processor) in a given direction. The result type is the same as "real-number-a"; a positive "real-number-b" returns the nearest number in the direction of positive infinity. A negative one goes in the direction of negative infinity. Example: If 3.0 and 2.0 are REAL*4 values, NEAREST (3.0, 2.0) has the value 3 + 2**-22, which equals approximately 3.0000002, while NEAREST (3.0, -2.0) has the value 3-2**-22, which approximately equals 2.9999998. For more information on the REAL*4 model, see the HP Fortran for OpenVMS Language Reference Manual. 3 NINT NINT (real-number [,kind]) Class: Elemental function - Generic Returns the value of the integer nearest to the value of the argument. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that shown in the following table. If the processor cannot represent the result value in the kind of the result, the result is undefined. +------+-----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+-----------+----------+------------+-------------+ | 1 | | ININT | REAL*4 | INTEGER*2 | | |see note1 | NINT | REAL*4 | INTEGER*4 | | | | KNINT | REAL*4 | INTEGER*8 | | | | IIDNNT | REAL*8 | INTEGER*2 | | |see note2 | IDNINT | REAL*8 | INTEGER*4 | | | | KIDNNT | REAL*8 | INTEGER*8 | | | | IIQNNT | REAL*16 | INTEGER*2 | | |see note3 | IQNINT | REAL*16 | INTEGER*4 | | | | KIQNNT | REAL*16 | INTEGER*8 | +------+-----------+----------+------------+-------------+ Note1: Or JNINT. Note2: Or JIDNNT. For compatibility with older versions of Fortran, IDNINT can also be specified as a generic function. Note3: Or JIQNNT. For compatibility with older versions of Fortran, IQNINT can also be specified as a generic function. The setting of compiler options specifying integer size can affect NINT, IDNINT, and IQNINT. 3 NOT NOT (integer) Class: Elemental function - Generic Complements each bit of the argument (bitwise complement). +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | NOT | -- | INTEGER*1 | INTEGER*1 | | | | INOT | INTEGER*2 | INTEGER*2 | | | | JNOT | INTEGER*4 | INTEGER*4 | | | | KNOT | INTEGER*8 | INTEGER*8 | +------+---------+----------+------------+-------------+ 3 NULL NULL ([mold]) Class: Transformational function - Generic Initializes a pointer as disassociated when it is declared. Argument "mold" is optional and must be a pointer; it can be of any type. The status of the pointer can be associated, disassociated, or undefined. If the pointer's status is associated, the target does not have to be defined with a value. The result type is the same as "mold", if present. Otherwise, the type (and rank) is determined by the pointer that becomes associated with the result: If NULL () Appears... Type is Determined From... ------------------------ ----------------------------------- Right side of pointer The pointer on the left side assignment Initialization for an The object object in a declaration Default initialization The component for a component In a structure constructor The corresponding component As an actual argument The corresponding dummy argument In a DATA statement The corresponding pointer object It returns a disassociated pointer. Example: INTEGER, POINTER :: POINT1 => NULL() This statement defines the initial association status of POINT1 to be disassociated. 3 NUMBER_OF_PROCESSORS NUMBER_OF_PROCESSORS ([dim]) Class: Inquiry function - Specific Returns the total number of processors (peers) available to the program along an optional dimension of the processor array. The "dim" has no effect on single-processor workstations. The result is of type default integer. On single-processor workstations, the result is always 1. This function cannot be passed as an actual argument. 3 NWORKERS NWORKERS () Class: Elemental function - Specific Returns an INTEGER*4 value that represents the total number of processes executing an application. However, since VSI Fortran only does serial processing, NWORKERS always returns 1. NWORKERS is provided for compatibility with HP Fortran 77 for OpenVMS VAX systems. This function cannot be passed as an actual argument. 3 PACK PACK (array, mask [,vector]) Class: Transformational function - Generic Takes elements from an array and packs them into a rank-one array under the control of a mask. The "mask" must be of logical type and conformable with "array". The "vector" must be a rank-one array with the same type and type parameters as "array". Its size must be at least t, where "t" is the number of true elements in "mask". If "mask" is a scalar with value true, "vector" must have at least as many elements as there are in "array". Elements in "vector" are used to fill out the result array if there are not enough elements selected by "mask." The result is a rank-one array with the same type and type parameters as "array". If "vector" is present, the size of the result is that of "vector". Otherwise, the size of the result is the number of true elements in "mask", or the number of elements in "array" (if "mask" is a scalar with value true). Elements in "array" are processed in array element order to form the result array. Element i of the result is the element of "array" that corresponds to the ith true element of "mask". If "vector" is present and has more elements than there are true values in "mask", any result elements that are empty (because they were not true according to "mask") are set to the corresponding values in "vector". Examples: Consider that N is the array |0 8 0|. |0 0 0| |7 0 0| PACK (N, MASK=N .NE. 0, VECTOR= (/1, 3, 5, 9, 11, 13/) produces the result (7, 8, 5, 9, 11, 13). PACK (N, MASK=N .NE. 0) produces the result (7, 8). 3 POPCNT POPCNT (integer) Class: Elemental function - Generic A function that returns the number of 1 bits in the binary representation of the integer argument. The result type is the same as the argument. Example: If the value of I is B'0...00011010110', the value of POPCNT(I) is 5. 3 POPPAR POPPAR (integer*8) Class: Elemental function - Generic A function that returns parity of an integer. The result value is one if there are an odd number of 1 bits in the binary representation of the integer argument and zero if there are an even number. The result type is the same as the argument. Example: If the value of I is B'0...00011010110', the value of POPPAR(I) is 1. 3 PRECISION PRECISION (number) Class: Inquiry function - Generic Returns the decimal precision in the model representing real numbers with the same kind type parameter as the argument. The "number" can be of real or complex type; it can be scalar or array valued. The result is a scalar of type default integer. The result has the value INT((DIGITS("number") - 1) * LOG10(RADIX("number"))). If RADIX("number") is an integral power of 10, 1 is added to the result. Example: If X is a REAL*4 value, PRECISION (X) has the value 6. The value 6 is derived from INT ((24-1) * LOG10 (2.)) = INT (6.92...). For more information on the model for REAL*4, see the HP Fortran for OpenVMS Language Reference Manual. 3 PRESENT PRESENT (opt-argument) Class: Inquiry function - Generic Returns whether or not an optional dummy argument is present (has an associated actual argument). Example: Consider the following: SUBROUTINE CHECK (X, Y) REAL X, Z REAL, OPTIONAL :: Y ... IF (PRESENT (Y)) THEN Z = Y ELSE Z = X * 2 END IF END ... CALL CHECK (15.0, 12.0) ! Causes B to be set to 12.0 CALL CHECK (15.0) ! Causes B to be set to 30.0 3 PROCESSORS_SHAPE PROCESSORS_SHAPE () Class: Inquiry function - Specific Returns the shape of an implementation-dependent hardware processor array. If used in a program compiled for a HP PSE cluster, the result is a rank-one array of type default integer containing the number of processors (peers) available to the program. Otherwise, the result is always a rank-one array of size zero. This function cannot be passed as an actual argument. 3 PRODUCT PRODUCT (array, [,dim] [,mask]) Class: Transformational function - Generic Returns the product of all the elements in an entire array or in a specified dimension of an array. The "array" can be of integer or real type. The "dim" is optional and must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" is optional and must be a logical array that is conformable with "array". The result is the same data type as "array". The result is a scalar if "dim" is absent or "array" has rank one. Otherwise, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". If only "array" appears, the result is the product of all elements of "array". If "array" has size zero, the result is 1. If "array" and "mask" both appear, the result is the product of all elements of "array" corresponding to true elements of "mask". If "array" has size zero, or every element of "mask" has the value .FALSE., the result is 1. If "dim" also appears and "array" has rank one, the value is the same as PRODUCT (array [,mask=mask]). Otherwise, the value of element (s1, s2,..., s"dim"-1, s"dim"+1,..., sn) of PRODUCT (array, dim, [,mask]) is equal to PRODUCT (array (s1, s2,..., s"dim"-1, :, s"dim"+1, ..., sn)) [mask=mask (s1, s2, ..., s"dim"-1, :, s "dim"+1 ..., sn)]. Examples: PRODUCT ((/2, 3, 4/)) and PRODUCT ((/2, 3, 4/), DIM=1) returns the value 24. PRODUCT (C, MASK=C .LT. 0.0) returns the product of the negative elements of C. Consider that A is the array |1 4 7|. |2 3 5| PRODUCT (A, DIM=1) returns the value (2, 12, 35). PRODUCT (A, DIM=2) returns the value (28, 30). 3 QCMPLX QCMPLX (number [,number]) Class: Elemental function - Generic Converts the argument(s) into a COMPLEX*32 value. If one argument is specified, the argument is converted into the real part of the complex value and the imaginary part becomes zero. If two arguments are specified, the first argument is converted into the real part of the complex value and the second argument is converted into the imaginary part of the complex value. If two arguments are specified, they must have the same data type. +-------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +-------+----------+----------+------------+-------------+ | 1,2 | QCMPLX | -- | INTEGER*1 | COMPLEX*32 | | 1,2 | | -- | INTEGER*2 | COMPLEX*32 | | 1,2 | | -- | INTEGER*4 | COMPLEX*32 | | 1,2 | | -- | INTEGER*8 | COMPLEX*32 | | 1,2 | | -- | REAL*4 | COMPLEX*32 | | 1,2 | | -- | REAL*8 | COMPLEX*32 | | 1,2 | | -- | REAL*16 | COMPLEX*32 | | 1 | | -- | COMPLEX*8 | COMPLEX*32 | | 1 | | -- | COMPLEX*16 | COMPLEX*32 | | 1 | | -- | COMPLEX*32 | COMPLEX*32 | +-------+----------+----------+------------+-------------+ This function cannot be passed as an actual argument. 3 QEXT QEXT (number) Class: Elemental function - Generic Converts the argument to a REAL*16 value. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | QEXT | -- | INTEGER*2 | REAL*16 | | | | -- | INTEGER*4 | REAL*16 | | | | QEXT | REAL*4 | REAL*16 | | | | QEXTD | REAL*8 | REAL*16 | | | | -- | REAL*16 | REAL*16 | | | | -- | COMPLEX*8 | REAL*16 | | | | -- | COMPLEX*16 | REAL*16 | | | | -- | COMPLEX*32 | REAL*16 | +------+---------+----------+------------+-------------+ These functions cannot be passed as actual arguments. 3 QFLOAT QFLOAT (integer) Class: Elemental function - Generic Converts an integer value to a REAL*16 value. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | QFLOAT | -- | INTEGER*2 | REAL*16 | | | | -- | INTEGER*4 | REAL*16 | +------+---------+----------+------------+-------------+ 3 QREAL QREAL (dbl-complex-number) Class: Elemental function - Specific Converts the real part of a COMPLEX*32 argument to REAL*16 type. This function cannot be passed as an actual argument. 3 RADIX RADIX (number) Class: Inquiry function - Generic Returns the base of the model representing numbers of the same type and kind type parameter as the argument. The "number" can be of integer or real type; it can be scalar or array valued. The result is a scalar of type default integer. For an integer argument, the result has the value "r" as defined in the integer model. For a real argument, the result has the value "b" as defined in the real model. For information on integer and real models, see the HP Fortran for OpenVMS Language Reference Manual. Examples: If X is a REAL*4 value, RADIX (X) has the value 2. 3 RAN RAN (seed) Class: Nonelemental function - Specific Generates a general random number of the multiplicative congruential type. This function returns a different REAL*4 number between 0.0 (inclusive) and 1.0 (exclusive) each time it is invoked. The argument must be an INTEGER*4 variable or array element. For best results, you should initialize the argument to a large, odd value before invoking RAN the first time. To generate different sets of random values, initialize the seed to a different value on each run. Do not modify the seed during a run. This function cannot be passed as an actual argument. 3 RANDOM_NUMBER RANDOM_NUMBER (real-number) Class: Subroutine Returns one pseudorandom number (or an array of such numbers). The argument is set to contain pseudorandom numbers from the uniform distribution within the range 0 <= x < 1. Examples: Consider the following: REAL Y, Z (5, 5) ! Initialize Y with a pseudorandom number CALL RANDOM_NUMBER (HARVEST = Y) CALL RANDOM_NUMBER (Z) Y and Z contain uniformly distributed random numbers. 3 RANDOM_SEED RANDOM_SEED ([size] [, put] [, get]) Class: Subroutine Changes or queries the seed (starting point) for the pseudorandom number generator used by RANDOM_NUMBER. No more than one argument can be specified. If an argument is specified, it must be of default integer type. The "size" must be scalar; it is set to the number of integers (N) that the processor uses to hold the value of the seed. The "put" must be an array of rank 1 and size >= N; it is used to reset the value of the seed. The "get" must be an array of rank 1 and size >= N; it is set to the current value of the seed. If no argument is specified, a random number based on the date and time is assigned to the seed. Example: Consider the following: CALL RANDOM_SEED ( ) ! Processor reinitializes the ! seed randomly from the date ! and time CALL RANDOM_SEED (SIZE = M) ! Sets M to N CALL RANDOM_SEED (PUT = SEED (1 : M)) ! Sets user seed CALL RANDOM_SEED (GET = OLD (1 : M)) ! Reads current seed 3 RANDU RANDU (integer-1, integer-2, store) Class: Subroutine Computes a pseudorandom number as a single-precision value. The integer arguments must be INTEGER(KIND=2) variables or array elements that contain the seed for computing the random number. The new seed for computing the next random number is stored into these integer arguments. The "store" is a REAL(KIND=4) variable or array element where the computed random number is returned. The result is returned in "store", which must be of type REAL(KIND=4). The result value is a pseudorandom number in the range 0.0 to 1.0. The algorithm for computing the random number value is based on the values for "integer-1" and "integer-2". Example: Consider the following: REAL X INTEGER(2) I, J ... CALL RANDU (I, J, X) If I and J are values 4 and 6, X stores the value 5.4932479E-04. 3 RANGE RANGE (number) Class: Inquiry function - Generic Returns the decimal exponent range in the model representing numbers with the same kind type parameter as the argument. The argument can be of type integer, real, or complex. It can be scalar or array valued. The result is a scalar of type default integer. For an integer argument, the result has the value INT (LOG10 ( HUGE("number") )). For a real or complex argument, the result has the value INT(MIN (LOG10( HUGE("number") ), -LOG10( TINY("number") ))). For information on the integer and real models, see the HP Fortran for OpenVMS Language Reference Manual. Example: If X is a REAL*4 value, RANGE (X) has the value 37. (HUGE(X) = (1 - 2**-24) x 2**128 and TINY(X) = 2**-126.) 3 REAL REAL (number [,kind]) Class: Elemental function - Generic Converts the argument to a real value. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | REAL | -- | INTEGER*1 | REAL*4 | | | | FLOATI | INTEGER*2 | REAL*4 | | |see note1| FLOAT | INTEGER*4 | REAL*4 | | | | REAL | INTEGER*4 | REAL*4 | | | | FLOATK | INTEGER*8 | REAL*4 | | | | -- | REAL*4 | REAL*4 | | |see note2| SNGL | REAL*8 | REAL*4 | | | | SNGLQ | REAL*16 | REAL*4 | | | | -- | COMPLEX*8 | REAL*4 | | | | -- | COMPLEX*16 | REAL*4 | +------+---------+----------+------------+-------------+ Note1: Or FLOATJ. For compatibility with older versions of Fortran, FLOAT can also be specified as a generic function. Note2: For compatibility with older versions of Fortran, SNGL can also be specified as a generic function. The generic SNGL includes specific function REAL, which takes a REAL*4 argument and produces a REAL*4 result. These functions cannot be passed as actual arguments. REAL is also a specific name for a function that returns the real part of a complex number. The argument must be a COMPLEX*8 data type. The result is a REAL*4 data type. The setting of compiler options specifying real size can affect FLOAT, REAL, and SNGL. 3 REPEAT REPEAT (string, ncopies) Class: Transformational function - Generic Concatenates several copies of a string. The kind type parameter is the same as "string". The value of the result is the concatenation of "ncopies" copies of "string". Examples: REPEAT ('S', 3) has the value SSS. REPEAT ('ABC', 0) has the value of a zero-length string. 3 RESHAPE RESHAPE (source, shape [,pad] [,order]) Class: Transformational function - Generic Constructs an array with a different shape from the argument "source" array. The size of the "source" array must be >= PRODUCT(shape) if "pad" is absent or has size zero. The "shape" must be an integer array of up to 7 elements, with rank one and constant size. Its size must be positive; its elements must not have negative values. The "pad" must be an array of the same type and kind type parameters as "source". It is used to fill in extra values if the result array is larger than "source". The "order" must be an integer array with the same shape as "shape". The result is an array of shape "shape" with the same type and kind type parameters as "source". The size of the result is the product of the values of the elements of "shape". In the result array, the array elements of "source" are placed in the order of dimensions specified by "order". If "order" is omitted, the array elements are placed in normal array element order. The array elements of "source" are followed (if necessary) by the array elements of "pad" in array element order. If necessary, additional copies of "pad" follow until all the elements of the result array have values. Examples: RESHAPE ((/3, 4, 5, 6, 7, 8/), (/2, 3/)) has the value |3 5 7|. |4 6 8|. RESHAPE ((/3, 4, 5, 6, 7, 8/), (/2, 4/), (/1, 1/), (/2, 1/)) has the value |3 4 5 6|. |7 8 1 1| 3 RRSPACING RRSPACING (real-number) Class: Elemental function - Generic Returns the reciprocal of the relative spacing of model numbers near the argument value. The result type is the same as the argument. For information on the model for real numbers, see the HP Fortran for OpenVMS Language Reference Manual. Example: If -3.0 is a REAL*4 value, RRSPACING (-3.0) has the value 0.75 x 2**24. 3 SCALE SCALE (real-number, integer) Class: Elemental function - Generic Returns the value of the exponent part (of the model for the argument) changed by a specified value. The result type is the same as the "real-number" argument. For information on the real model, see the HP Fortran for OpenVMS Language Reference Manual. Examples: If 3.0 is a REAL*4 value, SCALE (3.0, 2) has the value 12.0 and SCALE (3.0, 3) has the value 24.0. 3 SCAN SCAN (string, set [,back] [,kind]) Class: Elemental function - Generic Scans a string for any character in a set of characters. The "set" is of type character (the same type as "string"). The "back" is of type logical. The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "back" is absent (or is present with the value false) and "string" has at least one character that is in "set", the value of the result is the position of the leftmost character of "string" that is in "set". If "back" is present with the value true and "string" has at least one character that is in "set", the value of the result is the position of the rightmost character of "string" that is in "set". If no character of "string" is in "set" or the length of "string" or "set" is zero, the value of the result is zero. Examples: SCAN ('ASTRING', 'ST') has the value 2. SCAN ('ASTRING', 'ST', BACK=.TRUE.) has the value 3. SCAN ('ASTRING', 'CD') has the value zero. 3 SECNDS SECNDS (real-number) Class: Elemental function - Specific Returns the number of seconds since midnight minus the value of the argument. The argument must be a REAL*4 data type. The return value is a REAL*4 data type. The time returned is accurate to .01 seconds. This function cannot be passed as an actual argument. 3 SELECTED_INT_KIND SELECTED_INT_KIND (integer) Class: Transformational function - Generic Returns the value of the kind type parameter of an integer data type. The result is a scalar of type default integer. Example: SELECTED_INT_KIND (6) = 4 3 SELECTED_REAL_KIND SELECTED_REAL_KIND ([integer-p] [,integer-r]) Class: Transformational function - Generic Returns the value of the kind type parameter of a real data type. The "integer-p" specifies decimal precision. The "integer-r" specifies decimal exponent range. At least one argument must be specified. The result is a scalar of type default integer. Example: SELECTED_REAL_KIND (6, 70) = 8 3 SET_EXPONENT SET_EXPONENT (real-number, integer) Class: Elemental function - Generic Returns a copy of "real-number" with the value of the exponent part (of the model for the argument) set to a specified value. The result type is the same as the "real-number" argument. For information on the real model,see the HP Fortran for OpenVMS Language Reference Manual. Example: If 3.0 is a REAL*4 value, SET_EXPONENT (3.0, 1) has the value 1.5. 3 SHAPE SHAPE (source [,kind]) Class: Inquiry function - Generic Returns the shape of an array or scalar argument. The "source" must not be an assumed-size array, a disassociated pointer, or an allocatable array that is not allocated. The "kind" must be a scalar integer initialization expression. The result is a rank-one integer array whose size is equal to the rank of "source". If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. The value of the result is the shape of "source". The setting of compiler options that specify integer size can affect the result of this function. Examples: SHAPE (2) has the value of a rank-one array of size zero. If B is declared as B(2:4, -3:1), then SHAPE (B) has the value (3, 5). 3 SIGN SIGN (arg1, sign-arg2) Class: Elemental function - Generic Assigns the sign of the second argument to the absolute value of the first. If the second argument is of type real and zero, the value of the result is |arg1|. However, if the processor can distinguish between positive and negative real zero and the compiler option /ASSUME=MINUS0 is specified, the following occurs: o If the second argument is positive real zero, the value of the result is |arg1|. o If the second argument is negative real zero, the value of the result is -|arg1|. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 2 | SIGN | -- | INTEGER*1 | INTEGER*1 | | | | IISIGN | INTEGER*2 | INTEGER*2 | | |see note | ISIGN | INTEGER*4 | INTEGER*4 | | | | KISIGN | INTEGER*8 | INTEGER*8 | | | | SIGN | REAL*4 | REAL*4 | | | | DSIGN | REAL*8 | REAL*8 | | | | QSIGN | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ NOTE: Or JISIGN. For compatibility with older versions of Fortran, ISIGN can also be specified as a generic function. 3 SIN SIN (number) Class: Elemental function - Generic Returns the sine of the argument. The argument must be in radians; it is treated modulo 2*pi. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | SIN | SIN | REAL*4 | REAL*4 | | | | DSIN | REAL*8 | REAL*8 | | | | QSIN | REAL*16 | REAL*16 | | |see note | CSIN | COMPLEX*8 | COMPLEX*8 | | | | CDSIN | COMPLEX*16 | COMPLEX*16 | | | | ZSIN | COMPLEX*16 | COMPLEX*16 | | | | CQSIN | COMPLEX*32 | COMPLEX*16 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect CSIN. 3 SIND SIND (number) Class: Elemental function - Generic Returns the sine of the argument. The argument must be in degrees; it is treated modulo 360. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | SIND | SIND | REAL*4 | REAL*4 | | | | DSIND | REAL*8 | REAL*8 | | | | QSIND | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 SINH SINH (number) Class: Elemental function - Generic Returns the hyperbolic sine of the argument. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | SINH | SINH | REAL*4 | REAL*4 | | | | DSINH | REAL*8 | REAL*8 | | | | QSINH | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 SIZE SIZE (array [,dim] [,kind]) Class: Inquiry function - Generic Returns the total number of elements in an array, or the extent of an array along a specified dimension. The "array" must not be a disassociated pointer or an allocatable array that is not allocated. It can be an assumed-size array if "dim" is present with a value less than the rank of "array". The "dim" must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "kind" must be a scalar integer initialization expression. The result is a scalar of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is present, the result is the extent of dimension "dim" in "array"; otherwise, the result is the total number of elements in "array". The setting of compiler options that specify integer size can affect the result of this function. Example: If B is declared as B(2:4, -3:1), then SIZE (B, DIM=2) has the value 5 and SIZE (B) has the value 15. 3 SIZEOF SIZEOF (arg) Class: Elemental function - Specific Returns the number of bytes of storage used by the argument. +------+---------+----------+------------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------------+-------------+ | 1 | -- | SIZEOF | Anything with a | INTEGER*8 | | | | -- | valid data type, | | | | | | except assumed- | | | | | | size arrays. | | +------+---------+----------+------------------+-------------+ This function cannot be passed as an actual argument. 3 SPACING SPACING (real-number) Class: Elemental function - Generic Returns the absolute spacing of model numbers near the argument value. The result type is the same as the argument. Example: If 3.0 is a REAL*4 value, SPACING (3.0) has the value 2**-22. 3 SPREAD SPREAD (source, dim, ncopies) Class: Transformational function - Generic Creates a replicated array with an added dimension by making copies of existing elements along a specified dimension. The "source" can be an array or scalar. The "dim" is a scalar of type integer. It must have a value in the range 1 to n + 1(inclusive), where "n" is the rank of "source". The integer scalar "ncopies" becomes the extent of the added dimension in the result. The result is an array of the same type as "source" and of rank that is one greater than "source". If "source" is an "array", each array element in dimension "dim" of the result is equal to the corresponding array element in "source". If "source" is a scalar, the result is a rank-one array with "ncopies" elements, each with the value "source". Examples: SPREAD ("B", 1, 4) is the character array (/"B", "B", "B", "B"/). B is the array (3, 4, 5) and NC has the value 4. SPREAD (B, DIM=1, NCOPIES=NC) produces the array |3 4 5| |3 4 5|. |3 4 5| |3 4 5| SPREAD (B, DIM=2, NCOPIES=NC) produces the array |3 3 3 3| |4 4 4 4|. |5 5 5 5| 3 SNGL See the REAL function. 3 SQRT SQRT (number) Class: Elemental function - Generic Returns the square root of the argument. If the argument is real, its value must be greater than or equal to zero. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | SQRT | SQRT | REAL*4 | REAL*4 | | | | DSQRT | REAL*8 | REAL*8 | | | | QSQRT | REAL*16 | REAL*16 | | |see note | CSQRT | COMPLEX*8 | COMPLEX*8 | | | | CDSQRT | COMPLEX*16 | COMPLEX*8 | | | | ZSQRT | COMPLEX*16 | COMPLEX*8 | | | | CQSQRT | COMPLEX*32 | COMPLEX*8 | +------+---------+----------+------------+-------------+ Note: The setting of compiler options specifying real size can affect CSQRT. The result of CSQRT, CDSQRT, and ZSQRT is the principal value, with the real part greater than or equal to zero. If the real part is zero, the result is the principal value, with the imaginary part greater than or equal to zero. 3 SUM SUM (array [,dim] [,mask]) Class: Transformational function - Generic Returns the sum of all the elements in an entire array or in a specified dimension of an array. The "array" can be of integer or real type. The "dim" is optional and must be a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "mask" is optional and must be a logical array that is conformable with "array". The result is the same data type as "array". The result is a scalar if "dim" is absent or "array" has rank one. Otherwise, the result is an array with rank that is one less than "array", and shape (d1, d2,..., d"dim"-1, d"dim"+1,..., dn), where (d1, d2,..., dn) is the shape of "array". If only "array" appears, the result is the sum of all elements of "array". If "array" has size zero, the result is zero. If "array" and "mask" both appear, the result is the sum of all elements of "array" corresponding to true elements of "mask". If "array" has size zero, or every element of "mask" has the value .FALSE., the result is zero. If "dim" also appears and "array" has rank one, the value is the same as SUM (array [,mask=mask]). Otherwise, the value of element (s1, s2,..., s"dim"-1, s"dim"+1,..., sn) of SUM (array, dim, [,mask]) is equal to SUM (array (s1, s2,..., s"dim"-1, :, s"dim"+1, ..., sn)) [mask=mask (s1, s2, ..., s"dim"-1, :, s "dim"+1 ..., sn)]. Examples: SUM ((/2, 3, 4/)) and SUM ((/2, 3, 4/), DIM=1) returns the value 9. SUM (B, MASK=B .LT. 0.0) returns the arithmetic sum of the negative elements of B. Consider that C is the array: |1 2 3| |4 5 6|. SUM (C, DIM=1) returns the value (5, 7, 9). SUM (C, DIM=2) returns the value (6, 15). 3 SYSTEM_CLOCK SYSTEM_CLOCK ([count] [,count-rate] [,count-max]) Class: Subroutine Returns integer data from a real-time clock. All arguments are scalar of type default integer. The "clock" is set to a value based on the current value of the processor clock. The value is increased by one for each clock count until the value "countmax" is reached, and is reset to zero at the next count. ("count" lies in the range 0 to "countmax".) The "count-rate" is set to the number of processor clock counts per second modified by the kind of "count-rate." See the HP Fortran for OpenVMS Language Reference Manual. SYSTEM_CLOCK returns the number of seconds from 00:00 Coordinated Universal Time (CUT) 1 JAN 1970. The number is returned with no bias. To get the elapsed time, you must call SYSTEM_CLOCK twice, and subtract the starting time value from the ending time value. Examples: Consider the following: INTEGER(2) :: IC2, CRATE2, CMAX2 INTEGER(4) :: IC4, CRATE4, CMAX4 CALL SYSTEM_CLOCK(COUNT=IC2, COUNT_RATE=CRATE2, COUNT_MAX=CMAX2) CALL SYSTEM_CLOCK(COUNT=IC4, COUNT_RATE=CRATE4, COUNT_MAX=CMAX4) PRINT *, IC2, CRATE2, CMAX2 PRINT *, IC4, CRATE4, CMAX4 END This program was run on Thursday Dec 11, 1997 at 14:23:55 EST and produced the following output: 13880 1000 32767 1129498807 10000 2147483647 3 TAN TAN (real-number) Class: Elemental function - Generic Returns the tangent of the argument. The argument must be in radians; it is treated modulo 2*pi. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | TAN | TAN | REAL*4 | REAL*4 | | | | DTAN | REAL*8 | REAL*8 | | | | QTAN | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 TAND TAND (real-number) Class: Elemental function - Generic Returns the tangent of the argument. The argument must be in degrees; it is treated modulo 360. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | TAND | TAND | REAL*4 | REAL*4 | | | | DTAND | REAL*8 | REAL*8 | | | | QTAND | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 TANH TANH (real-number) Class: Elemental function - Generic Returns the hyperbolic tangent of the argument. +------+---------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+---------+----------+------------+-------------+ | 1 | TANH | TANH | REAL*4 | REAL*4 | | | | DTANH | REAL*8 | REAL*8 | | | | QTANH | REAL*16 | REAL*16 | +------+---------+----------+------------+-------------+ 3 TIME TIME (buf) Class: Elemental function Places the current time in 24-hour ASCII format in the argument. The time is returned as an 8-byte ASCII character string having the following form: hh:mm:ss A 24-hour clock is used. The "buf" is an 8-byte variable, array, array element, or character substring. If "buf" is numeric type and smaller than 8 bytes, data corruption can occur. If "buf" is character type, its associated length is passed to the subroutine. If "buf" is smaller than 8 bytes, the subroutine truncates the date to fit in the specified length. Note that if a CHARACTER array is passed, the subroutine stores the time in the first array element, using the element length, not the length of the entire array. For example, consider the following: CHARACTER*1 HOUR(8) ... CALL TIME(HOUR) The length of the first array element in CHARACTER array HOUR is passed to the TIME subroutine. The subroutine then truncates the time to fit into the one-character element, producing an incorrect result. 3 TINY TINY (real-number) Class: Inquiry function - Generic Returns the smallest number in the model representing the same type and kind type parameter as the argument. The argument must be of type real; it can be scalar or array valued. The result type is scalar of the same type and kind type parameter as the argument. The real model is described in the HP Fortran for OpenVMS Language Reference Manual. Examples: If X is of type REAL*4, TINY (X) has the value 2**-126. 3 TRAILZ TRAILZ (integer) Class: Elemental function - Generic Returns the number of trailing zeros in the binary representation of the integer argument. The result type is the same as the argument. Example: Consider the following: INTEGER*8 J, TWO PARAMETER (TWO=2) DO J= -1, 40 TYPE *, TRAILZ(TWO**J) ! Prints 64, then 0 up to ENDDO ! 40 (trailing zeros) END 3 TRANSFER TRANSFER (source, mold [,size]) Class: Transformational function - Generic Copies the bit pattern of "source" and interprets it according to the type and kind type parameters of "mold". The "source" and "mold" can be of any type; they can be scalar or array valued. The "mold" provides the type characteristics (not a value) for the result. The "size" must be scalar of type integer; it provides the number of elements for the output result. If "mold" is a scalar and "size" is absent, the result is a scalar. If "mold" is an array and "size" is absent, the result is a rank-one array. Its size is the smallest that is possible to hold all of "source". If "size" is present, the result is a rank-one array of size "size". If the physical representation of the result is larger than "source", the result contains "source"'s bit pattern in its right-most bits; the left-most bits of the result are undefined. If the physical representation of the result is smaller than "source", the result contains the right-most bits of "source"'s bit pattern. Examples: TRANSFER (1082130432, 0.0) has the value 4.0 (on processors that represent the values 4.0 and 1082130432 as the string of binary digits 0100 0000 1000 0000 0000 0000 0000 0000). TRANSFER ((/2.2, 3.3, 4.4/), ((0.0, 0.0))) results in a scalar whose value is (2.2, 3.3). TRANSFER ((/2.2, 3.3, 4.4/), (/(0.0, 0.0)/)) results in a complex rank-one array of length 2. Its first element is (2.2,3.3) and its second element has a real part with the value 4.4 and an undefined imaginary part. TRANSFER ((/2.2, 3.3, 4.4/), (/(0.0, 0.0)/), 1) results in a complex rank-one array having one element with the value (2.2, 3.3). 3 TRANSPOSE TRANSPOSE (matrix) Class: Transformational function - Generic Transposes an array of rank two (can be any data type). The result is a rank-two array with the same type and kind type parameters as "matrix". Its shape is (n, m), where (m, n) is the shape of "matrix". For example, if the shape of "matrix" is (4,6), the shape of the result is (6,4). Element (i, j) of the result has the value matrix(j, i), where "i" is in the range 1 to n, and "j" is in the range 1 to m. Examples: Consider that B is the array: |2 3 4| |5 6 7|. |8 9 1| TRANSPOSE (B) has the value |2 5 8| |3 6 9|. |4 7 1| 3 TRIM TRIM (string) Class: Transformational function - Generic Returns the argument with trailing blanks removed. The "string" is a scalar of type character. The result is of type character with the same kind type parameter as "string". Its length is the length of "string" minus the number of trailing blanks in "string". The value of the result is the same as "string", except any trailing blanks are removed. If "string" contains only blank characters, the result has zero length. Examples: TRIM (' NAME ') has the value ' NAME'. TRIM (' C D ') has the value ' C D'. 3 UBOUND UBOUND (array [,dim] [,kind]) Class: Inquiry function - Generic Returns the upper bounds for all dimensions of an array, or the upper bound for a specified dimension. The "array" cannot be an allocatable array that is not allocated, or a disassociated pointer. The "dim" is a scalar integer with a value in the range 1 to n, where "n" is the rank of "array". The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "dim" is present, the result is a scalar. Otherwise, the result is a rank-one array with one element for each dimension of "array". Each element in the result corresponds to a dimension of "array". If "array" is an array section or an array expression that is not a whole array or array structure component, UBOUND (array,dim) has a value equal to the number of elements in the given dimension. The setting of compiler options that specify integer size can affect the result of this function. Examples: Consider the following: REAL ARRAY_A (1:3, 5:8) REAL ARRAY_B (2:8, -3:20) UBOUND (ARRAY_A) is (3, 8). UBOUND (ARRAY_A, DIM=2) is 8. UBOUND (ARRAY_B) is (8, 20). UBOUND (ARRAY_B (5:8, :)) is (4,24) because the number of elements is significant for array section arguments. 3 UNPACK UNPACK (vector, mask, field) Class: Transformational function - Generic Takes elements from a rank-one array and unpacks them into another (possibly larger) array under the control of a mask. The "vector" must be a rank-one array of any type. Its size must be at least t, where "t" is the number of true elements in "mask". The "mask" must be of logical type; it determines where elements of "vector" are placed when they are unpacked. The "field" must be of the same type and type parameters as "vector" and conformable with "mask". Elements in "field" are inserted into the result array when the corresponding "mask" element has the value false. The result is an array with the same shape as "mask", and the same type and type parameters as "vector". Elements in the result array are filled in array element order. If element i of the result is true, the corresponding element of the result is filled by the next element in "vector". Examples: Consider that N is the array |0 0 1|, P is the array (2, 3, 4, 5), |1 0 1| |1 0 0| and Q is the array |T F F| |F T F|. |T T F| UNPACK (P, MASK=Q, FIELD=N) produces the result |2 0 1| |1 4 1|. |3 5 0| UNPACK (P, MASK=Q, FIELD=1) produces the result |2 1 1| |1 4 1|. |3 5 1| 3 VERIFY VERIFY (string, set [,back] [,kind]) Class: Elemental function - Generic Verifies that a set of characters contains all the characters in a string by identifying the first character in the string that is not in the set. The "set" must be of type character with the same kind type parameter as "string". The "back" must be of type logical. The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. If "back" is absent (or is present with the value false) and "string" has at least one character that is not in "set", the value of the result is the position of the leftmost character of "string" that is not in "set". If "back" is present with the value true and "string" has at least one character that is not in "set", the value of the result is the position of the rightmost character of "string" that is not in "set". If each character of "string" is in "set" or the length of "string" is zero, the value of the result is zero. Examples: VERIFY ('CDDDC', 'C') has the value 2. VERIFY ('CDDDC', 'C', BACK=.TRUE.) has the value 4. VERIFY ('CDDDC', 'CD') has the value zero. 3 ZEXT ZEXT (integer [,kind]) Class: Elemental function - Generic Returns the value of the argument, zero extended. The "kind" must be a scalar integer initialization expression. The result is of type integer. If "kind" is present, the kind parameter of the result is that specified by "kind"; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined. +------+----------+----------+------------+-------------+ | Args | Generic | Specific | Argument | Result Type | +------+----------+----------+------------+-------------+ | 1 | ZEXT | IZEXT | LOGICAL*1 | INTEGER*2 | | | | -- | LOGICAL*2 | INTEGER*2 | | | | -- | INTEGER*1 | INTEGER*2 | | | | -- | INTEGER*2 | INTEGER*2 | | | | JZEXT | LOGICAL*1 | INTEGER*4 | | | | -- | LOGICAL*2 | INTEGER*4 | | | | -- | LOGICAL*4 | INTEGER*4 | | | | -- | INTEGER*1 | INTEGER*4 | | | | -- | INTEGER*2 | INTEGER*4 | | | | -- | INTEGER*4 | INTEGER*4 | | | | KZEXT | LOGICAL*1 | INTEGER*8 | | | | -- | LOGICAL*2 | INTEGER*8 | | | | -- | LOGICAL*4 | INTEGER*8 | | | | -- | LOGICAL*8 | INTEGER*8 | | | | -- | INTEGER*1 | INTEGER*8 | | | | -- | INTEGER*2 | INTEGER*8 | | | | -- | INTEGER*4 | INTEGER*8 | | | | -- | INTEGER*8 | INTEGER*8 | +------+----------+----------+------------+-------------+ The setting of compiler options specifying integer size can affect ZEXT. 2 Names Names identify entities within a Fortran program unit (such as variables, function results, common blocks, named constants, procedures, program units, namelist groups, and dummy arguments). In FORTRAN 77, names were called "symbolic names". A name can contain letters, digits, underscores (_), and the dollar sign ($) special character. The first character must be a letter or a dollar sign. In Fortran 95/90, a name can contain up to 31 characters. HP Fortran allows names up to 63 characters. The length of a module name (in MODULE and USE statements) may be restricted by your file system. Note: Be careful when defining names that contain dollar signs. Naming conventions reserve names containing dollar signs to those created by HP. In an executable program, the names of program units, external procedures, common blocks, and modules are global and must be unique in the entire program. 2 Run_Time_Messages Errors that occur during execution of your program are reported by diagnostic messages from the Run-Time Library. These messages can result from hardware conditions, file system errors, errors detected by RMS, errors that occur during transfer of data between the program and an internal record, computations that cause overflow or underflow, incorrect calls to the Run-Time Library, problems in array descriptions, and conditions detected by the operating system. This section lists the run-time diagnostic messages without the prefixes FOR, SS, and MTH. For each mnemonic, the following information is provided: the message number, an error code (F for fatal, E for error, and I for information), the message text, and an explanation of the message. 3 ADJARRDIM NUMBER: 93 ERROR CODE: F MESSAGE TEXT: adjustable array dimension error EXPLANATION: Upon entry to a subprogram, one of the following errors was detected during the evaluation of dimensioning information: o An upper-dimension bound was less than a lower-dimension bound. o The dimensions implied an array that was larger than addressable memory. 3 ARRSIZEOVF NUMBER: 179 ERROR CODE: F MESSAGE TEXT: Cannot allocate array - overflow on array size calculation EXPLANATION: An attempt to dynamically allocate storage for an array failed because the required storage size exceeds addressable memory. This error is not returned by IOSTAT. However, this error can be returned by STAT in an ALLOCATE statement. 3 ASSERTERR NUMBER: 145 ERROR CODE: F MESSAGE TEXT: assertion error EXPLANATION: The HP Fortran RTL encountered an assertion error. Please report the problem to HP. This error is not returned by IOSTAT. 3 ATTACCNON NUMBER: 36 ERROR CODE: F MESSAGE TEXT: attempt to access non-existent record EXPLANATION: One of the following conditions occurred: o A direct access READ, FIND, or DELETE statement attempted to access a nonexistent record from a relative organization file. o A direct access READ or FIND statement attempted to access beyond the end of a sequential organization file. o A keyed access READ statement attempted to access a nonexistent record from an indexed organization file. 3 BACERR NUMBER: 23 ERROR CODE: F MESSAGE TEXT: BACKSPACE error EXPLANATION: One of the following conditions occurred: o The file was not a sequential organization file. o The file was not opened for sequential access. (A unit opened for append access may not be backspaced until a REWIND statement is executed for that unit.) o RMS detected an error condition during execution of a BACKSPACE statement. 3 BUG_CHECK NUMBER: 8 ERROR CODE: F MESSAGE TEXT: internal consistency check failure EXPLANATION: Internal severe error. Please check that the program is correct. Recompile if an error existed in the program. If this error persists, report the problem to HP. 3 CLOERR NUMBER: 28 ERROR CODE: F MESSAGE TEXT: CLOSE error EXPLANATION: An error condition was detected by RMS during execution of a CLOSE statement. 3 DELERR NUMBER: 55 ERROR CODE: F MESSAGE TEXT: DELETE error EXPLANATION: One of the following conditions occurred: o On a direct access DELETE, the file that did not have relative organization. o On a current record DELETE, the file did not have relative or indexed organization, or the file was opened for direct access. o RMS detected an error condition during execution of a DELETE statement. 3 DIRIO_KEY NUMBER: 258 ERROR CODE: F MESSAGE TEXT: direct-access I/O to unit open for keyed access EXPLANATION: The OPEN statement for this unit number specified keyed access and the I/O statement specifies direct access. Check the OPEN statement and make sure the I/O statement uses the correct unit number and type of access. (For more information on statements, see the HP Fortran for OpenVMS Language Reference Manual.) 3 DIV NUMBER: 178 ERROR CODE: F MESSAGE TEXT: Divide by zero EXPLANATION: A floating-point or integer divide-by-zero exception occurred. This error is not returned by IOSTAT. 3 DUPFILSPE NUMBER: 21 ERROR CODE: F MESSAGE TEXT: duplicate file specifications EXPLANATION: Multiple attempts were made to specify file attributes without an intervening close operation. A DEFINE FILE statement was followed by another DEFINE FILE statement or an OPEN statement. 3 ENDDURREA NUMBER: 24 ERROR CODE: F MESSAGE TEXT: end-of-file during read EXPLANATION: One of the following conditions occurred: o An RMS end-of-file condition was encountered during execution of a READ statement that did not contain an END, ERR, or IOSTAT specification. o An end-of-file record written by the ENDFILE statement was encountered during execution of a READ statement that did not contain an END, ERR, or IOSTAT specification. o An attempt was made to read past the end of an internal file character string or array during execution of a READ statement that did not contain an END, ERR, or IOSTAT specification. This error is not returned by IOSTAT. 3 ENDFILERR NUMBER: 33 ERROR CODE: F MESSAGE TEXT: ENDFILE error EXPLANATION: One of the following conditions occurred: o The file was not a sequential organization file with variable-length records. o The file was not opened for sequential, append, or direct access. o An unformatted file did not contain segmented records. o RMS detected an error during execution of an ENDFILE statement. 3 ENDRECDUR NUMBER: 268 ERROR CODE: F MESSAGE TEXT: end of record during read EXPLANATION: An end-of-record condition was encountered during execution of a nonadvancing I/O READ statement that did not specify the EOR branch specifier. This error is not returned by IOSTAT. 3 ERRDURREA NUMBER: 39 ERROR CODE: F MESSAGE TEXT: error during read EXPLANATION: RMS detected an error condition during execution of a READ statement. 3 ERRDURWRI NUMBER: 38 ERROR CODE: F MESSAGE TEXT: error during write EXPLANATION: RMS detected an error condition during execution of a WRITE statement. 3 FILNAMSPE NUMBER: 43 ERROR CODE: F MESSAGE TEXT: file name specification error EXPLANATION: A file-name specification given to an OPEN or INQUIRE statement was not acceptable to RMS. 3 FILNOTFOU NUMBER: 29 ERROR CODE: F MESSAGE TEXT: file not found EXPLANATION: A file with the specified name could not be found during an open operation. 3 FINERR NUMBER: 57 ERROR CODE: F MESSAGE TEXT: FIND error EXPLANATION: RMS detected an error condition during execution of a FIND statement. 3 FLOCONFAI NUMBER: 95 ERROR CODE: E MESSAGE TEXT: floating point conversion failed EXPLANATION: The attempted unformatted read or write of non-native floating-point data failed. One of the following conditions occurred for a non-native floating-point value: o When using VAX data types in memory (/FLOAT=G_FLOAT or /FLOAT=D_FLOAT), the value exceeded the allowable maximum value for the equivalent native format and was set equal to invalid. o When using VAX data types in memory (/FLOAT=G_FLOAT or /FLOAT=D_FLOAT), the value was infinity (plus or minus), Not-a-Number (NaN), or otherwise invalid and was set to invalid. o When using IEEE data types in memory (/FLOAT=IEEE_FLOAT), the value exceeded the allowable maximum value for the equivalent native format and was set equal to infinity (plus or minus). o When using IEEE data types in memory (/FLOAT=IEEE_FLOAT), the value was infinity (plus or minus) and was set to infinity (plus or minus). o When using IEEE data types in memory (/FLOAT=IEEE_FLOAT), the value was invalid and was set to Not-a-Number (NaN). Make sure the correct file was specified. Make sure the record layout matches the format VSI Fortran is expecting. Check that the correct non-native floating-point data format was specified, as described in the HP Fortran for OpenVMS User Manual. This error is not returned by IOSTAT. 3 FLODIV0EXC NUMBER: 299 ERROR CODE: I MESSAGE TEXT: nn divide-by-zero traps EXPLANATION: The total number of floating-point divide-by-zero traps encountered during program execution was nn. This summary message appears at program completion. This error is not returned by IOSTAT. 3 FLOINCEXC NUMBER: 297 ERROR CODE: I MESSAGE TEXT: nn floating invalid traps EXPLANATION: The total number of floating-point invalid data traps encountered during program execution was nn. This summary message appears at program completion. This error is not returned by IOSTAT. 3 FLOINEEXC NUMBER: 296 ERROR CODE: I MESSAGE TEXT: nn floating inexact traps EXPLANATION: The total number of floating-point inexact data traps encountered during program execution was nn. This summary message appears at program completion. This error is not returned by IOSTAT. 3 FLOOVEMAT NUMBER: 88 ERROR CODE: F MESSAGE TEXT: floating overflow in math library EXPLANATION: A floating overflow condition was detected during execution of a math library procedure. 3 FLOOVREXC NUMBER: 298 ERROR CODE: I MESSAGE TEXT: nn floating overflow traps EXPLANATION: The total number of floating-point overflow traps encountered during program execution was nn. This summary message appears at program completion. This error is not returned by IOSTAT. 3 FLOUNDEXC NUMBER: 300 ERROR CODE: I MESSAGE TEXT: nn floating underflow traps EXPLANATION: The total number of floating-point underflow traps encountered during program execution was nn. This summary message appears at program completion. This error is not returned by IOSTAT. 3 FLOUNDMAT NUMBER: 89 ERROR CODE: E MESSAGE TEXT: floating underflow in math library EXPLANATION: A floating underflow condition was detected during execution of a math library procedure. The result returned was zero. 3 FLTDIV NUMBER: 73 ERROR CODE: E MESSAGE TEXT: zero divide EXPLANATION: During a floating-point or decimal arithmetic operation, an attempt was made to divide by 0.0. This error is not returned by IOSTAT. 3 FLTINE NUMBER: 140 ERROR CODE: E MESSAGE TEXT: floating inexact EXPLANATION: A floating-point arithmetic or conversion operation gave a result that differs from the mathematically exact result. This trap is reported if the rounded result of an IEEE operation is not exact. This error is not returned by IOSTAT. 3 FLTINV NUMBER: 65 ERROR CODE: E MESSAGE TEXT: Floating invalid EXPLANATION: During an arithmetic operation, the floating-point values used in a calculation were invalid for the type of operation requested, or invalid exceptional values. For example, this occurs when requesting a log of the floating-point values 0.0 or a negative number. For certain arithmetic expressions, specifying the /CHECK=NOPOWER qualifier can suppress this message. For information on allowing exceptional IEEE values, see the HP Fortran for OpenVMS User Manual. 3 FLTOVF NUMBER: 72 ERROR CODE: E MESSAGE TEXT: arithmetic trap, floating overflow EXPLANATION: During an arithmetic operation, a floating-point value exceeded the largest representable value for that data type. The result returned was the reserved operand, -0 for VAX-format floating-point and NaN for IEEE-format floating-point. This error is not returned by IOSTAT. 3 FLTUND NUMBER: 74 ERROR CODE: E MESSAGE TEXT: Floating underflow EXPLANATION: During an arithmetic operation, a floating-point value became less than the smallest finite value for that data type. The underflowed result was either set to zero or, depending on the value of the /IEEE_MODE qualifier when /FLOAT=IEEE_FLOAT was specified, allowed to gradually underflow. This error is not returned by IOSTAT. For ranges of the various data types, see the Data Representation chapter in the HP Fortran for OpenVMS User Manual. 3 FMTIO_UNF NUMBER: 257 ERROR CODE: F MESSAGE TEXT: formatted I/O to unit open for unformatted transfers EXPLANATION: Attempted formatted I/O (such as list-directed or namelist I/O) to a unit where the OPEN statement indicated the file was unformatted (FORM specifier). Check that the correct unit (file) was specified. If the FORM specifier was not specified in the OPEN statement and the file should contain formatted data, specify FORM='FORMATTED' in the OPEN statement. Otherwise, if appropriate, use unformatted I/O. 3 FMYSYN NUMBER: 58 ERROR CODE: I MESSAGE TEXT: format syntax error at or near xx EXPLANATION: Check the statement containing xx, a character substring from the format string, for a format syntax error. For information about FORMAT statements, see the HP Fortran for OpenVMS Language Reference Manual. This error is not returned by IOSTAT. 3 FORVARMIS NUMBER: 61 ERROR CODE: F or I MESSAGE TEXT: format/variable-type mismatch EXPLANATION: An attempt was made either to read or write a real variable with an integer edit descriptor (I, L, B, O, or Z), or to read or write an integer or logical variable with a real field descriptor (D, E, or F). If /CHECK=NOFORMAT is in effect, the severity is I. If execution continued, the following actions occurred: o If I, L, B, O, or Z, conversion as if INTEGER(KIND=4). o If D, E, or F, conversion as if REAL(KIND=4). The ERR transfer is taken after completion of the I/O statement for this error number. The resulting file status and record position are the same as if no error had occurred. However, other I/O errors take the ERR transfer as soon as the error is detected, so file states and record position are undefined. 3 INCFILORG NUMBER: 51 ERROR CODE: F MESSAGE TEXT: inconsistent file organization EXPLANATION: One of the following conditions occurred: o The file organization specified in an OPEN statement did not match the organization of the existing file. o The file organization of the existing file was inconsistent with the specified access mode; that is, direct access was specified with an indexed organization file, or keyed access was specified with a sequential or relative organization file. 3 INCKEYCHG NUMBER: 50 ERROR CODE: F MESSAGE TEXT: inconsistent key change or duplicate key EXPLANATION: A WRITE or REWRITE statement accessing an indexed organization file caused a key field to change or be duplicated. This condition was not allowed by the attributes of the file, as established when the file was created. 3 INCOPECLO NUMBER: 46 ERROR CODE: F MESSAGE TEXT: inconsistent OPEN/CLOSE parameters EXPLANATION: Specifications in an OPEN or CLOSE statement were inconsistent. Some invalid combinations follow: o READONLY or ACTION='READ' with STATUS='NEW' or STATUS='SCRATCH' o ACCESS='APPEND' with READONLY, ACTION='READ', STATUS='NEW', or STATUS='SCRATCH' o DISPOSE='SAVE', 'PRINT', or 'SUBMIT' with STATUS='SCRATCH' o DISPOSE='DELETE' with READONLY or ACTION='READ' o ACCESS='APPEND' with STATUS='REPLACE' o ACCESS='DIRECT' or 'KEYED' with POSITION='APPEND' or 'ASIS' o ACCESS='KEYED' with POSITION='REWIND' 3 INCRECLEN NUMBER: 37 ERROR CODE: F MESSAGE TEXT: inconsistent record length EXPLANATION: One of the following occurred: o An attempt was made to create a new relative, indexed, or direct access file without specifying a record length. o An existing file was opened in which the record length did not match the record size given in an OPEN or DEFINE FILE statement. o An attempt was made to write to a relative, indexed, or direct access file that was not correctly created or opened. 3 INCRECTYP NUMBER: 44 ERROR CODE: F MESSAGE TEXT: inconsistent record type EXPLANATION: The RECORDTYPE value in an OPEN statement did not match the record type attribute of the existing file that was opened. 3 INFFORLOO NUMBER: 60 ERROR CODE: F MESSAGE TEXT: infinite format loop EXPLANATION: The format associated with an I/O statement that included an I/O list had no field descriptors to use in transferring those values. 3 INPCONERR NUMBER: 64 ERROR CODE: F MESSAGE TEXT: input conversion error EXPLANATION: During a formatted input operation, an invalid character was detected in an input field, or the input value overflowed the range representable in the input variable. The value of the variable was set to zero. The ERR transfer is taken after completion of the I/O statement for this error number. The resulting file status and record position are the same as if no error had occurred. However, other I/O errors take the ERR transfer as soon as the error is detected, so file states and record position are undefined. 3 INPRECTOO NUMBER: 22 ERROR CODE: F MESSAGE TEXT: input record too long EXPLANATION: A record was read that exceeded the explicit or default record length specified when the file was opened. To read the file, use an OPEN statement with a RECL value of the appropriate size. 3 INPSTAREQ NUMBER: 67 ERROR CODE: F MESSAGE TEXT: input statement requires too much data EXPLANATION: An attempt was made to read more data than exists in a record by using an unformatted READ statement or a formatted sequential READ statement from a file opened with PAD='NO'. 3 INSVIRMEM NUMBER: 41 ERROR CODE: F MESSAGE TEXT: insufficient virtual memory EXPLANATION: The HP Fortran Run-Time Library attempted to exceed its virtual page limit while dynamically allocating space. Inform your system manager that process quotas and/or system parameters need to be increased. This error can be returned by STAT in an ALLOCATE or DEALLOCATE statement. 3 INTDIV NUMBER: 71 ERROR CODE: F MESSAGE TEXT: integer zero divide EXPLANATION: During an integer arithmetic operation, an attempt was made to divide by zero. The result of the operation was set to the dividend, which is equivalent to division by one (1). This error is not returned by IOSTAT. 3 INTOVF NUMBER: 70 ERROR CODE: F MESSAGE TEXT: integer overflow EXPLANATION: During an arithmetic operation, an integer value exceeded its range. The result of the operation was the correct low-order part. Consider specifying a larger integer data size (or use the /INTEGER_SIZE qualifier for INTEGER declarations without a kind or specifier.) See the HP Fortran for OpenVMS User Manual for ranges of the various integer data types. This error is not returned by IOSTAT. 3 INVARGFOR NUMBER: 48 ERROR CODE: F MESSAGE TEXT: invalid argument to Fortran Run-Time Library EXPLANATION: The VSI Fortran compiler passed an invalid coded argument to the Run-Time Library. This can occur if the compiler is newer than the VSI Fortran Run-Time Library in use. 3 INVARGMAT NUMBER: 81 ERROR CODE: F MESSAGE TEXT: invalid argument to math library EXPLANATION: One of the mathematical procedures detected an invalid argument value. 3 INVDEALLOC NUMBER: 153 ERROR CODE: S MESSAGE TEXT: Allocatable array or pointer is not allocated EXPLANATION: A Fortran 90 allocatable array or pointer must already be allocated when you attempt to deallocate it. You must allocate the array or pointer before it can again be deallocated. This error is not returned by IOSTAT. However, this error can be returned by STAT in a DEALLOCATE statement. 3 INVDEALLOC2 NUMBER: 173 ERROR CODE: S MESSAGE TEXT: A pointer passed to DEALLOCATE points to an array that cannot be deallocated EXPLANATION: A pointer that was passed to DEALLOCATE pointed to an explicit array, an array slice, or some other type of memory that could not be deallocated in a DEALLOCATE statement. Only whole arrays previous allocated with an ALLOCATE statement can be validly passed to DEALLOCATE. This error is not returned by IOSTAT. However, this error can be returned by STAT in a DEALLOCATE statement. 3 INVKEYSPE NUMBER: 49 ERROR CODE: F MESSAGE TEXT: invalid key specification EXPLANATION: A key specification in an OPEN statement or in a keyed-access READ statement was invalid. For example, the key length may have been zero or greater than 255 bytes, or the key length may not conform to the key specification of the existing file. 3 INVLOGUNI NUMBER: 32 ERROR CODE: F MESSAGE TEXT: invalid logical unit number EXPLANATION: A logical unit number less than zero or greater than 2,147,483,647 was used in an I/O statement. 3 INVMATKEY NUMBER: 94 ERROR CODE: F MESSAGE TEXT: invalid key match specifier for key direction EXPLANATION: A keyed READ used an invalid key match specifier for the direction of that key. Use KEYGE and KEYGT only on ascending keys. Use KEYLE and KEYLT only on descending keys. Use KEYNXT and KEYNXTNE to avoid enforcement of key direction and match specifier. 3 INVREALLOC NUMBER: 151 ERROR CODE: F MESSAGE TEXT: allocatable array is already allocated EXPLANATION: A Fortran 95/90 allocatable array must not already be allocated when you attempt to allocate it. You must deallocate the array before it can again be allocated. This error is not returned by IOSTAT. However, this error can be returned by STAT in an ALLOCATE statement. 3 INVREFVAR NUMBER: 19 ERROR CODE: F MESSAGE TEXT: invalid reference to variable in NAMELIST input EXPLANATION: The variable in error is shown as "varname" in the message text. One of the following conditions occurred: o The variable was not a member of the namelist group. o An attempt was made to subscript a scalar variable. o A subscript of the array variable was out-of-bounds. o An array variable was specified with too many or too few subscripts for the variable. o An attempt was made to specify a substring of a noncharacter variable or array name. o A substring specifier of the character variable was out-of-bounds. o A subscript or substring specifier of the variable was not an integer constant. o An attempt was made to specify a substring using an unsubscripted array variable. 3 KEYIO_DIR NUMBER: 260 ERROR CODE: F MESSAGE TEXT: keyed-access I/O to unit open for direct access EXPLANATION: The OPEN for this unit number specified direct access and the I/O statement specifies keyed access. Check the OPEN statement and make sure the I/O statement uses the correct unit number and type of access. (For more information on statements, see the HP Fortran for OpenVMS Language Reference Manual.) 3 KEYVALERR NUMBER: 45 ERROR CODE: F MESSAGE TEXT: keyword value error in OPEN statement EXPLANATION: An improper value was specified for an OPEN or CLOSE statement keyword requiring a value. 3 LISIO_SYN NUMBER: 59 ERROR CODE: F MESSAGE TEXT: list-directed I/O syntax error EXPLANATION: The data in a list-directed input record had an invalid format, or the type of the constant was incompatible with the corresponding variable. The value of the variable was unchanged. The ERR transfer is taken after completion of the I/O statement for this error number. The resulting file status and record position are the same as if no error had occurred. However, other I/O errors take the ERR transfer as soon as the error is detected, so file states and record position are undefined. 3 LOGZERNEG NUMBER: 83 ERROR CODE: F MESSAGE TEXT: logarithm of zero or negative value EXPLANATION: An attempt was made to take the logarithm of zero or a negative number. The result returned was the reserved operand, -0 for VAX-format floating-point and NaN for IEEE-format floating-point. 3 MIXFILACC NUMBER: 31 ERROR CODE: F MESSAGE TEXT: mixed file access modes EXPLANATION: One of the following conditions occurred: o An attempt was made to use both formatted and unformatted operations on the same unit. o An attempt was made to use an invalid combination of access modes on a unit, such as direct and sequential. The only valid combination is sequential and keyed access on a unit opened with ACCESS='KEYED'. o An attempt was made to execute a Fortran I/O statement on a logical unit that was opened by a program coded in a language other than Fortran. 3 NO_CURREC NUMBER: 53 ERROR CODE: F MESSAGE TEXT: no current record EXPLANATION: A REWRITE or current record DELETE operation was attempted when no current record was defined. 3 NO_SUCDEV NUMBER: 42 ERROR CODE: F MESSAGE TEXT: no such device EXPLANATION: A file specification included an invalid or unknown device name when an OPEN operation was attempted. 3 NOTFORSPE NUMBER: 1 ERROR CODE: F MESSAGE TEXT: not a Fortran-specific error EXPLANATION: An error occurred in the user program or in the VSI Fortran RTL that was not a Fortran-specific error and was not reportable through any other VSI Fortran run-time messages. This error is not returned by IOSTAT. 3 NULPTRERR NUMBER: 146 ERROR CODE: F MESSAGE TEXT: null pointer error EXPLANATION: An attempt was made to use a pointer that does not contain an address. Modify the source program, recompile, and relink. This error is not returned by IOSTAT. 3 OPEDEFREQ NUMBER: 26 ERROR CODE: F MESSAGE TEXT: OPEN or DEFINE FILE required for keyed or direct access EXPLANATION: One of the following conditions occurred: o A direct access READ, WRITE, FIND, or DELETE statement specified a file that was not opened with a DEFINE FILE statement or with an OPEN statement specifying ACCESS='DIRECT'. o A keyed access READ statement specified a file that was not opened with an OPEN statement specifying ACCESS='KEYED'. 3 OPEFAI NUMBER: 30 ERROR CODE: F MESSAGE TEXT: open failure EXPLANATION: An error was detected by RMS while attempting to open a file in an OPEN, INQUIRE, or other I/O statement. This message is issued when the error condition is not one of the more common conditions for which specific error messages are provided. It can occur when an OPEN operation is attempted for one of the following: o A segmented file that was not on a disk or a raw magnetic tape o A standard process I/O file that has been closed 3 OPEREQSEQ NUMBER: 265 ERROR CODE: F MESSAGE TEXT: operation requires sequential file organization and access EXPLANATION: Attempted BACKSPACE operation for a unit that is not connected to a sequential file opened for sequential access. Make sure the BACKSPACE statement specified the right unit number and the OPEN statement specified the correct file and access. 3 OPERREQDIS NUMBER: 264 ERROR CODE: F MESSAGE TEXT: operation requires file to be on disk or tape EXPLANATION: Attempted BACKSPACE operation for a unit that is not connected to a disk or tape device. Make sure the BACKSPACE statement specified the right unit number and the OPEN statement specified the correct device. 3 OUTCONERR NUMBER: 63 ERROR CODE: E or I MESSAGE TEXT: output conversion error EXPLANATION: During a formatted output operation, the value of a particular number could not be output in the specified field length without loss of significant digits. If /CHECK=NOOUTPUT_CONVERSION is in effect, the severity is I. In this case (or if no ERR address is defined for the I/O statement encountering this error), the program continues and the entire overflowed field is filled with asterisks (*) to indicate the error in the output record. The ERR transfer is taken after completion of the I/O statement for this error number. The resulting file status and record position are the same as if no error had occurred. However, other I/O errors take the ERR transfer as soon as the error is detected, so file states and record position are undefined. 3 OUTSTAOVE NUMBER: 66 ERROR CODE: F MESSAGE TEXT: output statement overflows record EXPLANATION: An output statement attempted to transfer more data than would fit in the maximum record size. 3 RANGEERR NUMBER: 150 ERROR CODE: F MESSAGE TEXT: range error EXPLANATION: An integer value appears in a context where the value of the integer is outside the permissible range. This error is not returned by IOSTAT. 3 RECIO_OPE NUMBER: 40 ERROR CODE: F MESSAGE TEXT: recursive I/O operation EXPLANATION: While processing an I/O statement for a logical unit, another I/O operation on the same logical unit was attempted. One of the following conditions may have occurred: o A function subprogram that performs I/O to the same logical unit was referenced in an expression in an I/O list or variable format expression. o An I/O statement was executed at AST level for the same logical unit. o An exception handler (or a procedure it called) executed an I/O statement in response to a signal from an I/O statement for the same logical unit. 3 RECNUMOUT NUMBER: 25 ERROR CODE: F MESSAGE TEXT: record number outside range EXPLANATION: A direct access READ, WRITE, or FIND statement specified a record number outside the range specified when the file was created. 3 RESACQFAI NUMBER: 152 ERROR CODE: F MESSAGE TEXT: unresolved contention for VSI Fortran RTL global resource EXPLANATION: Failed to acquire a VSI Fortran RTL global resource for a reentrant routine. For a multithreaded program, the requested global resource is held by a different thread in your program. For a program using asynchronous handlers, the requested global resource is held by the calling part of the program (such as the main program) and your asynchronous handler attempted to acquire the same global resource. This error is not returned by IOSTAT. 3 REWERR NUMBER: 20 ERROR CODE: F MESSAGE TEXT: REWIND error EXPLANATION: One of the following conditions occurred: o The file was not a sequential organization file. o The file was not opened for sequential or append access. o RMS detected an error condition during execution of a REWIND statement. 3 REWRITERR NUMBER: 54 ERROR CODE: F MESSAGE TEXT: REWRITE error EXPLANATION: RMS detected an error condition during execution of a REWRITE statement. 3 ROPRAND NUMBER: 144 ERROR CODE: F MESSAGE TEXT: reserved operand EXPLANATION: VSI Fortran encountered a reserved operand. Please report the problem to HP. This error is not returned by IOSTAT. 3 SEGRECFOR NUMBER: 35 ERROR CODE: F MESSAGE TEXT: segmented record format error EXPLANATION: An invalid segmented record control data word was detected in an unformatted sequential file. The file was probably either created with RECORDTYPE='FIXED' or 'VARIABLE' in effect, or was created by a program written in a language other than Fortran. 3 SEQIO_DIR NUMBER: 259 ERROR CODE: F MESSAGE TEXT: sequential-access I/O to unit open for direct access EXPLANATION: The OPEN for this unit number specified direct access and the I/O statement specifies sequential access. Check the OPEN statement and make sure the I/O statement uses the correct unit number and type of access. (For more information on statements, see the HP Fortran for OpenVMS Language Reference Manual.) 3 SHORTDATEARG NUMBER: 175 ERROR CODE: F MESSAGE TEXT: DATE argument to DATE_AND_TIME is too short (LEN=n), required LEN=8 EXPLANATION: The number of characters associated with the DATE argument to the DATE_AND_TIME intrinsic was shorter than the required length. You must increase the number of characters passed in for this argument to be at least 8 characters in length. Verify that the TIME and ZONE arguments also meet their minimum lengths. This error is not returned by IOSTAT. 3 SHORTTIMEARG NUMBER: 176 ERROR CODE: F MESSAGE TEXT: TIME argument to DATE_AND_TIME is too short (LEN=n), required LEN=10 EXPLANATION: The number of characters associated with the TIME argument to the DATE_AND_TIME intrinsic was shorter than the required length. You must increase the number of characters passed in for this argument to be at least 10 characters in length. Verify that the DATE and ZONE arguments also meet their minimum lengths. This error is not returned by IOSTAT. 3 SHORTZONEARG NUMBER: 177 ERROR CODE: F MESSAGE TEXT: ZONE argument to DATE_AND_TIME is too short (LEN=n), required LEN=5 EXPLANATION: The number of characters associated with the ZONE argument to the DATE_AND_TIME intrinsic was shorter than the required length. You must increase the number of characters passed in for this argument to be at least 5 characters in length. Verify that the DATE and TIME arguments also meet their minimum lengths. This error is not returned by IOSTAT. 3 SIGLOSMAT NUMBER: 87 ERROR CODE: F MESSAGE TEXT: significance lost in math library EXPLANATION: The magnitude of an argument or the magnitude of the ratio of the arguments to a math library function was so large that all significance in the result was lost. The result returned was the reserved operand, -0. 3 SPERECLOC NUMBER: 52 ERROR CODE: F MESSAGE TEXT: specified record locked EXPLANATION: A read operation or direct access write, find, or delete operation was attempted on a record that was locked by another user. 3 SQUROONEG NUMBER: 84 ERROR CODE: F MESSAGE TEXT: square root of negative value EXPLANATION: An argument required the evaluation of the square root of a negative value. The result returned was the reserved operand, -0 for VAX-format floating-point and NaN for IEEE-format floating-point. 3 STKOVF NUMBER: 147 ERROR CODE: F MESSAGE TEXT: stack overflow EXPLANATION: The VSI Fortran RTL encountered a stack overflow while executing your program. This error is not returned by IOSTAT. 3 STRLENERR NUMBER: 148 ERROR CODE: F MESSAGE TEXT: string length error EXPLANATION: During a string operation, an integer value appears in a context where the value of the integer is outside the permissible string length range. Try recompiling with /CHECK=BOUNDS or examine the source code. This error is not returned by IOSTAT. 3 SUBRNG NUMBER: 77 ERROR CODE: F MESSAGE TEXT: subscript out of range EXPLANATION: An array reference was detected outside the declared array bounds. This error is not returned by IOSTAT. 3 SUBSTRERR NUMBER: 149 ERROR CODE: F MESSAGE TEXT: substring error EXPLANATION: An array subscript is outside the dimensioned boundaries of an array. Try recompiling with /CHECK=BOUNDS or examine source code. This error is not returned by IOSTAT. 3 SYNERRFOR NUMBER: 62 ERROR CODE: F MESSAGE TEXT: syntax error in format EXPLANATION: A syntax error was encountered while the HP Fortran RTL was processing a format stored in an array or character variable. 3 SYNERRNAM NUMBER: 17 ERROR CODE: F MESSAGE TEXT: syntax error in NAMELIST input "text" EXPLANATION: The syntax of input to a namelist READ statement was incorrect. (The part of the record in which the error was detected is shown as "text" in the message text.) 3 TOOMANREC NUMBER: 27 ERROR CODE: F MESSAGE TEXT: too many records in I/O statement EXPLANATION: One of the following conditions occurred: o An attempt was made to read or write more than one record with an ENCODE or DECODE statement. o An attempt was made to write more records than existed. 3 TOOMANVAL NUMBER: 18 ERROR CODE: F MESSAGE TEXT: too many values for NAMELIST variable "varname" EXPLANATION: An attempt was made to assign too many values to a variable during a namelist READ statement. (The name of the variable is shown as "varname" in the message text.) 3 UNDEXP NUMBER: 82 ERROR CODE: F MESSAGE TEXT: undefined exponentiation EXPLANATION: An exponentiation that is mathematically undefined was attempted, for example, 0.**0. The result returned for floating-point operations was the reserved operand, -0 for VAX-format floating-point and NaN for IEEE-format floating-point. For integer operations, zero is returned. 3 UNFIO_FMT NUMBER: 256 ERROR CODE: F MESSAGE TEXT: unformatted I/O to unit open for formatted transfers EXPLANATION: Attempted unformatted I/O to a unit where the OPEN statement indicated the file was formatted (FORM specifier). Check that the correct unit (file) was specified. If FORM was not specified in the OPEN statement and the file should contain unformatted data, specify FORM='UNFORMATTED' in the OPEN statement. Otherwise, if appropriate, use formatted I/O (such as list-directed or namelist I/O). 3 UNIALROPE NUMBER: 34 ERROR CODE: F MESSAGE TEXT: unit already open EXPLANATION: A DEFINE FILE statement specified a logical unit that was already opened. 3 UNLERR NUMBER: 56 ERROR CODE: F MESSAGE TEXT: UNLOCK error EXPLANATION: RMS detected an error condition during execution of an UNLOCK statement. 3 VFEVALERR NUMBER: 68 ERROR CODE: F MESSAGE TEXT: variable format expression value error EXPLANATION: The value of a variable format expression was not within the range acceptable for its intended use; for example, a field width was less than or equal to zero. A value of one was assumed, except for a P edit descriptor, for which a value of zero was assumed. The ERR transfer is taken after completion of the I/O statement for this error number. The resulting file status and record position are the same as if no error had occurred. However, other I/O errors take the ERR transfer as soon as the error is detected, so file states and record position are undefined. 3 WRIREAFIL NUMBER: 47 ERROR CODE: F MESSAGE TEXT: write to READONLY file EXPLANATION: A write operation was attempted to a file that was declared ACTION='READ' or READONLY in the OPEN statement that is currently in effect. 3 WRONUMARG NUMBER: 80 ERROR CODE: F MESSAGE TEXT: wrong number of arguments EXPLANATION: An improper number of arguments was used to call a math library procedure. 2 Source_Format Source code can be in free, fixed, or tab format. Fixed or tab forms must not be mixed with free form in the same source program, but different source forms can be used in different source programs. All source forms allow lowercase characters to be used as an alternative to uppercase characters. More than one statement (or partial statement) can appear on a single source line if a statement separator is placed between the statements. The statement separator is a semicolon character (;). Consecutive semicolons (with or without intervening blanks) are considered to be one semicolon. If a semicolon is the last character on a line, or the last character before a comment, it is ignored. 3 Free_Form In free source form, statements are not limited to specific positions on a source line, and a line can contain from 0 to 132 characters. Blank characters are significant in free source form. The following are rules for blank characters: o Blank characters must not appear in lexical tokens, except within a character context. For example, there can be no blanks between the exponentiation operator **. Blank characters can be used freely between lexical tokens to improve legibility. o Blank characters must be used to separate names, constants, or labels from adjacent keywords, names, constants, or labels. For example, consider the following statements: INTEGER NUM GO TO 40 20 DO K=1,8 The blanks are required after INTEGER, TO, 20, and DO. o Some adjacent keywords must have one or more blank characters between them. Others do not require any; for example, BLOCK DATA can also be spelled BLOCKDATA. The following list shows which keywords have optional or required blanks. Optional Blanks Required Blanks ---------------- ---------------- BLOCK DATA CASE DEFAULT DOUBLE COMPLEX DO WHILE DOUBLE PRECISION IMPLICIT type ELSE IF IMPLICIT NONE END BLOCK DATA INTERFACE ASSIGNMENT END DO INTERFACE OPERATOR END FILE MODULE PROCEDURE END FORALL RECURSIVE FUNCTION END FUNCTION RECURSIVE SUBROUTINE END IF RECURSIVE type FUNCTION END INTERFACE type FUNCTION END MODULE type RECURSIVE FUNCTION END PROGRAM END SELECT END SUBROUTINE END TYPE END WHERE GO TO IN OUT SELECT CASE The exclamation point character (!) indicates a comment if it is within a source line, or a comment line if it is the first character in a source line. The ampersand character (&) indicates a continuation line (unless it appears in a Hollerith or character constant, or within a comment). The continuation line is the first noncomment line following the ampersand. Although Fortran 95/90 permits up to 39 continuation lines in free-form programs, VSI Fortran allows up to 511 continuation lines. The following shows a continued statement: TCOSH(Y) = EXP(Y) + & ! The initial statement line EXP(-Y) ! A continuation line If the first nonblank character on the next noncomment line is an ampersand, the statement continues at the character following the ampersand. For example, the preceding example can be written as follows: TCOSH(Y) = EXP(Y) + & & EXP(-Y) If a lexical token must be continued, the first nonblank character on the next noncomment line must be an ampersand followed immediately by the rest of the token. For example: TCOSH(Y) = EXP(Y) + EX& &P(-Y) If you continue a character constant, an ampersand must be the first non-blank character of the continued line; the statement continues with the next character following the ampersand. For example: ADVERTISER = "Davis, O'Brien, Chalmers & Peter& &son" ARCHITECT = "O'Connor, Emerson, and Davis& & Associates" In VSI Fortran, if the ampersand is omitted on the continued line, the statement continues with the first non-blank character in the continued line. So, in the preceding example, the whitespace before "Associates" would be ignored. The ampersand cannot be the only nonblank character in a line, or the only nonblank character before a comment; an ampersand in a comment is ignored. 3 Fixed_and_Tab_Format Each Fortran line has the following four fields: Statement label field Columns 1-5 Continuation indicator field Column 6 Statement field Columns 7-72 (if you specify the EXTEND_SOURCE compiler option or OPTIONS/EXTEND_SOURCE, statements extend to column 132) Sequence number field Columns 73-80 Note: If you use the sequence number field, do not use tabs anywhere in the source line, or the compiler may interpret the sequence numbers as part of the statement field in your program. 4 Fixed A Fortran line is divided into fields for the required information. Each column represents a single character. COLUMN FIELD ------ ----- 1 Indicator: Comment(C,c,*,!,blank) or Debug(D,d) 1-5 Label (any decimal integer except zero) 6 Indicator: Continuation of statement (any character except zero or space) 7-72 Statement Field (up to column 72) 73-80 Sequence Number (optionally to column 132 -- ignored) NOTE This source format is obsolescent in Fortran 95. HP Fortran flags obsolescent features, but fully supports them. 4 Tab A Fortran line is divided into fields for the required information. Each column represents a single character. You cannot specify a sequence number field using this method of coding. COLUMN FIELD ------ ----- (before tab) 1 Indicator: Comment(C,c,*,!,blank) or Debug(D,d) 1-5 Label (any decimal integer except zero) (after first tab) 6 Indicator: Continuation of statement (any digit 1-9) (after second tab) Statement Field (up to column 72) Tabs are treated as single characters. 3 Example The following example is valid for all source forms: Column: 12345678... 73 _________________________________________________________________________ ! Define the user function MY_SIN DOUBLE PRECISION FUNCTION MY_SIN(X) MY_SIN = X - X**3/FACTOR(3) + X**5/FACTOR(5) & & - X**7/FACTOR(7) CONTAINS INTEGER FUNCTION FACTOR(N) FACTOR = 1 DO 10 I = N, 1, -1 10 FACTOR = FACTOR * I END FUNCTION FACTOR END FUNCTION MY_SIN 2 Statements Statements in a Fortran program unit follow a required order. In the following figure, vertical lines separate statement types that can be interspersed. For example, DATA statements can be interspersed with executable statements. Horizontal lines indicate statement types that cannot be interspersed. For example, type declaration statements cannot be interspersed with executable statements. +-------+--------------------------------------------------------+ | | OPTIONS Statements | | |--------------------------------------------------------| | | PROGRAM, FUNCTION, SUBROUTINE, MODULE, or | | | BLOCK DATA Statements | | |--------------------------------------------------------| | | USE Statements | | |---------+----------------------------------------------| |COMMENT| | IMPLICIT NONE Statements | | Lines,| |------------+-------------------+-------------| |INCLUDE|NAMELIST,| PARAMETER | IMPLICIT Statements | |State- | FORMAT, |------------+---------------------------------| | ments,| & | | Derived-Type Definitions, | | & | ENTRY | PARAMETER | Interface Blocks, Type | |Direc- | State- | and DATA | Declaration Statements, State- | | tives | ments | Statements | ment Function Statements, and | | | | | Specification Statements | | | +------------+---------------------------------| | | | DATA | Executable Statements | | | | Statements | | | |---------+----------------------------------------------| | | CONTAINS Statement | | |--------------------------------------------------------| | | Internal Subprograms or Module Subprograms | |-------+--------------------------------------------------------| | END Statement | +----------------------------------------------------------------+ 3 Directives You can use directives in a Fortran source program to influence certain aspects of the compilation process. 4 General_Directives HP FORTRAN provides several general-purpose compiler directives to perform tasks during compilation. General directives begin with the cDEC$ prefix. These directives are enabled in all Fortran compilation units, regardless of the options used on the command line. The general directives are: ALIAS MESSAGE ATTRIBUTES OBJCOMMENT DECLARE and NODECLARE OPTIONS DEFINE and UNDEFINE PACK FIXEDFORMLINESIZE PSECT FREEFORM and NOFREEFORM REAL IDENT STRICT and NOSTRICT IF and IF DEFINED SUBTITLE and TITLE INTEGER UNROLL IVDEP The "c" in the directive prefix (cDEC$) is one of the following: C (or c), !, or *. The following are source form rules for directive prefixes: o Prefixes beginning with C (or c) and * are only allowed in fixed and tab source forms. In these source forms, the prefix must appear in columns 1 through 5; column 6 must be a blank or tab. From column 7 on, blanks are insignificant, so the directive can be positioned anywhere on the line after column 6. o Prefixes beginning with ! are allowed in all source forms. The prefix can appear in any valid column, but it cannot be preceded by any nonblank characters on the same line. It can only be preceded by whitespace. A general directive ends in column 72 (or column 132, if a compiler option is specified). General directives cannot be continued. A comment can follow a directive on the same line. Additional Fortran statements (or directives) cannot appear on the same line as the general directive. General directives cannot appear within a continued Fortran statement. If a blank common is used in a general compiler directive, it must be specified as two slashes (/ /). 5 ALIAS cDEC$ ALIAS Specifies an alternate external name to be used when referring to external subprograms. It takes the following form: cDEC$ ALIAS internal-name, external name c Is one of the following: C (or c), !, or *. internal-name Is the name of the subprogram as used in the current program unit. external name Is a name, or a character constant delimited by quotation marks or apostrophes. If a name is specified, the name (in uppercase) is used as the external name for the specified "internal-name". If a character constant is specified, it is used as is; the string is not changed to uppercase nor are blanks removed. The ALIAS directive affects only the external name used for references to the specified "internal-name". Names that are not acceptable to the linker will cause link-time errors. This directive can be useful when compiling applications written for other platforms that have different naming conventions. 5 ATTRIBUTES cDEC$ ATTRIBUTES Lets you specify properties for data objects and procedures. It takes the following form: cDEC$ ATTRIBUTES att [,att]... :: object [,object]... c Is one of the following: C (or c), !, or *. att Is one of the following properties: ADDRESS64 ALIAS EXTERN ALLOW_NULL IGNORE_LOC NO_ARG_CHECK C NOMIXED_STR_LEN_ARG DECORATE REFERENCE DEFAULT REFERENCE32 DESCRIPTOR REFERENCE64 DESCRIPTOR32 STDCALL DESCRIPTOR64 VALUE VARYING object Is the name of a data object or procedure. The properties can be used in function and subroutine definitions, in type declarations, and with the INTERFACE and ENTRY statements. Properties applied to entities available through use or host association are in effect during the association. For example, consider the following: MODULE MOD1 INTERFACE SUBROUTINE SUB1 !DEC$ ATTRIBUTES C, ALIAS:'othername' :: NEW_SUB END SUBROUTINE END INTERFACE CONTAINS SUBROUTINE SUB2 CALL NEW_SUB END SUBROUTINE END MODULE In this case, the call to NEW_SUB within SUB2 uses the C and ALIAS properties specified in the interface block. Options C, STDCALL, REFERENCE, VALUE, and VARYING affect the calling conventions of routines: o You can specify C, STDCALL, REFERENCE, and VARYING for an entire routine. o You can specify VALUE and REFERENCE for individual arguments. For compatibility, !MS$ATTRIBUTES can be used in place of cDEC$ ATTRIBUTES. The properties are described in the following sections. 6 ADDRESS64 Specifies that the data object has a 64-bit address. This property can be specified for any variable or dummy argument, including ALLOCATABLE and deferred-shape arrays. However, variables with this property cannot be data-initialized. It can also be specified for COMMON blocks or for variables in a COMMON block. If specified for a COMMON block variable, the COMMON block implicitly has the ADDRESS64 property. ADDRESS64 is not compatible with the AUTOMATIC attribute. 6 ALIAS Specifies an alternate external name to be used when referring to external subprograms. Its form is: ALIAS:external-name external-name Is a character constant delimited by apostrophes or quotation marks. The character constant is used as is; the string is not changed to uppercase, nor are blanks removed. The ALIAS property overrides the C (and STDCALL) property. If both C and ALIAS are specified for a subprogram, the subprogram is given the C calling convention, but not the C naming convention. It instead receives the name given for ALIAS, with no modifications. ALIAS cannot be used with internal procedures, and it cannot be applied to dummy arguments. cDEC$ ATTRIBUTES ALIAS has the same effect as the cDEC$ ALIAS directive. 6 ALLOW_NULL Enables a corresponding dummy argument to pass a NULL pointer (defined by a zero or the NULL intrinsic function) by value for the argument. ALLOW_NULL is only valid if the REFERENCE property is also specified; otherwise, it has no effect. 6 C_and_STDCALL Specify how data is to be passed when you use routines written in C or assembler with FORTRAN or Fortran 95/90 routines. C and STDCALL are interpreted as synonyms. When applied to a subprogram, these properties define the subprogram as having a specific set of calling conventions. The difference between the calling conventions is this: If C or STDCALL is specified for a subprogram, arguments (except for arrays and characters) are passed by value. Subprograms using standard Fortran 95/90 conventions pass arguments by reference. Character arguments are passed as follows: o By default, hidden lengths are put at the end of the argument list. o If C or STDCALL (only) is specified: On all systems, the first character of the string is passed (and padded with zeros out to INTEGER(4) length). o If C or STDCALL is specified, and REFERENCE is specified for the argument: On all systems, the string is passed with no length. o If C or STDCALL is specified, and REFERENCE is specified for the routine (but REFERENCE is not specified for the argument, if any): On all systems, the string is passed with the length. 6 DECORATE Specifies that the external name used in cDEC$ ALIAS or cDEC$ ATTRIBUTES ALIAS should have the prefix and postfix decorations performed on it that are associated with the calling mechanism that is in effect. These are the same decorations performed on the procedure name when ALIAS is not specified. The case of the external name is not modified. If ALIAS is not specified, this property has no effect. 6 DEFAULT Overrides certain compiler options that can affect external routine and COMMON block declarations. It specifies that the compiler should ignore compiler options that change the default conventions for external symbol naming and argument passing for routines and COMMON blocks (/iface, /names, and /assume:underscore). This option can be combined with other cDEC$ ATTRIBUTES options, such as STDCALL, C, REFERENCE, ALIAS, etc. to specify attributes different from the compiler defaults. This option is useful when declaring INTERFACE blocks for external routines, since it prevents compiler options from changing calling or naming conventions. 6 DESCRIPTOR Specifies that the argument is passed by VMS descriptor. This property can be specified only for dummy arguments in an INTERFACE block (NOT for a routine itself). 6 DESCRIPTOR32 Specifies that the argument is passed as a 32-bit descriptor. 6 DESCRIPTOR64 Specifies that the argument is passed as a 64-bit descriptor. 6 EXTERN Specifies that a variable is allocated in another source file. EXTERN can be used in global variable declarations, but it must not be applied to dummy arguments. EXTERN must be used when accessing variables declared in other languages. 6 IGNORE_LOC Enables %LOC to be stripped from an argument. IGNORE_LOC is only valid if the REFERENCE property is also specified; otherwise, it has no effect. 6 NO_ARG_CHECK Specifies that type and shape matching rules related to explicit interfaces are to be ignored. This permits the construction of an INTERFACE block for an external procedure or a module procedure that accepts an argument of any type or shape; for example, a memory copying routine. NO_ARG_CHECK can appear only in an INTERFACE block for a non-generic procedure or in a module procedure. It can be applied to an individual dummy argument name or to the routine name, in which case the property is applied to all dummy arguments in that interface. NO_ARG_CHECK cannot be used for procedures with the PURE or ELEMENTAL prefix. If an argument has an INTENT or OPTIONAL attribute, any NO_ARG_CHECK specification is ignored. 6 NOMIXED_STR_LEN_ARG Specifies that hidden lengths be placed in sequential order at the end of the argument list. 6 REFERENCE_and_VALUE Specify how a dummy argument is to be passed. REFERENCE specifies a dummy argument's memory location is to be passed instead of the argument's value. VALUE specifies a dummy argument's value is to be passed instead of the argument's memory location. When a dummy argument has the VALUE property, the actual argument passed to it can be of a different type. If necessary, type conversion is performed before the subprogram is called. When a complex (KIND=4, KIND=8, or KIND=16) argument is passed by value, two floating-point arguments (one containing the real part, the other containing the imaginary part) are passed by immediate value. Character values, substrings, assumed-size arrays, and adjustable arrays cannot be passed by value. If REFERENCE (only) is specified for a character argument, the string is passed but the length is not passed. If REFERENCE is specified for a character argument, and C (or STDCALL) has been specified for the routine, the string is passed but the length is not passed. This is true even if REFERENCE is also specified for the routine. If REFERENCE and C (or STDCALL) are specified for a routine, but REFERENCE has not been specified for the argument, the string is passed with the length. VALUE is the default if the C or STDCALL property is specified in the subprogram definition. 6 REFERENCE32 Specifies that the argument is accepted only by 32-bit address. 6 REFERENCE64 Specifies that the argument is accepted only by 64-bit address. 6 VARYING Allows a variable number of calling arguments. If VARYING is specified, the C property must also be specified. Either the first argument must be a number indicating how many arguments to process, or the last argument must be a special marker (such as -1) indicating it is the final argument. The sequence of the arguments, and types and kinds must be compatible with the called procedure. 5 DECLARE_and_NODECLARE cDEC$ DECLARE cDEC$ NODECLARE The DECLARE directive generates warnings for variables that have been used but have not been declared (like the IMPLICIT NONE statement). The NODECLARE directive (the default) disables these warnings. The "c" in cDEC$ is one of the following: a C (or c), !, or *. The DECLARE directive is primarily a debugging tool that locates variables that have not been properly initialized, or that have been defined but never used. For compatibility, !MS$DECLARE and !MS$NODECLARE can be used in place of cDEC$ DECLARE and cDEC$ NODECLARE. 5 DEFINE_and_UNDEFINE cDEC$ DEFINE cDEC$ UNDEFINE The DEFINE directive creates a symbolic variable whose existence or value can be tested during conditional compilation. The UNDEFINE directive removes a defined symbol. The DEFINE and UNDEFINE directives take the following forms: cDEC$ DEFINE name [=val] cDEC$ UNDEFINE name c Is one of the following: C (or c), !, or *. name Is the name of the variable. val Is an INTEGER(4) value assigned to "name". DEFINE and UNDEFINE create and remove variables for use with the IF (or IF DEFINED) directive. Symbols defined with the DEFINE directive are local to the directive. They cannot be declared in the Fortran program. Because Fortran programs cannot access the named variables, the names can duplicate Fortran keywords, intrinsic functions, or user-defined names without conflict. To test whether a symbol has been defined, use the IF DEFINED (name) directive. You can assign an integer value to a defined symbol. To test the assigned value of "name", use the IF directive. IF test expressions can contain most logical and arithmetic operators. Attempting to undefine a symbol which has not been defined produces a compiler warning. The DEFINE and UNDEFINE directives can appear anywhere in a program, enabling and disabling symbol definitions. For compatibility, !MS$DEFINE and !MS$UNDEFINE can be used in place of cDEC$ DEFINE and cDEC$ UNDEFINE. Examples: Consider the following: !DEC$ DEFINE testflag !DEC$ IF DEFINED (testflag) write (*,*) 'Compiling first line' !DEC$ ELSE write (*,*) 'Compiling second line' !DEC$ ENDIF !DEC$ UNDEFINE testflag 5 FIXEDFORMLINESIZE cDEC$ FIXEDFORMLINESIZE Sets the line length for fixed-form source code. The directive takes the following form: cDEC$ FIXEDFORMLINESIZE:{72 | 80 | 132} c Is one of the following: C (or c), !, or *. You can set FIXEDFORMLINESIZE to 72 (the default), 80, or 132 characters. The FIXEDFORMLINESIZE setting remains in effect until the end of the file, or until it is reset. The FIXEDFORMLINESIZE directive sets the source-code line length in include files, but not in USE modules, which are compiled separately. If an include file resets the line length, the change does not affect the host file. This directive has no effect on free-form source code. For compatibility, !MS$FIXEDFORMLINESIZE can be used in place of cDEC$ FIXEDFORMLINESIZE. Examples: Consider the following: CDEC$ NOFREEFORM CDEC$ FIXEDFORMLINESIZE:132 WRITE(*,*) 'Text that goes past the 72nd column without continuation' 5 FREEFORM_and_NOFREEFORM cDEC$ FREEFORM cDEC$ NOFREEFORM The FREEFORM directive specifies that source code is in free-form format. The NOFREEFORM directive specifies that source code is in fixed-form format. The "c" in cDEC$ is one of the following: a C (or c), !, or *. When the FREEFORM or NOFREEFORM directives are used, they remain in effect for the remainder of the file, or until the opposite directive is used. When in effect, they apply to include files, but do not affect USE modules, which are compiled separately. For compatibility, !MS$FREEFORM and !MS$NOFREEFORM can be used in place of cDEC$ FREEFORM and cDEC$ NOFREEFORM. 5 IDENT cDEC$ IDENT string Lets you specify a string that can be used to identify an object module. The compiler places the string in the identification field of an object module when it generates the module for each source program unit. The "string" is a character constant containing up to 31 printable characters. Only the first IDENT directive is effective -- the compiler ignores any additional IDENT directives in a program unit. IDENT has no effect when you specify the /NOOBJECT compiler option. 5 IF_and_IFDEFINED cDEC$ IF cDEC$ IF DEFINED The IF and IF DEFINED directives specify a conditional compilation construct. IF tests whether a logical expression is .TRUE. or .FALSE.. IF DEFINED tests whether a symbol has been defined. The directive-initiated construct takes the following form: cDEC$ IF (expr) [or cDEC$ IF DEFINED (name)] block [cDEC$ ELSE IF (expr) block]... [cDEC$ ELSE block] cDEC$ ENDIF c Is one of the following: C (or c), !, or *. exp A logical expression that evaluates to .TRUE. or .FALSE.. name Is the name of a symbol to be tested for definition. block Are executable statements that are compiled (or not) depending on the value of logical expressions in the IF directive construct. The IF and IF DEFINED directive constructs end with an ENDIF directive and can contain one or more ELSEIF directives and at most one ELSE directive. If the logical condition within a directive evaluates to .TRUE. at compilation, and all preceding conditions in the IF construct evaluate to .FALSE., then the statements contained in the directive block are compiled. A "name" can be defined with a DEFINE directive, and can optionally be assigned an integer value. If the symbol has been defined, with or without being assigned a value, IF DEFINED (name) evaluates to .TRUE.; otherwise, it evaluates to .FALSE.. If the logical condition in the IF or IF DEFINED directive is .TRUE., statements within the IF or IF DEFINED block are compiled. If the condition is .FALSE., control transfers to the next ELSEIF or ELSE directive, if any. If the logical expression in an ELSEIF directive is .TRUE., statements within the ELSEIF block are compiled. If the expression is .FALSE., control transfers to the next ELSEIF or ELSE directive, if any. If control reaches an ELSE directive because all previous logical conditions in the IF construct evaluated to .FALSE., the statements in an ELSE block are compiled unconditionally. You can use any Fortran logical or relational operator or symbol in the logical expression of the directive. The logical expression can be as complex as you like, but the whole directive must fit on one line. For compatibility, each directive in the construct can begin with the prefix !MS$ instead of cDEC$. Examples: Consider the following: ! When the following code is compiled and run, ! the output depends on whether one of the expressions ! tests .TRUE.; or all test .FALSE. !DEC$ DEFINE flag=3 !DEC$ IF (flag .LT. 2) WRITE (*,*) "This is compiled if flag less than 2." !DEC$ ELSEIF (flag >= 8) WRITE (*,*) "Or this compiled if flag greater than & or equal to 8." !DEC$ ELSE WRITE (*,*) "Or this compiled if all preceding & conditions .FALSE." !DEC$ ENDIF END 5 INTEGER cDEC$ INTEGER Specifies the default integer kind. It takes the following form: cDEC$ INTEGER:{2 | 4 | 8} c Is one of the following: C (or c), !, or *. The INTEGER directive specifies a size of 2 (KIND=2), 4 (KIND=4), or 8 (KIND=8) bytes for default integer numbers. When the INTEGER directive is effect, all default integer variables are of the kind specified in the directive. Only numbers specified or implied as INTEGER without KIND are affected. The INTEGER directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directive cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it. The default logical kind is the same as the default integer kind. So, when you change the default integer kind you also change the default logical kind. For compatibility, !MS$INTEGER can be used in place of cDEC$ INTEGER. Examples: Consider the following: INTEGER i ! a 4-byte integer WRITE(*,*) KIND(i) CALL INTEGER2( ) WRITE(*,*) KIND(i) ! still a 4-byte integer ! not affected by setting in subroutine END SUBROUTINE INTEGER2( ) !DEC$ INTEGER:2 INTEGER j ! a 2-byte integer WRITE(*,*) KIND(j) END SUBROUTINE 5 IVDEP cDEC$ IVDEP The IVDEP directive assists the compiler's dependence analysis. It can only be applied to iterative DO loops. This directive can also be specified as INIT_DEP_FWD (INITialize DEPendences ForWarD). The IVDEP directive takes the following form: cDEC$ IVDEP c Is one of the following: C (or c), !, or *. The IVDEP directive is an assertion to the compiler's optimizer about the order of memory references inside a DO loop. The IVDEP directive tells the compiler to begin dependence analysis by assuming all dependences occur in the same forward direction as their appearance in the normal scalar execution order. This contrasts with normal compiler behavior, which is for the dependence analysis to make no initial assumptions about the direction of a dependence. The IVDEP directive must precede the DO statement for each DO loop it affects. No source code lines, other than the following, can be placed between the IVDEP directive statement and the DO statement: o An UNROLL directive o Placeholder lines o Comment lines o Blank lines The IVDEP directive is applied to a DO loop in which the user knows that dependences are in lexical order. For example, if two memory references in the loop touch the same memory location and one of them modifies the memory location, then the first reference to touch the location has to be the one that appears earlier lexically in the program source code. This assumes that the right-hand side of an assignment statement is "earlier" than the left-hand side. The IVDEP directive informs the compiler that the program would behave correctly if the statements were executed in certain orders other than the sequential execution order, such as executing the first statement or block to completion for all iterations, then the next statement or block for all iterations, and so forth. The optimizer can use this information, along with whatever else it can prove about the dependences, to choose other execution orders. Examples: In the following example, the IVDEP directive provides more information about the dependences within the loop, which may enable loop transformations to occur: !DEC$ IVDEP DO I=1, N A(INDARR(I)) = A(INDARR(I)) + B(I) END DO In this case, the scalar execution order follows: 1. Retrieve INDARR(I). 2. Use the result from step 1 to retrieve A(INDARR(I)). 3. Retrieve B(I). 4. Add the results from steps 2 and 3. 5. Store the results from step 4 into the location indicated by A(INDARR(I)) from step 1. IVDEP directs the compiler to initially assume that when steps 1 and 5 access a common memory location, step 1 always accesses the location first because step 1 occurs earlier in the execution sequence. This approach lets the compiler reorder instructions, as long as it chooses an instruction schedule that maintains the relative order of the array references. 5 MESSAGE cDEC$ MESSAGE Specifies a character string to be sent to the standard output device during the first compiler pass; this aids debugging. This directive takes the following form: cDEC$ MESSAGE:string c Is one of the following: C (or c), !, or *. string Is a character constant specifying a message. For compatibility, !MS$MESSAGE can be used in place of cDEC$ MESSAGE. Examples: Consider the following: !DEC$ MESSAGE:'Compiling Sound Speed Equations' 5 OBJCOMMENT cDEC$ OBJCOMMENT Specifies a library search path in an object file. This directive takes the following form: cDEC$ OBJCOMMENT LIB:library c Is one of the following: C (or c), !, or *. library Is a character constant specifying the name and, if necessary, the path of the library that the linker is to search. The linker searches for the library named by the OBJCOMMENT directive as if you named it on the command line, that is, before default library searches. You can place multiple library search directives in the same source file. Each search directive appears in the object file in the order it is encountered in the source file. If the OBJCOMMENT directive appears in the scope of a module, any program unit that uses the module also contains the directive, just as if the OBJCOMMENT directive appeared in the source file using the module. If you want to have the OBJCOMMENT directive in a module, but do not want it in the program units that use the module, place the directive outside the module that is used. For compatibility, !MS$OBJCOMMENT can be used in place of cDEC$ OBJCOMMENT. Examples: Consider the following: ! MOD1.F90 MODULE a !DEC$ OBJCOMMENT LIB: "opengl32.lib" END MODULE a ! MOD2.F90 !DEC$ OBJCOMMENT LIB: "graftools.lib" MODULE b ! END MODULE b ! USER.F90 PROGRAM go USE a ! library search contained in MODULE a ! included here USE b ! library search not included END 5 OPTIONS cDEC$ OPTIONS Affects data alignment and warnings about data alignment. The OPTIONS directive takes the following form: cDEC$ OPTIONS option [option] ... cDEC$ END OPTIONS c Is one of the following: C (or c), !, or *. option Is one or both of the following: o /WARN=[NO]ALIGNMENT Controls whether warnings are issued by the compiler for data that is not naturally aligned. By default, you receive compiler messages when misaligned data is encountered (/WARN=ALIGNMENT). o /[NO]ALIGN[=p] Controls whether the VSI Fortran compiler naturally aligns fields in derived-type and record structures and data items in common blocks for performance reasons, or whether the compiler packs those fields and data items together on arbitrary byte boundaries. p Is a specifier with one of the following forms: [class =] rule (class = rule,...) ALL NONE class Is one of the following keywords: COMMONS (for common blocks) RECORDS (for derived-type and record structures) STRUCTURES (a synonym for RECORDS) rule Is one of the following keywords: PACKED - Packs fields in structures or data items in common blocks on arbitrary byte boundaries. NATURAL - Naturally aligns fields in structures and data items in common blocks on up to 64-bit boundaries (inconsistent with the FORTRAN 77 standard). If you specify NATURAL, the compiler will naturally align all data in a common block, including INTEGER*8, REAL*8, and all COMPLEX data. STANDARD - Naturally aligns data items in common blocks on up to 32-bit boundaries (con- sistent with the FORTRAN 77 standard). Note that this keyword only applies to common blocks; so, you can specify /ALIGN=COMMONS=STANDARD, but you cannot specify /ALIGN=STANDARD. ALL Is the same as /ALIGN, /ALIGN=NATURAL, and /ALIGN=(RECORDS=NATURAL,COMMONS=NATURAL). NONE Is the same as /NOALIGN, /ALIGN=PACKED, and /ALIGN=(RECORDS=PACKED,COMMONS=PACKED) cDEC$ OPTIONS (and accompanying cDEC$ END OPTIONS) directives must come after OPTIONS, SUBROUTINE, FUNCTION, and BLOCK DATA statements (if any) in the program unit, and before statement functions or the executable part of the program unit. For performance reasons, VSI Fortran always aligns local data items on natural boundaries. However, EQUIVALENCE, COMMON, RECORD, and STRUCTURE data declaration statements can force misaligned data. If /WARN=NOALIGNMENT is specified, warnings will not be issued if misaligned data is encountered. NOTE Misaligned data significantly increases the time it takes to execute a program. As the number of misaligned fields encountered increases, so does the time needed to complete program execution. Specifying cDEC$ OPTIONS/ALIGN (or the /ALIGN compiler option) minimizes misaligned data. To request aligned, data in common blocks, specify /ALIGN=COMMONS=STANDARD (for data items up to 32 bits in length) or /ALIGN=COMMONS=NATURAL (for data items up to 64 bits in length), or place source data declarations within the common block in descending size order, so that each data field is naturally aligned. To request packed, unaligned data in a record structure, specify /ALIGN=RECORDS=PACKED, or consider placing source data declarations for the record so that the data is naturally aligned. The OPTIONS directive supersedes the /ALIGN compiler option. OPTIONS directives must be balanced and can be nested up to 100 levels, for example: CDEC$ OPTIONS /ALIGN=PACKED ! Group A declarations CDEC$ OPTIONS /ALIGN=RECO=NATU ! Group B more declarations CDEC$ END OPTIONS ! End of Group B still more declarations CDEC$ END OPTIONS ! End of Group A Note that common blocks within Group B will be PACKED. The CDEC$ OPTION specification for Group B only applies to RECORDS, so COMMONS retains the previous setting (in this case, from the Group A specification). For more information on alignment and data sizes, see the HP Fortran for OpenVMS User Manual. 5 PACK cDEC$ PACK Specifies the memory starting addresses of derived-type items. It takes the following form: cDEC$ PACK:[{1 | 2 | 4}] c Is one of the following: C (or c), !, or *. Items of derived types and record structures are aligned in memory on the smaller of two sizes: the size of the type of the item, or the current alignment setting. The current alignment setting can be 1, 2, 4, or 8 bytes. The default initial setting is 8 bytes (unless a compiler option specifies otherwise). By reducing the alignment setting, you can pack variables closer together in memory. The PACK directive lets you control the packing of derived-type or record structure items inside your program by overriding the current memory alignment setting. For example, if CDEC$ PACK:1 is specified, all variables begin at the next available byte, whether odd or even. Although this slightly increases access time, no memory space is wasted. If CDEC$ PACK:4 is specified, INTEGER(1), LOGICAL(1), and all character variables begin at the next available byte, whether odd or even. INTEGER(2) and LOGICAL(2) begin on the next even byte; all other variables begin on 4-byte boundaries. If the PACK directive is specified without a number, packing reverts to the compiler option setting (if any), or the default setting of 8. The directive can appear anywhere in a program before the derived-type definition or record structure definition. It cannot appear inside a derived-type or record structure definition. For compatibility, !MS$PACK can be used in place of cDEC$ PACK. Examples: Consider the following: ! Use 4-byte packing for this derived type ! Note PACK is used outside of the derived-type definition !DEC$ PACK:4 TYPE pair INTEGER a, b END TYPE ! revert to default or compiler option !DEC$ PACK: 5 PSECT cDEC$ PSECT /common-name/ attr [,attr,...] Lets you modify several characteristics of a common block. Specify the name of a common block, preceded and followed by a slash, and one of the following keywords ("attr"): o ALIGN=val or ALIGN=keyword Specifies alignment for the common block. "val" must be a constant ranging from 0 through 16. The specified number is interpreted as a power of 2. The value of the expression is the alignment in bytes. "keyword" is one of the following: Keyword Equivalent to "val" BYTE 0 WORD 1 LONG 2 QUAD 3 OCTA 4 PAGE [see note] Alpha: 16 Intel: 12 note: Range for Alpha is 0 to 16; for Intel, 0 to 12. The default is octaword alignment (4). o GBL Specifies global scope. This is the default scope. o LCL Specifies local scope. This keyword is opposite to GBL and cannot appear with it. o [NO]MULTILANGUAGE Controls whether the compiler pads the size of overlaid psects (program sections) to ensure compatibility when the psect is shared by code created by other OpenVMS compilers. When a psect generated by a Fortran common block is overlaid with a psect consisting of a C structure, linker error messages can occur. This is because the sizes of the psects are inconsistent; the C structure is padded, but the Fortran common block is not. Specifying MULTILANGUAGE ensures that VSI Fortran follows a consistent psect size allocation scheme that works with HP C psects shared across multiple images. Psects shared in a single image do not have a problem. The default is NOMULTILANGUAGE. This is also the default behavior of HP Fortran 77 and is sufficient for most applications. To specify MULTILANGUAGE for all COMMON blocks in a module, use compiler option /ALIGN=COMMON=MULTILANGUAGE. (For more information, see the HP Fortran for OpenVMS User Manual.) o [NO]SHR Determines whether the contents of a common block can be shared by more than one process. The default is NOSHR. o [NO]WRT Determines whether the contents of a common block can be modified during program execution. The default is WRT. Global or local scope is significant for an image that has more than one cluster. Program sections with the same name that are from different modules in different clusters are placed in separate clusters if local scope is in effect. They are placed in the same cluster if global scope is in effect. If one program unit changes one or more characteristics of a common block, all other units that reference that common block must also change those characteristics in the same way. Default characteristics apply if you do not modify them with a PSECT directive. See the "OpenVMS Linker Utility Manual" for detailed information about default attributes of common blocks. 5 REAL cDEC$ REAL Specifies the default real kind. It takes the following form: cDEC$ REAL:{4 | 8 | 16} c Is one of the following: C (or c), !, or *. The REAL directive specifies a size of 4 (KIND=4), 8 (KIND=8), or 16 (KIND=16) bytes for default real numbers. When the REAL directive is effect, all default real variables are of the kind specified in the directive. Only numbers specified or implied as REAL without KIND are affected. The REAL directive can only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directive cannot appear between program units, or at the beginning of internal subprograms. It does not affect modules invoked with the USE statement in the program unit that contains it. For compatibility, !MS$REAL can be used in place of cDEC$ REAL. Consider the following: REAL r ! a 4-byte REAL WRITE(*,*) KIND(r) CALL REAL8( ) WRITE(*,*) KIND(r) ! still a 4-byte REAL ! not affected by setting in subroutine END SUBROUTINE REAL8( ) !DEC$ REAL:8 REAL s ! an 8-byte REAL WRITE(*,*) KIND(s) END SUBROUTINE 5 STRICT_and_NOSTRICT cDEC$ STRICT cDEC$ NOSTRICT The STRICT directive disables language features not found in the language standard specified on the command line (Fortran 95 or Fortran 90). The NOSTRICT directive (the default) enables these language features. The "c" in cDEC$ is one of the following: a C (or c), !, or *. If STRICT is specified and no language standard is specified on the command line, the default is to disable features not found in Fortran 90. The STRICT and NOSTRICT directives can appear only appear at the top of a program unit. A program unit is a main program, an external subroutine or function, a module or a block data program unit. The directives cannot appear between program units, or at the beginning of internal subprograms. They do not affect any modules invoked with the USE statement in the program unit that contains them. For compatibility, !MS$STRICT and !MS$NOSTRICT can be used in place of cDEC$ STRICT and cDEC$ NOSTRICT. Examples: Consider the following: ! NOSTRICT by default TYPE stuff INTEGER(4) k INTEGER(4) m CHARACTER(4) name END TYPE stuff TYPE (stuff) examp DOUBLE COMPLEX cd ! non-standard data type, no error cd =(3.0D0, 4.0D0) examp.k = 4 ! non-standard component designation, ! no error END SUBROUTINE STRICTDEMO( ) !DEC$ STRICT TYPE stuff INTEGER(4) k INTEGER(4) m CHARACTER(4) name END TYPE stuff TYPE (stuff) samp DOUBLE COMPLEX cd ! ERROR cd =(3.0D0, 4.0D0) samp.k = 4 ! ERROR END SUBROUTINE 5 TITLE_and_SUBTITLE cDEC$ TITLE string cDEC$ SUBTITLE string The TITLE directive lets you specify a string and place it in the title field of a listing header. Similarly, SUBTITLE lets you place a specified string in the subtitle field of a listing header. The "string" is a character constant containing up to 31 printable characters. To enable TITLE and SUBTITLE directives, you must specify the /LIST compiler option. When TITLE or SUBTITLE appears on a page of a listing file, the specified string appears in the listing header of the following page. If two or more of either directive appear on a page, the last directive is the one in effect for the following page. If either directive does not specify a string, no change occurs in the listing file header. For compatibility, !MS$TITLE: and !MS$SUBTITLE: can be used in place of cDEC$ TITLE and cDEC$ SUBTITLE. 5 UNROLL cDEC$ UNROLL The UNROLL directive tells the compiler's optimizer how many times to unroll a DO loop. It can only be applied to iterative DO loops. The UNROLL directive takes the following form: cDEC$ UNROLL [(n)] c Is one of the following: C (or c), !, or *. n Is an integer constant. The range of "n" is 0 through 255. The UNROLL directive must precede the DO statement for each DO loop it affects. No source code lines, other than the following, can be placed between the UNROLL directive statement and the DO statement: o An IVDEP directive o Placeholder lines o Comment lines o Blank lines If "n" is specified, the optimizer unrolls the loop "n" times. If "n" is omitted, or if it is outside the allowed range, the optimizer picks the number of times to unroll the loop. The UNROLL directive overrides any setting of loop unrolling from the command line. 3 ACCEPT Transfers input data to internal storage from external records accessed under the sequential mode of access. It takes one of the following forms: Formatted ACCEPT f[,iolist] List-directed ACCEPT *[,iolist] Namelist ACCEPT n f Is a format specifier not prefaced by FMT=. iolist Is a simple I/O list element or an implied-DO list. * Specifies list-directed formatting (can be specified as FMT=*). n The nonkeyword form of a namelist specifier. The control-list parameters are "f," "*" (or FMT=*), and "n". The I/O list parameter is "iolist". The formatted ACCEPT statement transfers data from your terminal to internal storage. The access mode is sequential. The list-directed ACCEPT statement translates the data from character to binary format according to the data types of the variables in the I/O list. The namelist ACCEPT statement translates the data from character to binary format according to the data types of the list entities in the corresponding NAMELIST statement. Also see the READ Statement. 3 ALLOCATABLE Specifies that an array is an allocatable array with a deferred shape. The shape of an allocatable array is determined when an ALLOCATE statement is executed, dynamically allocating space for the array. The ALLOCATABLE attribute can be specified in a type declaration statement or an ALLOCATABLE statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] ALLOCATABLE [,att-ls] :: a[(d-spec)] [,a[(d-spec)]]... Statement: ALLOCATABLE [::] a[(d-spec)] [,a[(d-spec)]]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. a Is the name of the allocatable array; it must not be a dummy argument or function result. d-spec Is a deferred-shape specification (: [,:]...). Each colon represents a dimension of the array. If the array is given the DIMENSION attribute elsewhere in the program, it must be declared as a deferred-shape array. When the allocatable array is no longer needed, it can be deallocated by execution of a DEALLOCATE statement. During program execution, the allocation status of an allocatable array is one of the following: o Not currently allocated The array was never allocated or the last operation performed on it was a deallocation. Deallocation is performed: - Explicitly, by using a DEALLOCATE statement. - By default, when the allocatable array is a local variable of a procedure that does not have the SAVE attribute and is terminated by an END or RETURN statement. An array that is not currently allocated must not be referenced or defined. o Currently allocated The array was allocated by an ALLOCATE statement. Such an array can be referenced, defined, or deallocated. An allocatable array cannot be specified in a COMMON, EQUIVALENCE, DATA, or NAMELIST statement. Allocatable arrays are not saved by default. If you want to retain the values of an allocatable array across procedure calls, you must specify the SAVE attribute for the array. The ALLOCATABLE attribute is compatible with the AUTOMATIC, DIMENSION (with deferred shape), PRIVATE, PUBLIC, SAVE, STATIC, TARGET, and VOLATILE attributes. EXAMPLES: The following example shows a type declaration statement specifying the ALLOCATABLE attribute: REAL, ALLOCATABLE :: Z(:, :, :) The following is an example of the ALLOCATABLE statement: REAL A, B(:) ALLOCATABLE :: A(:,:), B 3 ALLOCATE Dynamically creates storage for allocatable arrays and pointer targets. The storage space allocated is uninitialized. The ALLOCATE statement takes the following form: ALLOCATE (object [(s-spec[,s-spec...])] [,object[(s-spec[,s-spec...])]]...[,STAT=sv]) object Is the object to be allocated. It is a variable name or structure component, and must be a pointer or allocatable array. The object can be of type character with zero length. s-spec Is a shape specification in the form [lower-bound:]upper-bound. Each bound must be a scalar integer expression. The number of shape specifications must be the same as the rank of the "object". sv Is a scalar integer variable in which the status of the allocation is stored. A bound in "s-spec" must not be an expression containing an array inquiry function whose argument is any allocatable object in the same ALLOCATE statement; for example, the following is not permitted: INTEGER ERR INTEGER, ALLOCATABLE :: A(:), B(:) ... ALLOCATE(A(10:25), B(SIZE(A)), STAT=ERR) ! A is invalid as an argu- ! ment to function SIZE If a STAT variable is specified, it must not be allocated in the ALLOCATE statement in which it appears. If the allocation is successful, the variable is set to zero. If the allocation is not successful, an error condition occurs, and the variable is set to a positive integer value (representing the run-time error). If no STAT variable is specified and an error condition occurs, program execution terminates. To release the storage for an allocated array, use the DEALLOCATE statement. To determine whether an allocatable array is currently allocated, use the ALLOCATED intrinsic function. To determine whether a pointer is currently associated with a target, use the ASSOCIATED intrinsic function. For information on allocation of allocatable arrays and pointer targets, see the HP Fortran for OpenVMS Language Reference Manual. EXAMPLES: The following is an example of the ALLOCATE statement: INTEGER J, N, ALLOC_ERR REAL, ALLOCATABLE :: A(:), B(:,:) ... ALLOCATE(A(0:80), B(-3:J+1, N), STAT = ALLOC_ERR) 3 ASSIGN Assigns the value of a statement label to an integer variable. This feature has been deleted in Fortran 95; it was an obsolescent feature in Fortran 90. VSI Fortran fully supports features deleted in Fortran 95. Statement format: ASSIGN s TO v s Is the label of an executable statement or a FORMAT statement. You must specify the label as an unsigned integer (from 1-5 characters long, using digits 0-9). v Is an integer variable. When the value of a statement label is assigned to an integer variable: the variable can then be used as a transfer destination in a subsequent assigned GOTO statement or as a format specifier in a formatted I/O statement. The ASSIGN statement must be in the same program unit as and must be executed before the statement(s) in which the assigned variable is used. 3 Assignment Assigns the value of the expression to the variable. Arithmetic/Logical/Character assignment takes the form: v = e v Is the name of a scalar or array of intrinsic or derived type (with no defined assignment). The array cannot be an assumed-size array, and neither the scalar nor the array can be declared with the PARAMETER or INTENT(IN) attribute. e Is an expression of intrinsic type or the same derived type as "v". Its shape must conform with "v". If necessary, it is converted to the same kind type as "v". Before a value is assigned to the variable, the expression part of the assignment statement and any expressions within the variable are evaluated. No definition of expressions in the variable can affect or be affected by the evaluation of the expression part of the assignment statement. NOTE: When the run-time system assigns a value to a scalar integer or character variable and the variable is shorter than the value being assigned, the assigned value may be truncated and significant bits (or characters) lost. This truncation can occur without warning, and can cause the run-time system to pass incorrect information back to the program. If the variable is a pointer, it must be associated with a definable target. The shape of the target and expression must conform and their types and kind type parameters must match. 4 Conversion_Rules The following tables summarize the conversion rules for assignment statements. Table 1: Conversion Rules for Integer, Logical, or Real Expressions +-------------+------------------------------------------------+ |Scalar | Expression (E) | |Memory |------------------------------------------------- |Reference (V)| integer, logical, or real | +-------------+------------------------------------------------+ | integer or | V=INT(E) | | logical | | +-------------+------------------------------------------------+ | REAL | V=REAL(E) | | (KIND=4) | | +-------------+------------------------------------------------+ | REAL | V=DBLE(E) | | (KIND=8) | | +-------------+------------------------------------------------+ | REAL | V=QEXT(E) | | (KIND=16) | | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(REAL(E), 0.0) | | (KIND=4) | | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(DBLE(E), 0.0) | | (KIND=8) | | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(QEXT(E), 0.0) | | (KIND=16) | | +-------------+------------------------------------------------+ Table 2: Conversion Rules for Complex Expressions +-------------+------------------------------------------------+ |Scalar | Expression (E) | |Memory |------------------------------------------------- |Reference (V)| complex | +-------------+------------------------------------------------+ | integer or | V=INT(REAL(E)) | | logical | Imaginary part of E is not used. | +-------------+------------------------------------------------+ | REAL | V=REAL(REAL(E)) | | (KIND=4) | Imaginary part of E is not used. | +-------------+------------------------------------------------+ | REAL | V=DBLE(REAL(E)) | | (KIND=8) | Imaginary part of E is not used. | +-------------+------------------------------------------------+ | REAL | V=QEXT(REAL(E)) | | (KIND=16) | Imaginary part of E is not used. | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(REAL(REAL(E)), REAL(AIMAG(E))) | | (KIND=4) | | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(DBLE(REAL(E)), DBLE(AIMAG(E))) | | (KIND=8) | | +-------------+------------------------------------------------+ | COMPLEX | V=CMPLX(QEXT(REAL(E)), QEXT(AIMAG(E))) | | (KIND=16) | | +-------------+------------------------------------------------+ 3 AUTOMATIC_and_STATIC Control the storage allocation of variables in subprograms. The AUTOMATIC and STATIC attributes can be specified in a type declaration statement or an AUTOMATIC or STATIC statement, and take one of the following forms: Type Declaration Statement: type, [att-ls,] AUTOMATIC [,att-ls] :: v [,v]... type, [att-ls,] STATIC [,att-ls] :: v [,v]... Statement: AUTOMATIC v [,v]... STATIC v [,v]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. v Is the name of a variable or an array specification. It can be of any type. AUTOMATIC and STATIC declarations only affect how data is allocated in storage, as follows: o A variable declared as AUTOMATIC and allocated in memory resides in the stack storage area. o A variable declared as STATIC and allocated in memory resides in the static storage area. If you want to retain definitions of variables upon reentry to subprograms, you must use the SAVE attribute. Automatic variables can reduce memory use because only the variables currently being used are allocated to memory. Automatic variables allow possible recursion. With recursion, a subprogram can call itself (directly or indirectly), and resulting values are available upon a subsequent call or return to the subprogram. For recursion to occur, RECURSIVE must be specified in one of the following ways: o As a keyword in a FUNCTION or SUBROUTINE statement o As a compiler option o As an option in an OPTIONS statement By default, the compiler allocates local variables of non-recursive subprograms, except for allocatable arrays, in the static storage area. The compiler may choose to allocate a variable in temporary (stack or register) storage if it notices that the variable is always defined before use. Appropriate use of the SAVE attribute can prevent compiler warnings if a variable is used before it is defined. To change the default for variables, specify them as AUTOMATIC or specify RECURSIVE (in one of the ways mentioned above). To override any compiler option that may affect variables, explicitly specify the variables as AUTOMATIC or STATIC. NOTE Variables that are data-initialized, and variables in COMMON and SAVE statements are always static. This is regardless of whether a compiler option specifies recursion. A variable cannot be specified as AUTOMATIC or STATIC more than once in the same scoping unit. If the variable is a pointer, AUTOMATIC or STATIC apply only to the pointer itself, not to any associated target. Some variables cannot be specified as AUTOMATIC or STATIC. The following table shows these restrictions: Variable AUTOMATIC STATIC -------- --------- ------ Dummy argument No No Automatic object No No Common block item No Yes Use-associated item No No Function result No No Component of a derived type No No A variable can be specified with both the STATIC and SAVE attributes. If a variable is in a module's outer scope, it can be specified as STATIC, but not as AUTOMATIC. The AUTOMATIC attribute is compatible with the ALLOCATABLE, DIMENSION, POINTER, TARGET, and VOLATILE attributes. The STATIC attribute is compatible with the ALLOCATABLE, DIMENSION, POINTER, PRIVATE, PUBLIC, SAVE, TARGET, and VOLATILE attributes. 3 BACKSPACE Positions a sequential file at the beginning of the preceding record, making it available for subsequent I/O processing. The file must be on disk or tape. Statement format: BACKSPACE ([UNIT=]io-unit [,ERR=label] [,IOSTAT=i-var]) BACKSPACE io-unit io-unit Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. label Is the label of a statement that receives control if an error occurs, prefaced by ERR=. i-var Is a scalar integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT= (positive if an error occurs, zero if no error occurs). A BACKSPACE statement should not be specified for a file that is open for direct, append, or keyed access, because record "n" is not available to the RMS I/O system. If a file is already positioned at the beginning of a file, a BACKSPACE statement has no effect. 3 BLOCK_DATA Begins a block data program unit. Statement format: BLOCK DATA [nam] [stmts] END [BLOCK DATA [nam]] nam Is the symbolic name used to identify the block. stmts Is one or more of the following statements: COMMON PARAMETER Type declaration DATA POINTER Derived-type definition DIMENSION RECORD Record structure declaration EQUIVALENCE SAVE IMPLICIT TARGET INTRINSIC USE Note: A type declaration cannot contain the ALLOCATABLE, EXTERNAL, INTENT, OPTIONAL, PRIVATE, or PUBLIC attributes. A BLOCK DATA statement and its associated specification statements are a special kind of program unit, called a block data subprogram. A block data program unit need not be named, but there can only be one unnamed block data program unit in an executable program. A block data subprogram must not contain any executable statements. As with other types of program units, the last statement in a block data subprogram must be an END statement. If a name follows the END statement, it must be the same as the name specified in the BLOCK DATA statement. Within a block data subprogram, if a DATA statement initializes any entity in a named common block, the subprogram must have a complete set of specification statements that establishes the common block. However, all of the entities in the block do not have to be assigned initial values in a DATA statement. One block data subprogram can establish and define initial values for more than one common block. The name of a block data subprogram can appear in the EXTERNAL statement of a different program unit to force a search of object libraries for the BLOCK DATA program unit at link time. 3 CALL Transfers control and passes arguments to a subprogram. Statement format: CALL sub[([a][,[a]]...)] sub Is the name of the subroutine subprogram or other external procedure, or a dummy argument associated with a subroutine subprogram or other external procedure. a Is an actual argument optionally preceded by [keyword=], where "keyword" is the name of a dummy argument in the explicit interface for the subroutine. The keyword is assigned a value when the procedure is invoked. Each actual argument must be a variable, an expression, the name of a procedure, or an alternate return specifier. (It must not be the name of an internal procedure, statement function, or the generic name of a procedure.) An alternate return specifier is an asterisk (*) or ampersand (&) followed by the label of an executable branch target statement in the same scoping unit as the CALL statement. NOTE An alternate return is an obsolescent feature in Fortran 95 and Fortran 90. VSI Fortran fully supports this feature. When the CALL statement is executed, any expressions in the actual argument list are evaluated, then control is passed to the first executable statement or construct in the subroutine. When the subroutine finishes executing, control returns to the next executable statement following the CALL statement, or to a statement identified by an alternate return label (if any). If an argument list appears, each actual argument is associated with the corresponding dummy argument by its position in the argument list or by the name of its keyword. The arguments must agree in type and kind type parameters. If positional arguments and argument keywords are specified, the argument keywords must appear last in the actual argument list. If a dummy argument is optional, the actual argument can be omitted. An actual argument associated with a dummy procedure must be the specific name of a procedure, or be another dummy procedure. Certain specific intrinsic function names must not be used as actual arguments. (See the HP Fortran for OpenVMS Language Reference Manual.) You can use a CALL statement to invoke a function as long as the function is not one of the following types: o REAL(8) o REAL(16) o COMPLEX(8) o COMPLEX(16) o CHARACTER EXAMPLES: The following example shows a subroutine with argument keywords: PROGRAM KEYWORD_EXAMPLE INTERFACE SUBROUTINE TEST_C(I, L, J, KYWD2, D, F, KYWD1) INTEGER I, L(20), J, KYWD1 REAL, OPTIONAL :: D, F COMPLEX KYWD2 ... END SUBROUTINE TEST_C END INTERFACE INTEGER I, J, K INTEGER L(20) COMPLEX Z1 CALL TEST_C(I, L, J, KYWD1 = K, KYWD2 = Z1) ... The first three actual arguments are associated with their corresponding dummy arguments by position. The argument keywords are associated by keyword name, so they can appear in any order. Note that the interface to subroutine TEST has two optional arguments that have been omitted in the CALL statement. 3 CASE Conditionally executes one block of constructs or statements depending on the value of a scalar expression in a SELECT CASE statement. Statement format: [name :] SELECT CASE (expr) [CASE (case-value [,case-value]...) [name] block]... [CASE DEFAULT [name] block] END SELECT [name] name Is the name of the CASE construct. expr Is an expression of type integer, logical, or character (enclosed in parentheses). Evaluation of this expression results in a value called the case index. case-value Is one or more compile-time constant expressions of type integer, logical, or character (enclosed in parentheses). Each "case-value" must be of the same data type as "expr". If the type is character, "case-value" and "expr" can be of different lengths. Integer and character expressions can be expressed as a range of case values, taking one of the following forms: low:high low: :high Case values must not overlap. block Is a sequence of zero or more statements or constructs. If a construct name is specified in a SELECT CASE statement, the same name must appear in the corresponding END SELECT statement. The same construct name can optionally appear in any CASE statement in the construct. The case expression ("expr") is evaluated first. The resulting case index is compared to the case values to find a matching value (there can only be one). When a match occurs, the block following the matching case value is executed and the construct terminates. The following rules determine whether a match occurs: o When the case value is a single value (no colon appears), a match occurs as follows: Data Type A Match Occurs If: --------- --------------------------- Logical case-index .EQV. case-value Integer or character case-index == case-value o When the case value is a range of values (a colon appears), a match depends on the range specified, as follows: Range A Match Occurs If: ----- ------------------------- low: case-index >= low :high case-index <= high low:high low <= case-index <= high The following are all valid case values: CASE (1, 4, 7, 11:14, 22) ! Individual values as specified: ! 1, 4, 7, 11, 12, 13, 14, 22 CASE (:-1) ! All values less than zero CASE (0) ! Only zero CASE (1:) ! All values above zero If no match occurs but a CASE DEFAULT statement is present, the block following that statement is executed and the construct terminates. If no match occurs and no CASE DEFAULT statement is present, no block is executed, the construct terminates, and control passes to the next executable statement or construct following the END SELECT statement. The following are examples of CASE constructs: INTEGER FUNCTION STATUS_CODE (I) INTEGER I CHECK_STATUS: SELECT CASE (I) CASE (:-1) STATUS_CODE = -1 CASE (0) STATUS_CODE = 0 CASE (1:) STATUS_CODE = 1 END SELECT CHECK_STATUS END FUNCTION STATUS_CODE SELECT CASE (J) CASE (1, 3:7, 9) ! Values: 1, 3, 4, 5, 6, 7, 9 CALL SUB_A CASE DEFAULT CALL SUB_B END SELECT The following three examples are equivalent: 1. SELECT CASE (ITEST .EQ. 1) CASE (.TRUE.) CALL SUB1 () CASE (.FALSE.) CALL SUB2 () END SELECT 2. SELECT CASE (ITEST) CASE DEFAULT CALL SUB2 () CASE (1) CALL SUB1 () END SELECT 3. IF (ITEST .EQ. 1) THEN CALL SUB1 () ELSE CALL SUB2 () END IF 3 CLOSE Closes a file. Statement format: CLOSE ([UNIT=]io-unit[,p][,ERR=label][,IOSTAT=i-var]) io-unit Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. p Is the disposition of the file after closing, prefaced by STATUS=, DISPOSE= or DISP=. Dispositions are as follows: 'KEEP' Retains the file. *DEFAULT FOR ALL BUT SCRATCH FILES* 'SAVE' Retains the file. 'DELETE' Deletes the file (unless OPEN(READONLY) is specified). *DEFAULT FOR SCRATCH FILES* 'PRINT' Submits the file as a print job. 'PRINT/DELETE' Submits the file as a print job, then deletes it. 'SUBMIT' Submits the file as a batch job. 'SUBMIT/DELETE' Submits the file as a batch job, then deletes it. label Is the label of an executable statement that receives control if an error occurs. i-var Is a scalar integer variable. (Returns a zero if no error condition exists or a positive integer if an error condition exists.) The CLOSE statement specifiers can appear in any order. An I/O unit must be specified, but the UNIT specifier is optional if the unit specifier is the first item in the I/O control list. The status specified in the CLOSE statement supersedes the status specified in the OPEN statement, except that a file opened as a scratch file cannot be saved, printed, or submitted, and a file opened for read-only access cannot be deleted. If a CLOSE statement is specified for a unit that is not open, it has no effect. 3 COMMON Defines one or more contiguous blocks of storage shared among separate subprograms. You can define the same common block in different program units of your program. The first COMMON statement in a program unit to name a common block defines it; subsequent COMMON statements that name the block reference it. You can leave one common block (the "blank" common block) unnamed. Statement format: COMMON [/[cb]/] nlist[[,] /[cb] /nlist]... cb Is a symbolic name that identifies the common block. nlist Is one or more names of variables that identify items in the common block. The variable must not be a dummy argument, allocatable array, automatic object, function, function result, or entry to a procedure. It must not have the PARAMETER attribute. If an object of derived type is specified, it must be a sequence type. A common block is a global entity, and must not have the same name as any other global entity in the program, such as a subroutine or function. Any common block name, blank or otherwise, can appear more than once in one or more COMMON statements in a program unit. The list following each successive appearance of the same common block name is treated as a continuation of the list for the block associated with that name. A variable can appear in only one common block within a scoping unit. If an array is specified, it can be followed by an explicit-shape array specification. The array must not have the POINTER attribute and each bound in the specification must be a constant specification expression. A pointer can only be associated with pointers of the same type, kind type parameters, and rank. Nonpointer variables can be associated if they are of different numeric type. A common block can have the same name as a variable, array, record, structure, or field. However, in a program with one or more program units, a common block cannot have the same name as a function, subroutine, or entry name in the executable program. When common blocks from different program units have the same name, they share the same storage area when the units are combined into an executable program. Entities are assigned storage in common blocks on a one-for-one basis. Thus, the entities assigned by a COMMON statement in one program unit should agree with the data type of entities placed in a common block by another program unit; for example, consider a program unit containing the following statement: COMMON CENTS Consider another program unit containing the following statements: INTEGER*2 MONEY COMMON MONEY When these program units are combined into an executable program, incorrect results can occur if the 2-byte integer variable MONEY is made to correspond to the lower-addressed two bytes of the real variable CENTS. Named common blocks must be declared to have the same size in each program unit. Blank common can have different lengths in different program units. 3 CONTAINS Separates the body of a main program, module, or external subprogram from any internal or module procedures it may contain. It is not executable. Statement format: CONTAINS 3 CONTINUE Transfers control to the next executable statement. The CONTINUE statement is used primarily as the terminal statement of a labeled DO loop when that loop would otherwise end improperly with a GOTO, arithmetic IF, or other prohibited control statement. Statement format: CONTINUE The statement by itself does nothing and has no effect on program results or execution sequence. 3 CYCLE Terminates the current execution cycle of the innermost (or named) DO construct. Statement format: CYCLE [name] name Is the name of the DO construct. When a CYCLE statement is executed, the following occurs: 1. The current execution cycle of the named (or innermost) DO construct is terminated. If a DO construct name is specified, the CYCLE statement must be within the range of that construct. 2. The iteration count (if any) is decremented by 1. 3. The DO variable (if any) is incremented by the value of the increment parameter (if any). 4. A new iteration cycle of the DO construct begins. Any executable statements following the CYCLE statement (including a labeled terminal statement) are not executed. A CYCLE statement can be labeled, but it cannot be used to terminate a DO construct. The following example shows the CYCLE statement: DO I =1, 10 A(I) = C + D(I) IF (D(I) < 0) CYCLE ! If true, the next statement is omitted A(I) = 0 ! from the loop and the loop is tested again. END DO 3 DATA Assigns values to variables at compile time. The values within the backslashes are assigned to the preceding variables left to right; the number of values must equal the number of variable elements. Statement format: DATA nlist/clist/[[,] nlist/clist]... nlist Is a list combining any combination of variables and implied-DO lists, separated by commas. RECORD structures are not allowed in this list. Subscript expressions and expressions in substring references must be initialization expressions. An implied-DO list in a DATA statement takes the following form: (dlist, i = n1,n2[,n3]) dlist Is a list of one or more array elements, character substrings, scalar structure components or implied-DO lists, separated by commas. i Is the name of a scalar integer variable. n1,n2,n3 Are scalar integer expressions. The expression can contain implied-DO variables of other implied-DO lists that have this implied-DO list within their ranges. clist Is a list of constants separated by commas; "clist" constants take one of the following forms: c OR n*c c Is a constant or the symbolic name of a constant. n Defines the number of times the same value is to be assigned to successive entities in the associated "nlist"; "n" is a nonzero, unsigned integer constant or the symbolic name of an unsigned integer constant. The DATA statement assigns the constant values in each "clist" to the entities in the preceding "nlist", from left to right, as they appear in the "nlist". The number of constants must equal the number of entities in the "nlist". When an unsubscripted array name appears in a DATA statement, values are assigned to every element of that array in the order of subscript progression. The associated constant list must contain enough values to fill the array. The following objects cannot be initialized in a DATA statement: o A dummy argument o A function o A function result o An automatic object o An allocatable array o A variable that is accessible by use or host association o A variable in a named common block (unless the DATA statement is in a block data program unit) o A variable in blank common For details, see the HP Fortran for OpenVMS Language Reference Manual. 3 DEALLOCATE Frees storage allocated for allocatable arrays and pointer targets. It takes the following form: DEALLOCATE (object [,object]...[,STAT=sv]) object Is a structure component or the name of a variable, and must be a pointer or allocatable array. sv Is a scalar integer variable in which the status of the deallocation is stored. If a STAT variable is specified, it must not be deallocated in the DEALLOCATE statement in which it appears. If the deallocation is successful, the variable is set to zero. If the deallocation is not successful, an error condition occurs, and the variable is set to a positive integer value (representing the run-time error). If no STAT variable is specified and an error condition occurs, program execution terminates. It is recommended that all explicitly allocated storage be explicitly deallocated when it is no longer needed. For information on deallocation of allocatable arrays and pointer targets, see the HP Fortran for OpenVMS Language Reference Manual. EXAMPLES: The following is an example of the DEALLOCATE statement: INTEGER ALLOC_ERR REAL, ALLOCATABLE :: A(:), B(:,:) ... ALLOCATE (A(10), B(-2:8,1:5)) ... DEALLOCATE(A, B, STAT = ALLOC_ERR) 3 DECODE See COMPATIBILITY_FEATURES in this Help file. 3 DEFINE_FILE See COMPATIBILITY_FEATURES in this Help file. 3 DELETE Deletes a record from an indexed or a relative file. Statement format: Format -- Indexed: DELETE ([UNIT=]io-unit [,ERR=label] [,IOSTAT=i-var]) Deletes the current record (last record read) from an indexed file. Format -- Relative: DELETE ([UNIT=]io-unit [,REC=r] [,ERR=label] [,IOSTAT=i-var]) DELETE (io-unit'r [,ERR=label] [,IOSTAT=i-var]) Deletes the specified record from a relative file. io-unit Is the logical unit specifier, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. r Is a record position specifier, prefaced by REC=. io-unit'r Is a unit and a record position specifier, not prefaced by REC=. label Is the label of a statement to which control is transferred if an error occurs, prefaced by ERR=. i-var Is an I/O status specifier, prefaced by IOSTAT=. (Returns a zero if no error condition exists or a positive integer if an error condition exists.) The forms of the DELETE statement with relative files are direct access deletes. These forms delete the record specified by the number "r". The DELETE statement logically removes the appropriate record from the specified file by locating the record and marking it as a deleted record. A new record can be written into that position. If REC=r is omitted, the current record is deleted. When the direct access record is deleted, any associated variable is set to the next record number. 3 DIMENSION Specifies that an object is an array, and defines the shape of the array. The DIMENSION attribute can be specified in a type declaration statement or a DIMENSION statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] DIMENSION (spec) [,att-ls] :: a[(spec)] [,a[(spec)]]... Statement: DIMENSION [::] a(spec) [,a(spec)]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. spec Is an array specification. In a type declaration, any array specification following an array overrides any array specification following DIMENSION. a Is the symbolic name of the array. If the array is not defined in a type declaration statement, the array takes an implicit data type. An array can also be declared in the following statements: ALLOCATABLE, POINTER, TARGET, and COMMON. The DIMENSION attribute is compatible with the ALLOCATABLE, AUTOMATIC, INTENT, OPTIONAL, POINTER, PRIVATE, PUBLIC, SAVE, STATIC, TARGET, and VOLATILE attributes. See also DATA ARRAYS in this Help file. 3 DO Executes a block of statements repeatedly until the value of a control variable equals, exceeds, or is less than the terminal value, according to the control variable specified in the DO loop (indexed DO). The block of statements starts immediately following the DO statement. You can transfer control out of a DO loop, but not out of a parallel DO loop. Statement format: [name:] DO [s][,] v = e1,e2[,e3] block [s] term-stmt name Is the name of the DO construct. s Is an optional label of an executable statement which follows the DO statement in the same program unit. The label designates the last statement of the DO loop. If omitted, an END DO statement is required. v Is the control variable; an integer or real variable (it cannot be a record field). You cannot modify the control variable inside the DO loop. e1 Is the initial value of the control variable; an integer or real value. e2 Is the terminal value of the control variable; an integer or real value. e3 Is the value by which to increment the control variable after each execution of the DO loop; integer or real value. It cannot be 0. The default of e3 is 1. block Is a sequence of zero or more statements or constructs. term-stmt Is the terminal statement for the construct. If the iteration count (the number of executions of the DO range) is zero or negative, the body of the loop is not executed. If the /NOF77 compiler option is specified and the iteration count is zero or negative, the body of the loop is executed once. If a DO statement does not contain a terminal statement label, the construct must be terminated by an END DO statement. If it does contain a terminal statement label, the END DO is optional. If a construct name is specified in a block DO statement, the same name must appear in the terminal END DO statement. If no construct name is specified in the block DO statement, no name can appear in the terminal END DO statement. The construct name must be a unique identifier in the program unit. The following cannot be terminal statements for DO constructs: CYCLE, DO, END (for a program unit), EXIT, GO TO, IF, RETURN, or STOP. 3 DO_WHILE Executes a block of statements repeatedly until the value of a logical expression is false. Statement format: DO [s][,] WHILE (e) s Is the label of an executable statement which follows the DO statement in the same program unit. The label designates the last statement of the DO loop. If omitted, an END DO statement is required. e Is a logical expression. You can reference and modify the variable elements of the expression within the DO loop. You can transfer control out of a DO WHILE loop but not into a loop from elsewhere in the program. The DO WHILE statement tests the logical expression at the beginning of each execution of the loop, including the first. If the value of the expression is true, the statements in the body of the loop are executed; if the expression is false, control transfers to the statement following the loop. If no label appears in the DO WHILE statement, the DO WHILE loop must be terminated with an END DO statement. 3 ELSE Executes a block of statements if no preceding statement block in a block IF construct was executed. The block of statements starts immediately following the ELSE statement. The block is terminated by an END IF statement. Statement format: ELSE 3 ELSE_IF Executes a block of statements if no preceding statement block in a block IF construct was executed and if the value of a logical expression is true. The block of statements starts immediately following the ELSE IF statement. The block is terminated by another ELSE IF statement, an ELSE statement, or an END IF statement. Statement format: ELSE IF (e) THEN Where e represents a logical expression. 3 ELSEWHERE An optional statement in a WHERE construct. Statement format: ELSEWHERE (mask-expr2) [name] or ELSEWHERE [name] The "mask-expr2" is a logical array expression (called a mask expression). The "name" is the name of the WHERE construct. Assignment statements following an ELSEWHERE statement are executed as if they were WHERE statements with ".NOT. where-mask-expr". If ELSEWHERE specifies "mask-expr2", it is executed as "(.NOT. where-mask-expr) .AND. mask-expr2". See also STATEMENTS WHERE in this Help file. 3 ENCODE See COMPATIBILITY_FEATURES in this Help file. 3 END Marks the end of a program unit. The END statement must be present as the last statement of every program unit. In a main program, execution terminates if control reaches the END statement. In a subprogram, a RETURN statement is implicitly executed. Statement format: END 3 END_DO Terminates the block of statements following a DO or DO WHILE statement when a label is not used. Statement format: END DO 3 END_IF Terminates a block IF construct. Statement format: END IF 3 END_MAP Marks the end of a map declaration within a union declaration in a record structure declaration block. Terminates a field declaration or a series of field declarations that started with the MAP statement. The END MAP statement must be present in a map declaration. Statement format: END MAP 3 END_SELECT Marks the end of a CASE construct. Statement format: END SELECT [name] 3 END_STRUCTURE Marks the end of a record structure declaration. The END STRUCTURE statement must be present as the last statement of every record structure declaration. Statement format: END STRUCTURE 3 END_TYPE Marks the end of a derived-type definition. The END statement must be present as the last statement of every derived-type definition. Statement format: END TYPE For more information on derived types, see DATA DERIVED_TYPES in this Help file. 3 END_UNION Marks the end of a union declaration within a record structure declaration block. The END statement must be present as the last statement of every union declaration. Statement format: END UNION 3 ENDFILE For sequential files, writes an end-of-file record to the file and positions the file after this record (the terminal point). For direct access files, truncates the file after the current record. Statement format: ENDFILE ([UNIT=]io-unit[,ERR=label][,IOSTAT=i-var]) ENDFILE io-unit io-unit Is the logical unit specifier, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. label Is the label of an executable statement that receives control if an error occurs, prefaced by ERR=. i-var Is an I/O status specifier, prefaced by IOSTAT=. (Returns a zero if no error condition exists or a positive integer if an error condition exists.) If the unit specified in the ENDFILE statement is not open, the default file is opened for unformatted output. An end-of-file record can be written only to sequential organization files that are accessed as formatted sequential files or unformatted segmented sequential files. An ENDFILE statement performed on a direct access file always truncates the file. An ENDFILE statement must not be specified for a file that is open for keyed access. End-of-file records should not be written in files that are read by programs written in a language other than Fortran. 3 ENTRY Designates an alternate entry point at which execution of a subprogram can start. It is not executable and must precede any CONTAINS statement (if any) within the subprogram. Statement format: ENTRY nam [([p[,p]...])] [RESULT (r-name)]] nam Is a symbolic name for the entry point. The name must be unique among all global names in the program. In a function subprogram, the data type defined for or implied by the name and the data type of the function must be consistent within the following groups: Group 1: Type default integer, default real, double precision real, default complex, double complex, or default logical Group 2: REAL(KIND=16) and COMPLEX(KIND=16) Group 3: Type default character If the data type is character, the length of the string must be the same in both the entry and the function. p Is a dummy argument or an alternate return argument (designated by a *). The arguments must agree in order, number, and type with the actual arguments of the statement invoking the entry point. The arguments need not agree in name, order, number, or type with the dummy arguments in the SUBROUTINE or FUNCTION statement for the subprogram. You must use only the dummy arguments defined in the ENTRY statement. r-name Is the name of a function result. This name must not be the same as the name of the entry point, or the name of any other function or function result. This parameter can only be specified for function subprograms. The ENTRY statement is not executable and can appear within a function or subroutine program after the FUNCTION or SUBROUTINE statement. Execution of a subprogram referred to by an entry name begins with the first executable statement after the ENTRY statement. An ENTRY statement must not appear in a CASE, DO, IF, FORALL, or WHERE construct or a nonblock DO loop. 3 EQUIVALENCE Starts two or more data elements in one program unit at the same storage location, thereby overlaying them in memory. Statement format: EQUIVALENCE (nlist)[,(nlist)]... nlist Is a list of variables, array elements, arrays, or character substring references, separated by commas. You must specify at least two of these entities in each list. The elements named within each set of parentheses are given the same storage location. The data elements do not have to be of the same type or length. An equivalency begins with the first byte of each element. When an array or substring element is equivalenced, the entire array or string is equivalenced in its normal linear storage. You cannot equivalence array or string elements in a manner that is inconsistent with their normal linear order. You cannot equivalence elements of the same array or string. You cannot equivalence two elements that are both in common areas. The following objects cannot be specified in EQUIVALENCE statements: o A dummy argument o An allocatable array o A pointer o An object of nonsequence derived type o An object of sequence derived type containing a pointer in the structure o A function, entry, or result name o A named constant o A structure component o A subobject of any of the above objects You can identify a multidimensional array element by a single subscript. The single subscript designates the absolute position of the element within the array. 3 EXIT The EXIT statement terminates execution of a DO construct. Statement format: EXIT [name] name Is the name of the DO construct. The EXIT statement causes execution of the named (or innermost) DO construct to be terminated. If a DO construct name is specified, the EXIT statement must be within the range of that construct. Any DO variable present retains its last defined value. An EXIT statement can be labeled, but it cannot be used to terminate a DO construct. The following example shows an EXIT statement: LOOP_A : DO I = 1, 15 N = N + 1 IF (N > I) EXIT LOOP_A END DO LOOP_A 3 EXTERNAL Allows an external or dummy procedure to be used as an actual argument. (To specify intrinsic procedures as actual arguments, use the INTRINSIC statement.) The EXTERNAL attribute can be specified in a type declaration statement or an EXTERNAL statement, and takes one of the following forms: Type Declaration Statement: type [att-ls,] EXTERNAL [,att-ls] :: v[,v]... Statement: EXTERNAL v [,v]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. v Is the symbolic name of a user-supplied subprogram, or the name of a dummy argument associated with the name of a subprogram. If you name an intrinsic subprogram, that name becomes disassociated from the intrinsic subprogram and is assumed to be the name of an external object. You must use EXTERNAL statements in the following cases: - To identify subprogram or entry point names passed as actual arguments - To identify a block data program unit that will reside in a library module not explicitly referenced at link time. You do not need to use an EXTERNAL statement to identify a subprogram or entry point name used as the object of a CALL statement or function reference; these names are recognized as external implicitly. The EXTERNAL attribute is compatible with the OPTIONAL, PRIVATE, and PUBLIC attributes. 3 FIND See COMPATIBILITY_FEATURES in this Help file. 3 FORALL A generalization of the Fortran 95/90 WHERE statement and construct. It allows more general array shapes to be assigned, especially in construct form. Statement format: FORALL (triplet-spec [,triplet-spec]...[,mask-expr]) assign-stmt Construct format: [name: ] FORALL (triplet-spec [,triplet-spec]...[,mask-expr]) forall-body-stmt [forall-body-stmt]... END FORALL [name] name Is the name of the FORALL construct. triplet-spec Is a triplet specification with the following form: subscript-name = subscript-1 : subscript-2 [:stride] The "subscript-name" must be a scalar of type integer. It is valid only within the scope of the FORALL; its value is undefined on completion of the FORALL. The "subscript"s and "stride" cannot contain a reference to any "subscript-name" in "triplet-spec". The "stride" cannot be zero. If it is omitted, the default value is 1. Evaluation of an expression in a triplet specification must not affect the result of evaluating any other expression in another triplet specification. mask-expr Is a logical array expression (called the mask expression). If it is omitted, the value .TRUE. is assumed. The mask expression can reference the subscript name in "triplet-spec". assign-stmt Is an assignment statement or a pointer assignment statement. The variable being assigned to must be an array element or array section and must reference all subscript names included in all "triplet-spec"s. forall-body-stmt Is one of the following: o An "assign-stmt" o A WHERE statement or construct The WHERE statement or construct uses a mask to make array assignments. o A FORALL statement or construct If a construct name is specified in the FORALL statement, the same name must appear in the corresponding END FORALL statement. A FORALL statement is executed by first evaluating all bounds and stride expressions in the triplet specifications, giving a set of values for each subscript name. The FORALL assignment statement is executed for all combinations of subscript name values for which the mask expression is true. The FORALL assignment statement is executed as if all expressions (on both sides of the assignment) are completely evaluated before any part of the left side is changed. Valid values are assigned to corresponding elements of the array being assigned to. No element of an array can be assigned a value more than once. A FORALL construct is executed as if it were multiple FORALL statements, with the same triplet specifications and mask expressions. Each statement in the FORALL body is executed completely before execution begins on the next FORALL body statement. Any procedure referenced in the mask expression or FORALL assignment statement must be pure. Pure functions can be used in the mask expression or called directly in a FORALL statement. Pure subroutines cannot be called directly in a FORALL statement, but can be called from other pure procedures. EXAMPLES: Consider the following: FORALL(I = 1:N, J = 1:N, A(I, J) .NE. 0.0) B(I, J) = 1.0 / A(I, J) This statement takes the reciprocal of each nonzero element of array A(1:N, 1:N) and assigns it to the corresponding element of array B. Elements of A that are zero do not have their reciprocal taken, and no assignments are made to corresponding elements of B. Every array assignment statement and WHERE statement can be written as a FORALL statement, but some FORALL statements cannot be written using just array syntax. For example, the preceding FORALL statement is equivalent to the following: WHERE(A /= 0.0) B = 1.0 / A It is also equivalent to: FORALL (I = 1:N, J = 1:N) WHERE(A(I, J) .NE. 0.0) B(I, J) = 1.0/A(I, J) END FORALL However, the following FORALL example cannot be written using just array syntax: FORALL(I = 1:N, J = 1:N) H(I, J) = 1.0/REAL(I + J - 1) This statement sets array element H(I, J) to the value 1.0/REAL(I + J - 1) for values of I and J between 1 and N. Consider the following: TYPE MONARCH INTEGER, POINTER :: P END TYPE MONARCH TYPE(MONARCH), DIMENSION(8) :: PATTERN INTEGER, DIMENSION(8), TARGET :: OBJECT FORALL(J=1:8) PATTERN(J)%P => OBJECT(1+IEOR(J-1,2)) This FORALL statement causes elements 1 through 8 of array PATTERN to point to elements 3, 4, 1, 2, 7, 8, 5, and 6, respectively, of OBJECT. IEOR can be referenced here because it is pure. The following example shows a FORALL construct: FORALL(I = 3:N + 1, J = 3:N + 1) C(I, J) = C(I, J + 2) + C(I, J - 2) + C(I + 2, J) + C(I - 2, J) D(I, J) = C(I, J) END FORALL The assignment to array D uses the values of C computed in the first statement in the construct, not the values before the construct began execution. FORALL is a language feature of Fortran 95. 3 FORMAT Defines the conversion of data in formatted data transfer operations. Statement format: FORMAT (q1 f1s1 f2s2 ... fnsn qn) qn Is zero or more slash (/) record terminators. fn Is a data edit (field) descriptor, a control edit descriptor, a string edit descriptor, or a group of such descriptors enclosed in parentheses. sn Is a field separator (a comma or slash). A comma can be omitted in the following cases: o Between a P edit descriptor and an immediately following F, E, D, or G edit descriptor. o Before or after a slash (/) record terminator. o Before or after a colon (:) edit descriptor. The "data edit descriptor" has one of the following forms: [r]c [r]cw [r]cw.m [r]cw.d[Ee] r Is an optional repeat count. (If you omit r, the repeat count is assumed to be 1.) c Is a format code (I,O,Z,F,E,EN,ES,D,G,L, or A). w Is the external field width in characters. Each data item in the external medium is called an external field. m Is the minimum number of characters that must appear in the field (including leading zeros). d Is the number of characters to the right of the decimal point. E Is an exponent field. e Is the number of characters in the exponent. The ranges for "r", "w", "m", "d", and "e" are as follows: Term Range ---- __________ r 1 to 2147483647 (2**31-1) w 1 to 2147483647 m 0 to 32767 (2**15-1) d 0 to 32767 e 1 to 32767 The terms must all be unsigned integer constants or variable format expressions. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution. You cannot use PARAMETER constants for "r", "w", "m", "d", or "e". The "control edit descriptor" has one of the following forms: c [n]c c[n] c Is a format code (X,T,TL,TR,SP,SS,S,BN,BZ,P, Q, $, or :). n Is an optional number of characters or character positions. The term "n" must be an unsigned integer constant (for format code P, it can be signed or unsigned) or a variable format expression. A variable format expression is an integer variable or expression enclosed in angle brackets that takes the place of an integer constant. The value of the variable or variables can change during program execution. The value of "n" for P must be within the range -128 to 127. For all other format codes, the value of "n" must be within the range 1 through 2147483647 (2**31-1); actual useful ranges may be constrained by record sizes (RECL) and the file system. The "string edit descriptor" has one of the following forms: "string" 'string' nHc1...cn string Is a character literal constant. n Is the number of characters to be transferred. c1...cn Is a string of printable ASCII characters. Although no string edit descriptor can be preceded by a repeat specification, a parenthesized group of string edit descriptors can be preceded by a repeat specification. For more information, see FORMAT_SPECIFIERS in this Help file. 3 FUNCTION Begins a function subprogram. Identifies the data type of the function and names the dummy arguments. Format: [prefx] FUNCTION nam [([p[,p]...])] [RESULT (r-nam)] prefx Is either: typ [kywd] kywd [typ] typ Is a data type. If you do not specify a data type, the data type of the function is implied from its name. If the data type is CHARACTER, you can specify CHARACTER*(*) to indicate an assumed-length function type -- the function type assumes the length of its definition in the program unit invoking it. Assumed- length character functions are obsolescent in Fortran 95. VSI Fortran flags obsolescent features, but fully supports them. kywd Is one of the following: RECURSIVE Permits direct recursion to occur. If a function is directly recursive and array valued, RESULT must also be specified. PURE Restricts the procedure from having side effects. ELEMENTAL Specifies PURE with certain constraints: o A dummy argument: - Must be scalar and cannot have the POINTER attribute - Cannot appear in a specification expression, except as an argument to the BIT_SIZE, KIND, or LEN intrinsic functions or the numeric inquiry intrinsic functions - Must not be * - Must not be a dummy procedure o The function result must be scalar and cannot have the POINTER attribute. An explicit interface must be visible to the caller of an ELEMENTAL procedure. If ELEMENTAL is specified, RECURSIVE must not be specified. nam Is a symbolic name for the function. The name must be unique among all global names in the program. The name is used as a variable within the function. The value of the variable is returned to the caller of the function as the value of the function. The name can be followed by * and the length of the data type. It must be one of the valid length specifiers for "typ". This length overrides the length specified or implied by the type. This length specification is not permitted if the length has already been specified following CHARACTER. p Is an unsubscripted variable name specifying a dummy argument. The arguments must agree in order, number, and type with the actual arguments of the statement invoking the function. A dummy argument must not be defined as an array with more elements than the actual argument holds. r-nam Is the name of the function result. This name must not be the same as the function name. The array declarator for a dummy argument can itself contain integer values that are dummy arguments or are references to a common block, providing for adjustable size arrays in functions. The upper bound of the array declarator for a dummy argument can be specified as an asterisk, in which case the upper bound of the dummy argument assumes the size of the upper bound of the actual argument. The size in a character string declarator for a dummy argument can be specified as an asterisk in parentheses (*) -- in which case the size of the actual argument is passed to the dummy argument. The values of the actual arguments in the invoking program unit become the values of the dummy arguments in the function. If you modify a dummy argument, the corresponding actual argument in the invoking program unit is also modified; the actual argument must be a variable if it is to be modified. If the actual argument is a character constant, the dummy argument can be either character or numeric in type, unless the name of the subprogram being invoked is a dummy argument in the invoking program unit. If the actual argument is a Hollerith constant, the dummy argument must be numeric. The FUNCTION statement must be the first statement of a function subprogram, unless an OPTIONS statement is specified. A function subprogram cannot contain a SUBROUTINE statement, a BLOCK DATA statement, a PROGRAM statement, or another FUNCTION statement. ENTRY statements can be included to provide multiple entry points to the subprogram. NOTE In a function, the function name identifier refers to the return value, not the function itself, unless an argument list is present. Therefore, it is not possible to pass a function as an argument to another routine from inside the function. For example, consider the following: INTEGER FUNCTION RECURSIVE_FUNCTION . . . CALL OTHERSUB (RECURSIVE_FUNCTION) The reference to RECURSIVE_FUNCTION in the CALL statement passes the function return value, not the function itself. 4 RESULT_Keyword Specifies a name for the result variable of a function. Its name must be different from the name of the function. If RESULT is not specified, the function name is the result variable. All references to the function are references to the function result variable. If RESULT is specified, the result name is the result variable. In this case, all references to the function name are recursive calls, and the function name must not appear in specification statements. The following is an example of a recursive function specifying a RESULT variable: RECURSIVE FUNCTION FACTORIAL(P) RESULT(L) INTEGER, INTENT(IN) :: P INTEGER L IF (P == 1) THEN L = 1 ELSE L = P * FACTORIAL(P - 1) END IF END FUNCTION 4 Function_Reference Transfers control and passes arguments to a function. Format: nam (p[,p]...) nam Is the name of the function or the name of an entry point to the function. p Is a value to be passed to the function. The value can be a constant, the name of a variable, the name of an array element, the name of an array, an expression, a substring, field reference, or the name of a subprogram or entry point to a subprogram (must be defined as external). You cannot specify more than 255 arguments. 3 GOTO Transfers control within a program unit. Depending upon the value of an expression, control is transferred either to the same statement every time GO TO is executed or to one of a set of statements. 4 Unconditional Transfers control unconditionally to the same statement every time the GO TO is executed. Statement format: GO TO s s Is the label of an executable statement that is in the same program unit as the GO TO statement. 4 Computed Transfers control to a statement based upon the value of an expression within the statement. This is an obsolescent feature in Fortrsn 95. Statement format: GO TO (slist)[,]e slist Is a list of one or more labels of executable statements separated by commas. The list of labels is called the transfer list. e Is an integer arithmetic expression in the range 1 to n (where "n" is the number of statement labels in the transfer list). If the value of "e" is less than one or greater than the number of labels in the transfer list, control is transferred to the first executable statement after the computed GO TO. NOTE This statement is obsolescent in Fortran 95. HP Fortran flags obsolescent features, but fully supports them. 4 Assigned Transfers control to a statement label that is represented by a variable. An ASSIGN statement must establish a relationship between the variable and the specified statement label. Statement format: GO TO v[[,](slist)] v Is an integer variable whose value was set by a preceding ASSIGN statement in the same program unit. slist Is a list of one or more labels of executable statements separated by commas. This feature has been deleted in Fortran 95; it was an obsolescent feature in Fortran 90. VSI Fortran fully supports features deleted in Fortran 95. 3 IF Conditionally transfers control or executes a statement or block of statements. For each type of IF statement, the decision to transfer control or to execute the statement or block of statements is based on the evaluation of an expression within the IF statement. 4 Arithmetic Conditionally transfers control to one of three statements, based on the current value of an arithmetic expression. Statement format: IF (e) s1,s2,s3 e Is an arithmetic expression. s1,s2,s3 Are labels of executable statements in the same program unit. All three labels are required, but they need not refer to different statements. Executes the statement at the first label ("s1") if the arithmetic expression evaluates to a value less than 0; the statement at the second label ("s2") if the arithmetic expression evaluates to 0; or the statement at the third label ("s3") if the arithmetic expression evaluates to a value greater than 0. NOTE The arithmetic IF statement is an obsolescent feature in Fortran 95 and Fortran 90. HP Fortran fully supports this feature. 4 Logical Executes the statement if the logical expression is true. In Fortran 95/90, this is called an IF statement (as compared to block IFs, which are called IF constructs). Statement format: IF (e) st e Is a logical expression. st Is a complete Fortran statement. The statement can be any statement except DO, END DO, END, block IF, CASE, FORALL, or WHERE constructs, or another logical IF statement. 4 Block Executes a block of statements if the logical expression is true. The block of statements starts immediately following the IF statement. The block of statements can be followed by optional ELSE IF statements (any number) and one optional ELSE statement. The entire block IF construct must be terminated by an END IF statement. Format: [name:] IF (e) THEN block [ELSE IF (e1) THEN [name] block]... [ELSE [name] block] END IF [name] name Is the name of the IF construct. e,e1 Are logical expressions. block Is a series of zero or more Fortran statements (called a statement block). If a construct name is specified in a block IF statement, the same name must appear in the terminal END IF statement. If no construct name is specified in the block IF statement, no name can appear in the terminal END IF statement. The construct name must be a unique identifier in the program unit. NOTE No additional statement can be placed after the IF THEN statement in a block IF construct. For example, the following statement is invalid in the block IF construct: IF (e) THEN I = J This statement is translated as the following logical IF statement: IF (e) THENI = J 3 IMPLICIT Overrides implied (default) data typing of symbolic names. Statement format: IMPLICIT typ (a[,a]...)[,typ (a[,a]...)]... typ Is any data type except CHARACTER*(*). When "typ" is equal to CHARACTER*len, "len" specifies the length for character data type. The "len" is an unsigned integer constant or an integer constant expression enclosed in parentheses. The largest valid value of len on Tru64 UNIX and Linux is 2147483647 (2**31-1); on OpenVMS the largest valid value is 65535. Negative values are treated as zero. a Is an alphabetical character. If you specify a range of alphabetic characters (two characters joined by a hyphen), the first character must be less than the second. The IMPLICIT statement assigns the specified data type to all symbolic names that have no explicit data type and begins with the specified letter or range of letters. It has no effect on the default types of intrinsic procedures. Names beginning with a dollar sign ($) are implicitly INTEGER. This implicit type cannot be changed in an IMPLICIT statement. 3 IMPLICIT_NONE Disables the implicit declaration of data types in the program unit. When it is used, you must declare the data types of all symbols explicitly. You must not include any other IMPLICIT statements in the program unit containing an IMPLICIT NONE statement. Statement format: IMPLICIT NONE NOTE To receive diagnostic messages when variables are used but not declared, you can specify the /WARNINGS=DECLARATIONS compiler option instead of IMPLICIT NONE. 3 INCLUDE Directs the compiler to stop reading statements from the current file and read the statements in the included file or module. When it reaches the end of the included file or module, the compiler resumes compilation with the next statement after the INCLUDE statement. Statement format: INCLUDE 'full-file-name[/[NO]LIST]' INCLUDE '[text-lib] (module-name)[/[NO]LIST]' full-file-name Is a character string that specifies the file to be included. The form of the "full-file-name" must be acceptable to the operating system, as described in the HP Fortran for OpenVMS User Manual. /[NO]LIST Specifies whether the incorporated code is to appear in the compilation source listing. In the listing, a number precedes each incorporated statement. The number indicates the "include" nesting depth of the code. The default is /NOLIST. /LIST and /NOLIST must be spelled completely. On Tru64 UNIX and Linux systems, you can only use /[NO]LIST if you specify the compiler option that sets OpenVMS defaults. text-lib Is a character string that specifies the "full-file-name" of the text library to be searched. Its form must be acceptable to the operating system, as described in the HP Fortran for OpenVMS User Manual. module-name Is the name of the text module, located in a text library, that is to be included. The name of the module must be enclosed in parentheses. It can contain any alphanumeric character and the special characters dollar sign ($) and underscore (_). Its length must be acceptable to the operating system, as described in the HP Fortran for OpenVMS User Manual. The file or module must contain valid Fortran statements. The file or module cannot start with a continuation line, but it can contain an INCLUDE statement. The limit on nesting depth is when system resources are exhausted. In the following example, the file COMMON.FOR defines a parameter constant M, and defines arrays X and Y as part of the blank common block. Main Program File COMMON.FOR File ----------------- --------------- INCLUDE 'COMMON.FOR' PARAMETER (M=100) DIMENSION Z(M) COMMON X(M),Y(M) CALL CUBE DO 5, I=1,M 5 Z(I) = X(I)+SQRT(Y(I)) . . . END SUBROUTINE CUBE INCLUDE 'COMMON.FOR' DO 10, I=1,M 10 X(I) = Y(I)**3 RETURN END 3 Input_Output Transfer I/O statements include READ, WRITE, REWRITE, ACCEPT, TYPE, and PRINT. Auxiliary I/O statements include OPEN, CLOSE, INQUIRE, REWIND, BACKSPACE, ENDFILE, DELETE, and UNLOCK. Transfer I/O statements may be formatted (F), unformatted (U), list-directed (L-D), or namelist (N) as follows: ACCEPT Sequential -- F, L-D, N DELETE Relative -- U Indexed -- U PRINT Sequential -- F, L-D, N READ Sequential -- F, U, L-D, N Direct Access -- F, U Internal -- F, L-D Indexed -- F, U REWRITE Relative -- F, U Sequential -- F Indexed -- F, U TYPE Sequential -- F, L-D, N WRITE Sequential -- F, U, L-D, N Direct Access -- F, U Internal -- F, L-D Indexed -- F, U 4 Formatted Formatted I/O statements contain explicit format specifiers that are used to control the translation of data from internal (binary) form within a program to external (readable character) form in the records, or vice versa. Formatted I/O statements must have a format (FMT=) specified in the control list (clist). Additional "clist" elements are required depending on the type of access. Formatted sequential READ: READ (UNIT=u,FMT=f[,ADVANCE=exp][,SIZE=var][,IOSTAT=ios] [,ERR=err][,END=end]) [iolist] READ f [,iolist] Formatted direct access READ: READ (UNIT=u,REC=rec,FMT=f[,IOSTAT=ios][,ERR=err]) [iolist] Formatted indexed READ: READ (UNIT=u,FMT=f,KEY=k[,KEYID=n][,IOSTAT=ios] [,ERR=err]) [iolist] Formatted internal READ: READ (UNIT=u,FMT=f[,IOSTAT=ios][,ERR=err][,END=end]) [iolist] Formatted sequential WRITE: WRITE (UNIT=u,FMT=f[,ADVANCE=exp][,IOSTAT=ios] [,ERR=err]) [iolist] Formatted direct access WRITE: WRITE (UNIT=u,REC=rec,FMT=f[,IOSTAT=ios][,ERR=err]) [iolist] Formatted indexed WRITE: WRITE (UNIT=u,FMT=f[,IOSTAT=ios][,ERR=err]) [iolist] Formatted internal WRITE: WRITE (UNIT=u,FMT=f[,IOSTAT=ios][,ERR=err]) [iolist] 4 Unformatted Unformatted I/O statements do not contain format specifiers and therefore do not translate the data being transferred. Unformatted I/O is especially appropriate where the output data will subsequently be used as input. Unformatted I/O saves execution time by eliminating the data translation process, preserves greater precision in the external data, and usually conserves file storage space. Unformatted I/O statements do not specify a format (FMT=) in the control list (clist). Other "clist" elements are required depending on the type of access. Unformatted sequential READ: READ (UNIT=u[,IOSTAT=ios][,ERR=err][,END=end]) [iolist] Unformatted direct access READ: READ (UNIT=u,REC=rec[,IOSTAT=ios][,ERR=err]) [iolist] Unformatted indexed READ: READ (UNIT=u,KEY=k[,KEYID=n][,IOSTAT=ios][,ERR=err]) [iolist] Unformatted sequential WRITE: WRITE (UNIT=u,[,IOSTAT=ios][,ERR=err]) [iolist] Unformatted direct access WRITE: WRITE (UNIT=u,REC=rec[,IOSTAT=ios][,ERR=err]) [iolist] Unformatted indexed WRITE: WRITE (UNIT=u[,IOSTAT=ios][,ERR=err]) [iolist] 4 List-Directed List-directed I/O statements are similar to formatted statements in function, but control the translation of data through data types instead of explicit format specifiers. List-directed I/O statements specify a format (FMT=) in the control list (clist). Other "clist" elements are required depending on the type of access. List-directed sequential READ: READ (UNIT=u,FMT=*[,IOSTAT=ios][,ERR=err][,END=end]) [iolist] READ * [,iolist] List-directed internal READ READ (UNIT=u,FMT=*[,IOSTAT=ios][,ERR=err][,END=end]) [iolist] List-directed sequential WRITE WRITE (UNIT=u,FMT=*[,IOSTAT=ios][,ERR=err]) [iolist] List-directed internal WRITE WRITE (UNIT=u,FMT=*[,IOSTAT=ios][,ERR=err]) [iolist] 4 Namelist Namelist I/O statements are similar to formatted statements in function, but control the translation of data through data types instead of explicit format specifiers. Namelist I/O statements do not specify a format (FMT=) in the control list (clist). Namelist sequential READ: READ (UNIT=u,NML=nml[,IOSTAT=ios][,ERR=err][,END=end]) READ n Namelist sequential WRITE: WRITE (UNIT=u,NML=nml[,IOSTAT=ios][,ERR=err]) Comments (beginning with ! only) can appear anywhere in namelist input. The comment extends to the end of the source line. 3 INQUIRE Returns information about specified properties of a file or of a logical unit on which a file might be opened. The unit need not exist, nor need it be connected to a file. If the unit is connected to a file, the inquiry encompasses both the connection and the file. Statement format: Inquiring by File: INQUIRE (FILE=fi [,ERR=lbl][,IOSTAT=ivar][,DEFAULTFILE=def], flist) Inquiring by Unit: INQUIRE ([UNIT=]u [,ERR=lbl][,IOSTAT=ivar], flist) Inquiring by Output List: INQUIRE (IOLENGTH=len) olist fi Is a scalar default character expression specifying the name of the file for inquiry. lbl Is the label of the branch target statement that receives control if an error occurs. var Is a scalar integer variable that is defined as a positive integer if an error occurs and zero if no error occurs. def Is a scalar default character expression specifying a default file pathname (or file specification) string. flist Is one or more inquiry specifiers. Each specifier can appear only once. Information about the individual specifiers is available under the subtopic headings listed at the end of this Help topic. u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. The unit does not have to exist, nor does it need to be connected to a file. If the unit is connected to a file, the inquiry encompasses both the connection and the file. len Is a scalar integer variable indicating the number of bytes of data that would result from using "olist" in an unformatted output statement. olist Is a list of one or more output items. FILE=fi, UNIT=u, ERR=lbl, and IOSTAT=var can appear anywhere within the parentheses following INQUIRE. However, if the UNIT keyword is omitted, the unit specifier ("u") must be the first parameter in the list. An INQUIRE statement may be executed before, during, or after the connection of a file to a unit. The values assigned by the statement are those that are current when the INQUIRE statement executes. To get file characteristics, specify the INQUIRE statement after opening the file. (File characteristics are stored in the file header.) 4 ACCESS ACCESS = acc acc Is a scalar default character variable that is assigned one of the following values: 'SEQUENTIAL' If the file is open for sequential access 'DIRECT' If the file is open for direct access 'KEYED' If the file is open for keyed access 'UNDEFINED' If the file is not open 4 ACTION ACTION = act act Is a scalar default character variable that is assigned one of the following values: 'READ' If the file is connected for input only 'WRITE' If the file is connected for output only 'READWRITE' If the file is connected for both input and output 'UNDEFINED' If the file is not connected 4 BLANK BLANK = blnk blnk Is a character scalar memory reference that is assigned one of the following values: 'NULL' If null blank control is in effect for the file open for formatted I/O. (Blanks are ignored unless the field is all blanks, in which case it is treated as zero.) 'ZERO' If zero blank control is in effect. (All blanks other than leading blanks are treated as zeros.) 'UNDEFINED' If the file is not open or if the existing file is not open for formatted I/O. 4 BLOCKSIZE BLOCKSIZE = bks bks Is a scalar integer variable. The "bks" is assigned the current size of the I/O buffer. If the unit or file is not connected, the value assigned is zero. 4 BUFFERED BUFFERED = bf bf Is a scalar default character variable that is assigned one of the following values: 'NO' If the file or unit is connected and buffering is not in effect. 'YES' If the file or unit is connected and buffering is in effect. 'UNKNOWN' If the file or unit is not connected. 4 CARRIAGECONTROL CARRIAGECONTROL = cc cc Is a character scalar memory reference that is assigned one of the following values: 'FORTRAN' If the file is open with the FORTRAN carriage control 'LIST' If the file is open with implied carriage control (single spacing between records) 'NONE' If the file is open with no carriage control attribute 'UNKNOWN' If the file is not open 4 CONVERT CONVERT = fm fm Is a character scalar memory reference that is assigned one of the following values: 'LITTLE_ENDIAN': If the file is open with little endian integer and IEEE floating-point data conversion in effect. 'BIG_ENDIAN': If the file is open with big endian integer and IEEE floating-point data conversion in effect. 'CRAY': If the file is open with big endian integer and CRAY floating-point data conversion in effect. 'FDX': If the file is open with little endian integer and VAX F_floating, D_floating, and IEEE X_floating data conversion in effect. 'FGX': If the file is open with little endian integer and VAX F_floating, G_floating, and IEEE X_floating data conversion in effect. 'IBM': If the file is open with big endian integer and IBM System\370 floating- point data conversion in effect. 'VAXD': If the file is open with little endian integer and VAX F_floating, D_floating, and H_floating data conversion in effect. 'VAXG': If the file is open with little endian integer and VAX F_floating, G_floating, and H_floating data conversion in effect. 'NATIVE': If the file is open with no data conversion in effect. 'UNKNOWN': If the file or unit is not connected for unformatted I/O. 4 DELIM DELIM = del del Is a scalar default character variable that is assigned one of the following values: 'APOSTROPHE' If apostrophes are used to delimit character constants in list-directed and namelist output 'QUOTE' If quotation marks are used to delimit character constants in list-directed and namelist output 'NONE' If no delimiters are used 'UNDEFINED' If the file is not connected, or is not connected for formatted data transfer 4 DIRECT DIRECT = dir dir Is a character scalar memory reference that is assigned one of the following values: 'YES' If the file is open for direct access 'NO' If the file is not open for direct access 'UNKNOWN' If the file is not open 4 ERR ERR = s s Is the label of an executable statement. ERR is a control specifier rather than a property specifier. If an error occurs during the execution of the INQUIRE statement, control is transferred to the statement whose label is "s". 4 EXIST EXIST = lv lv Is a logical scalar memory reference that is assigned one of the following values: .TRUE. If the specified file exists and can be opened or if the unit exists .FALSE. If the specified file or unit does not exist or if the file exists but cannot be opened The unit exists if it is a number in the range allowed by the processor. 4 FORM FORM = fm fm Is a character scalar memory reference that is assigned one of the following values: 'FORMATTED' If the file is open for formatted I/O 'UNFORMATTED' If the file is open for unformatted I/O 'UNDEFINED' If the file is not open 4 FORMATTED FORMATTED = fmd fmd Is a character character scalar memory reference that is assigned one of the following values: 'YES' If formatted I/O is allowed 'NO' If formatted I/O is not allowed 'UNKNOWN' If the processor cannot determine whether formatted I/O is allowed 4 IOSTAT IOSTAT = ios ios Is a scalar default integer variable. IOSTAT is a control specifier rather than a property specifier. The "ios" is assigned a processor-dependent positive integer value if an error occurs during execution of the INQUIRE statement; it is assigned the value zero if there is no error condition. 4 KEYED KEYED = kyd kyd Is a character scalar memory reference that is assigned one of the following values: 'YES' If keyed access is allowed. 'NO' If keyed access is not allowed. 'UNKNOWN' If the processor cannot determine whether keyed access is allowed 4 NAME NAME = nme nme Is a character scalar memory reference that is assigned the name of the file being inquired about. If the file does not have a name, "nme" is undefined. NOTE The FILE and NAME keywords are synonyms when used with the OPEN statement, but not when used with the INQUIRE statement. 4 NAMED NAMED = nmd nmd Is a logical scalar memory reference that is assigned one of the following values: .TRUE. If the specified file has a name .FALSE. If the file does not have a name 4 NEXTREC NEXTREC = nr nr Is a scalar integer variable that is assigned a value as follows: - If the file is connected for direct access and a record (r) was previously read or written, the value assigned is r + 1. - If no record has been read or written, the value assigned is 1. - If the file is not connected for direct access, or if the file position cannot be determined because of an error condition, the value assigned is zero. - If the file is connected for direct access and a REWIND has been performed on the file, the value assigned is 1. 4 NUMBER NUMBER = num num Is a scalar integer variable to which the logical unit number of the file is returned. No value is returned if the file is not connected to a unit. 4 OPENED OPENED = od od Is a logical scalar memory reference that is assigned one of the following values: .TRUE. If the specified file or unit is open .FALSE. If the specified file or unit is not open 4 ORGANIZATION ORGANIZATION = org org Is a character scalar memory reference that is assigned one of the following values: 'SEQUENTIAL' If the file is a sequential file 'RELATIVE' If the file is a relative file 'INDEXED' If the file is an indexed file 'UNKNOWN' If the file organization cannot be determined 4 PAD PAD = pd pd Is a scalar default character variable that is assigned one of the following values: 'NO' If the file or unit was connected with PAD='NO' 'YES' If the file or unit was connected with PAD='YES' 4 POSITION POSITION = pos pos Is a scalar default character variable that is assigned one of the following values: 'REWIND' If the file is connected with its position at its initial point 'APPEND' If the file is connected with its position at its terminal point (or before its end-of-file record, if any) 'ASIS' If the file is connected without changing its position 'UNDEFINED' If the file is not connected, or is connected for direct access data transfer and a REWIND statement has not been performed on the unit. 4 READ READ = rd rd Is a scalar default character variable that is assigned one of the following values: 'YES' If the file can be read 'NO' If the file cannot be read 'UNKNOWN' If the processor cannot determine whether the file can be read 4 READWRITE READWRITE = rdwr rdwr Is a scalar default character variable that is assigned one of the following values: 'YES' If the file can be both read and written to 'NO' If the file cannot be both read and written to 'UNKNOWN' If the processor cannot determine whether the file can be both read and written to 4 RECL RECL = rcl rcl Is a scalar integer variable whose value depends on the following conditions: - If the file or unit is open, "rcl" is the maximum record length allowed in the file - If the file is not open, "rcl" is the maximum record length allowed in the file; or, if the maximum record length is 0, "rcl" is the length of the longest record in the file - If the file is segmented, "rcl" is the longest segment length in the file - If the file does not exist, "rcl" is 0. The assigned value is expressed in longwords (4-byte units) if the file is currently (or was previously) connected for unformatted data transfer; otherwise, the value is expressed in bytes. 4 RECORDTYPE RECORDTYPE = rtype rtype Is a character scalar memory reference that is assigned one of the following values: 'FIXED' If the file is open for fixed-length records 'VARIABLE' If the file is open for variable-length records 'SEGMENTED' If the file is open for unformatted sequential I/O using segmented records 'STREAM' If the file's records are not terminated 'STREAM_CR' If the file's records are terminated with a carriage-return 'STREAM_LF' If the file's records are terminated with a line-feed 'UNKNOWN' If the processor cannot determine the record type or the file is not open 4 SEQUENTIAL SEQUENTIAL = seq seq Is a character scalar memory reference that is assigned one of the following values: 'YES' If sequential access is allowed for the specified file 'NO' If sequential access is not allowed 'UNKNOWN' If the access mode cannot be determined 4 UNFORMATTED UNFORMATTED = unf unf Is a character scalar memory reference that is assigned one of the following values: 'YES' If unformatted I/O is allowed for the specified file 'NO' If unformatted I/O is not allowed 'UNKNOWN' If the form cannot be determined 4 WRITE WRITE = wr wr Is a scalar default character variable that is assigned one of the following values: 'YES' If the file can be written to 'NO' If the file cannot be written to 'UNKNOWN' If the processor cannot determine whether the file can be written to 3 INTENT Specifies the intended use of one or more dummy arguments. The INTENT attribute can be specified in a type declaration statement or an INTENT statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] INTENT (spec) [,att-ls] :: d [, d]... Statement: INTENT (spec) [::] d [, d]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. spec Is one of the following specifiers: IN Specifies that the dummy argument must not be redefined (or become undefined) during execution of the procedure. Any associated actual argument must be an expression. OUT Specifies that the dummy argument must be defined before it is referenced in the procedure. Any associated actual argument must be definable. The argument becomes undefined on entry to the procedure, and is intended only to pass information out of the procedure. INOUT Specifies that the dummy argument can both receive data from and return data to the calling program unit. Any associated actual argument must be definable. d Is the name of a dummy argument. It cannot be a dummy procedure or dummy pointer. If no INTENT attribute is specified for a dummy argument, its use is subject to the limitations of the associated actual argument. If a function specifies a defined operator, the dummy arguments must have intent IN. If a subroutine specifies defined assignment, the first argument must have intent OUT or INOUT, and the second argument must have intent IN. If an actual argument is an array section with a vector subscript, it cannot be associated with a dummy array that is defined or redefined (has intent OUT or INOUT). The INTENT attribute is compatible with the DIMENSION, OPTIONAL, TARGET, and VOLATILE attributes. EXAMPLES: The following example shows type declaration statements specifying the INTENT attribute: SUBROUTINE TEST(I, J) INTEGER, INTENT(IN) :: I INTEGER, INTENT(OUT), DIMENSION(I) :: J The following are examples of the INTENT statement: SUBROUTINE TEST(A, B, X) INTENT(INOUT) :: A, B ... SUBROUTINE CHANGE(FROM, TO) USE EMPLOYEE_MODULE TYPE(EMPLOYEE) FROM, TO INTENT(IN) FROM INTENT(OUT) TO ... 3 INTERFACE The first statement of an interface block. Interface blocks define explicit interfaces for external or dummy procedures. They can also be used to define a generic name for procedures, a new operator for functions, and a new form of assignment for subroutines. Format: INTERFACE [spec] [body]... [MODULE PROCEDURE nam]... END INTERFACE [spec] spec Is one of the following: A generic name OPERATOR (op) The "op" is the defined unary, defined binary, or extended intrinsic operator being defined. ASSIGNMENT (=) A "spec" can only be included in the END INTERFACE statement if one was provided in the INTERFACE statement; both "spec"s must be identical. body Is one or more function or subroutine subprograms. A function must end with END FUNCTION and a subroutine must end with END SUBROUTINE. The subprogram must not contain a statement function or a DATA, ENTRY or FORMAT statement; an entry name can be used as a procedure name. The subprogram can contain a USE statement. nam Is the name of one or more module procedures that are accessible in the host. The MODULE PROCEDURE statement is only allowed if the interface block specifies a "spec" and has a host that is a module (or accesses a module by use association). The characteristics of module procedures are not given in interface blocks, but are assumed from the module subprogram definitions. Interface blocks can appear in the specification part of the program unit that invokes the external or dummy procedure. The characteristics specified for the external or dummy procedure must be consistent with those specified in the procedure's definition. An interface block must not appear in a block data program unit. An interface block comprises its own scoping unit, and does not inherit anything from its host through host association. A procedure must not have more than one explicit interface in a given scoping unit. For more information, see the HP Fortran for OpenVMS Language Reference Manual. EXAMPLES: The following example shows a simple procedure interface block with no generic specification: SUBROUTINE SUB_B (B, FB) REAL B ... INTERFACE FUNCTION FB (GN) REAL FB, GN END FUNCTION END INTERFACE 4 Generic_Names An interface block can be used to specify a generic name to reference all of the procedures within the interface block. Statement format for initial line in block: INTERFACE generic-name This kind of interface block can be used to extend or redefine a generic intrinsic procedure. The procedures that are given the generic name must be the same kind of subprogram: all must be functions, or all must be subroutines. Any procedure reference involving a generic procedure name must be resolvable to one specific procedure; it must be unambiguous. EXAMPLES: INTERFACE GROUP_SUBS SUBROUTINE INTEGER_SUB (A, B) INTEGER, INTENT(INOUT) :: A, B END SUBROUTINE INTEGER_SUB SUBROUTINE REAL_SUB (A, B) REAL, INTENT(INOUT) :: A, B END SUBROUTINE REAL_SUB SUBROUTINE COMPLEX_SUB (A, B) COMPLEX, INTENT(INOUT) :: A, B END SUBROUTINE COMPLEX_SUB END INTERFACE The three subroutines can be referenced by their individual specific names or by the group name GROUP_SUBS. The following example shows a reference to INTEGER_SUB: INTEGER V1, V2 CALL GROUP_SUBS (V1, V2) 4 Generic_Operators An interface block can be used to define a generic operator. The only procedures allowed in the interface block are functions that can be referenced as defined operations. Statement format for initial line in block: INTERFACE OPERATOR (op) op Is one of the following: A defined unary operator (one argument) A defined binary operator (two arguments) An extended intrinsic operator (number of arguments must be consistent with the intrinsic uses of that operator) The functions within the interface block must have one or two nonoptional arguments with intent IN, and the function result must not be of type character with assumed length. A defined operation is treated as a reference to the function. EXAMPLES: INTERFACE OPERATOR(.BAR.) FUNCTION BAR(A_1) INTEGER, INTENT(IN) :: A_1 INTEGER :: BAR END FUNCTION BAR END INTERFACE The following example shows a way to reference function BAR by using the new operator: INTEGER B I = 4 + (.BAR. B) The following is an example of a procedure interface block with a defined operator extending an existing operator: INTERFACE OPERATOR(+) FUNCTION LGFUNC (A, B) LOGICAL, INTENT(IN) :: A(:), B(SIZE(A)) LOGICAL :: LGFUNC(SIZE(A)) END FUNCTION LGFUNC END INTERFACE The following example shows two equivalent ways to reference function LGFUNC: LOGICAL, DIMENSION(1:10) :: C, D, E N = 10 E = LGFUNC(C(1:N), D(1:N)) E = C(1:N) + D(1:N) 4 Generic_Assignment An interface block can be used to define generic assignment. The only procedures allowed in the interface block are subroutines that can be referenced as defined assignments. Statement format for initial line in block: INTERFACE ASSIGNMENT(=) The subroutines within the interface block must have two nonoptional arguments, the first with intent OUT or INOUT, and the second with intent IN. A defined assignment is treated as a reference to a subroutine. The left side of the assignment corresponds to the first dummy argument of the subroutine; the right side of the assignment corresponds to the second argument. The ASSIGNMENT keyword extends or redefines an assignment operation if both sides of the equal sign are of the same derived type. Any procedure reference involving generic assignment must be resolvable to one specific procedure; it must be unambiguous. EXAMPLES: INTERFACE ASSIGNMENT (=) SUBROUTINE BIT_TO_NUMERIC (NUM, BIT) INTEGER, INTENT(OUT) :: NUM LOGICAL, INTENT(IN) :: BIT(:) END SUBROUTINE BIT_TO_NUMERIC SUBROUTINE CHAR_TO_STRING (STR, CHAR) USE STRING_MODULE ! Contains definition ! of type STRING TYPE(STRING), INTENT(OUT) :: STR ! A variable-length string CHARACTER(*), INTENT(IN) :: CHAR END SUBROUTINE CHAR_TO_STRING END INTERFACE The following example shows two equivalent ways to reference subroutine BIT_TO_NUMERIC: CALL BIT_TO_NUMERIC(X, (NUM(I:J))) X = NUM(I:J) The following example shows two equivalent ways to reference subroutine CHAR_TO_STRING: CALL CHAR_TO_STRING(CH, '432C') CH = '432C' 3 INTRINSIC Allows the specific name of an intrinsic procedure to be used as an actual argument. (Not all specific names can be used as actual arguments. For more information, see the HP Fortran for OpenVMS Language Reference Manual.) The INTRINSIC attribute can be specified in a type declaration statement or an INTRINSIC statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] INTRINSIC [,att-ls] :: v[,v]... Statement: INTRINSIC v [,v]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. v Is the symbolic name of an intrinsic subprogram. Subprogram names passed as actual arguments must be identified in INTRINSIC statements. Names of subprograms used as the objects of CALL statements or function references do not need to be identified by means of INTRINSIC statements; these names are recognized as intrinsic implicitly. The INTRINSIC attribute is compatible with the PRIVATE and PUBLIC attributes. 3 MAP See STATEMENTS STRUCTURE in this Help file. 3 MODULE A program unit containing specifications and definitions that can be made accessible to other program units. Format: MODULE nam [specs] [CONTAINS mod-sub [mod-sub]...] END [MODULE [nam]] nam Is the name of the module. specs Is one or more specification statements, except for the following: ENTRY FORMAT AUTOMATIC (or its equivalent attribute) INTENT (or its equivalent attribute) OPTIONAL (or its equivalent attribute) Statement functions An automatic object must not appear in a specification statement. mod-sub Is a function or subroutine subprogram that defines the the module procedure. A function must end with END FUNCTION and a subroutine must end with END SUBROUTINE. A module subprogram can contain internal procedures. If a module name appears following the END statement, it must be the same name as the name specified in the MODULE statement. The module name cannot be the same as any local name in the main program or the name of any other program unit, external procedure, or common block in the executable program. A module is host to any module procedures it contains, and entities in the module are accessible to the module procedures through host association. A module must not reference itself (either directly or indirectly). Although ENTRY statements, FORMAT statements, and statement functions are not allowed in the specification part of a module, they are allowed in the specification part of a module subprogram. Any executable statements in a module can only be specified in a module subprogram. A module can contain one or more procedure interface blocks, which let you specify an explicit interface for an external subprogram or dummy subprogram. Every internal subprogram must be of the same extrinsic kind as its host, and any internal subprogram whose extrinsic kind is not given is assumed to be of that extrinsic kind. EXAMPLES: The following example shows a simple module that can be used to provide global data: MODULE MOD_A INTEGER :: B, C REAL E(25,5) END MODULE MOD_A ... SUBROUTINE SUB_Z USE MOD_A ! Makes scalar variables B and C, ! and array E available to this ! subroutine END SUBROUTINE SUB_Z The following example shows a module procedure: MODULE RESULTS ... CONTAINS FUNCTION MOD_RESULTS(X,Y) ! A module procedure ... END FUNCTION MOD_RESULTS END MODULE RESULTS The following example shows a module containing a derived type: MODULE EMPLOYEE_DATA TYPE EMPLOYEE INTEGER ID CHARACTER(LEN=40) NAME END TYPE EMPLOYEE END MODULE The following example shows a module containing an interface block: MODULE ARRAY_CALCULATOR INTERFACE FUNCTION CALC_AVERAGE(D) REAL :: CALC_AVERAGE REAL, INTENT(IN) :: D(:) END FUNCTION END INTERFACE END MODULE ARRAY_CALCULATOR 3 MODULE_PROCEDURE See STATEMENTS INTERFACE in this Help file. 3 NAMELIST Defines a list of variables or array names and associates that list with a unique group-name, which is used in the namelist I/O statement. NAMELIST /group/nlist[[,]/group/nlist]... group Is the name of the group. nlist Is the list of (no more than 250) variable names, separated by commas, that are to be associated with the preceding group. Dummy arguments can appear in a namelist. The following variables cannot appear in a namelist group: o An array dummy argument with nonconstant bounds o A variable with assumed character length o An allocatable array o An automatic object o A Fortran 95/90 pointer o A variable of a type that has a pointer as an ultimate component o A subobject of any of the above objects You can use namelist I/O to assign values to elements of arrays or substrings of character variables that appear in namelists. The namelist entities can have any data type and can be explicitly or implicitly typed. Only the entities specified in the namelist can be read or written in namelist I/O. It is not necessary for the input records in a namelist input statement to define every entity in the associated namelist. The order of entities in the namelist controls the order in which the values are written in the namelist output. Input of namelist values can be in any order. A variable can appear in several namelists. 3 NULLIFY Disassociates a pointer from its target. It takes the following form: NULLIFY (ptr-obj [,ptr-obj]...) ptr-obj Is a structure component or the name of a variable; it must be a pointer (have the POINTER attribute). The initial association status of a pointer is undefined. You can use NULLIFY to initialize an undefined pointer, giving it disassociated status. Then the pointer can be tested using the intrinsic function ASSOCIATED. EXAMPLES: REAL, TARGET :: TAR(0:50) REAL, POINTER :: PTR_A(:), PTR_B(:) PTR_A => TAR PTR_B => TAR ... NULLIFY(PTR_A) After these statements are executed, PTR_A will have disassociated status, while PTR_B will continue to be associated with variable TAR. 3 OPEN Opens an existing file or creates a new file. If you do not explicitly open a file before accessing it, the file is created (for write operations) or opened with default attributes. OPEN (par[,par]...) par Is a keyword specification in one of the following forms: keywd keywd=value keywd Is a keyword. (See the subtopic headings listed at the end of this Help topic.) value Is a keyword value. (Some keywords do not have keyword values.) If an OPEN statement is executed for a unit that is already open, and the file pathname (or specification) is different from that of the current open file, the previously opened file is closed and the new file is opened. If the file pathname (or specification) is the same for both files, the new value of the BLANK= specifier is in effect, but the position of the file is unaffected. Keyword specifications can appear in any order. In most cases, they are optional. Default values apply in their absence. If the logical unit specifier is the first parameter in the list, the UNIT keyword is optional. You can specify character values at run time by substituting a general character expression for a keyword value in the OPEN statement. The character value can contain trailing spaces but not leading or embedded spaces; for example: CHARACTER*6 FINAL /' '/ ... IF (exp) FINAL = 'DELETE' OPEN (UNIT=1, STATUS='NEW', DISP=FINAL) NOTE Keyword values that are numeric expressions can be any integer or real expression. The value of the expression is converted to integer data type before it is used in the OPEN statement. 4 ACCESS Indicates the access method for the connection of the file. It takes the following form: ACCESS = acc acc Is a character expression with one of the following values: 'DIRECT' Access by record number 'SEQUENTIAL' Access sequentially (the default) 'KEYED' Access by a specified key 'APPEND' Access sequentially, after the last record of the file 4 ACTION Indicates the allowed I/O operations for the file connection. It takes the following form: ACTION = act act Is a character expression with one of the following values: 'READ' Indicates that only READ statements can refer to this connection. 'WRITE' Indicates that only WRITE, DELETE, and ENDFILE statements can refer to this connection. 'READWRITE' Indicates that READ, WRITE, DELETE, and ENDFILE statements can refer to this connection (*DEFAULT*) 4 ASSOCIATEVARIABLE Indicates a variable that is updated after each direct access I/O operation, to reflect the record number of the next sequential record in the file. It takes the following form: ASSOCIATEVARIABLE = asv asv Is an integer variable. It cannot be a dummy argument to the routine in which the OPEN statement appears. Use only in direct access mode. NOTE Direct access READ, direct access WRITE, FIND, DELETE, and REWRITE statements can affect the value of the variable. 4 BLANK Indicates how blanks are interpreted in a file. It takes the following form: BLANK = blnk blnk Is a character expression with one of the following values: 'NULL' Ignore all blanks in a numeric field (unless the field is all blanks, in which case treat blanks as zero). 'ZERO' Treat all blanks other than leading blanks as zeros. The default is 'NULL' (for explicitly OPENed files, preconnected files, and internal files). If the BN or BZ edit descriptors are specified for a formatted input statement, they supersede the default interpretation of blanks. 4 BLOCKSIZE Indicates the physical I/O transfer size for the file. It takes the following form: BLOCKSIZE = bks bks Is a numeric expression whose value specifies a number of bytes. For magnetic tape files, the value of "bks" specifies the physical record size in the range 18 to 32767 bytes. The default value is 2048 bytes. For sequential disk files, "bks" is rounded up to an integral number of 512-byte blocks and used to specify multiblock transfers. The number of blocks transferred can be 1 to 127; it is determined by RMS defaults. For indexed and relative files, "bks" is rounded up to an integral number of 512-byte blocks and used to specify the RMS bucket size. This must fall in the range 1 to 63 blocks. The default is the smallest value capable of holding a single record. 4 BUFFERCOUNT Indicates the number of buffers to be associated with the logical unit for multibuffered I/O. It takes the following form: BUFFERCOUNT = bc bc Is a numeric expression. The range of values for "bc" is 1 to 127. If you do not specify BUFFERCOUNT or you specify 0, the process or system default is assumed. 4 BUFFERED Indicates run-time library behavior following WRITE operations. It takes the following form: BUFFERED = bf bf Is a character expression with one of the following values: 'NO' Requests that the run-time library send output data to the file system after each WRITE operation. 'YES' Requests that the run-time library accumulate output data in its internal buffer, possibly across several WRITE operations, before the data is sent to the file system. Buffering may improve run-time performance for output-intensive applications. The default is 'NO'. On OpenVMS, BUFFERED has no effect. The operating system automatically performs buffering, which can be affected by the values of the BUFFERCOUNT and BUFFERSIZE keywords when the file is opened. 4 CARRIAGECONTROL Indicates the type of carriage control used when a file is displayed at a terminal. It takes the following form: CARRIAGECONTROL = cc cc Is a character expression with one of the following values: 'FORTRAN' Process with normal FORTRAN interpretation of the first character 'LIST' Process with single spacing between records 'NONE' Do not use implied carriage control The default for unformatted files is 'NONE'. The default for formatted files is 'FORTRAN'. 4 CONVERT Indicates a nonnative numeric format for unformatted data. It takes the following form: CONVERT = fm fm Is a character expression with one of the following options: 'LITTLE_ENDIAN'- Little endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and IEEE floating-point data of the appropriate size and type (REAL*4, REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COMPLEX*32). INTEGER*1 data is the same for little endian and big endian. 'BIG_ENDIAN' - Big endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and IEEE floating-point data of the appropriate size and type (REAL*4, REAL*8, REAL*16, COMPLEX*8, COMPLEX*16, or COMPLEX*32). INTEGER*1 data is the same for little endian and big endian. 'CRAY' - Big endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and CRAY floating-point data of size REAL*8 or COMPLEX*16. 'FDX' - Little endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and HP VAX floating-point data of format F_floating for REAL*4 or COMPLEX*8, D_floating for size REAL*8 or COMPLEX*16, and IEEE X_floating for REAL*16 or COMPLEX*32. 'FGX' - Little endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and HP VAX floating-point data of format F_floating for REAL*4 or COMPLEX*8, G_floating for size REAL*8 or COMPLEX*16, and IEEE X_floating for REAL*16 or COMPLEX*32. 'IBM' - Big endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and IBM System\370 floating-point data of size REAL*4 or COMPLEX*8 (IBM short 4) and size REAL*8 or COMPLEX*16 (IBM long 8). 'VAXD' - Little endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and HP VAX floating-point data of format F_floating for size REAL*4 or COMPLEX*8, D_floating for size REAL*8 or COMPLEX*16, and H_floating for REAL*16 or COMPLEX*32. 'VAXG' - Little endian integer data of the appropriate size (INTEGER*1, INTEGER*2, INTEGER*4, or INTEGER*8) and HP VAX floating-point data of format F_floating for size REAL*4 or COMPLEX*8, G_floating for size REAL*8 or COMPLEX*16, and H_floating for REAL*16 or COMPLEX*32. 'NATIVE' - No data conversion. This is the default. You can use CONVERT to specify multiple formats in a single program, usually one format for each specified unit number. When reading a non-native format, the non-native format on disk is converted to native format in memory. If a converted non-native value is outside the range of the native data type, a run-time message appears. There are other ways to specify numeric format for unformatted files: you can specify an OpenVMS logical name or the compiler option /CONVERT (or OPTIONS/CONVERT). The order of precedence is OpenVMS logical name, OPEN (CONVERT=), OPTIONS/CONVERT, and then compiler option /CONVERT. The /CONVERT compiler option and OPTIONS/CONVERT affect all unit numbers used by the program, while logical names and OPEN (CONVERT=) affect specific unit numbers. The following source code shows how to code the OPEN statement to read unformatted CRAY numeric data from unit 15, which might be processed and possibly written in little endian format to unit 20: OPEN (CONVERT='CRAY', FILE='graph3.dat', FORM='UNFORMATTED', 1 UNIT=15) ... OPEN (FILE='graph3_native.dat', FORM='UNFORMATTED', UNIT=20) 4 DEFAULTFILE Indicates a default file specification string. It takes the following form: DEFAULTFILE = ce ce Is a character expression. This specifier supplies a value to the RMS default file specification string for the missing components of a file specification. If you do not specify the DEFAULTFILE keyword, Fortran uses the default value 'FORnnn.DAT', where nnn is the unit number with leading zeros. The default file pathname string is used primarily when accepting file specifications interactively. File specifications known to a user program are normally completely specified in the FILE keyword. You can specify default values for any one of the following file specification components: node, device, directory, file name, file type, and file version number. When you specify any of the above components in the FILE keyword, they override those values specified in the DEFAULTFILE keyword. The following example uses the file name supplied by the user and the default file specification supplied by the DEFAULTFILE keyword to define the file specification for an existing file: TYPE *, 'ENTER NAME OF DOCUMENT' ACCEPT *, DOC OPEN (UNIT=1, FILE=DOC, DEFAULTFILE='[ARCHIVE].TXT', 1 STATUS='OLD') 4 DELIM Indicates what characters (if any) are used to delimit character constants in list-directed and namelist output. It takes the following form: DELIM = del del Is a character expression with one of the following values: 'APOSTROPHE' Indicates that apostrophes delimit character constants. All internal apostrophes are doubled. 'QUOTE' Indicates that quotation marks delimit character constants. All internal quotation marks are doubled. 'NONE' Indicates that character constants have no delimiters. No internal apostrophes or quotation marks are doubled. This is the default. DELIM is only allowed for files connected for formatted data transfer; it is ignored during input. 4 DISPOSE Indicates the status of the file after the unit is closed. It takes one of the following forms: DISP = dis DISPOSE = dis dis Is a character expression with one of the following values: 'KEEP' or 'SAVE' Retain the file after the unit is closed. (*DEFAULT FOR ALL BUT SCRATCH FILES*) 'DELETE' Delete the file after the unit is closed. (*DEFAULT FOR SCRATCH FILES*) 'PRINT' Submit the file as a print job and retain it. Use this value only with sequential files. 'PRINT/DELETE' Submit the file as a print job and then delete it. Use this value only with sequential files. 'SUBMIT' Submit the file as a batch job and retain it. 'SUBMIT/DELETE' Submit the file as a batch job and then delete it. The disposition specified in a CLOSE statement supersedes the disposition specified in the OPEN statement, except that a file opened as a scratch file cannot be saved, printed, or submitted, nor can a file opened for read-only access be deleted. 4 ERR Identifies a branch target statement that receives control if an error occurs. It takes the following form: ERR = s s Is the label of an executable statement ERR applies only to the OPEN statement in which it is specified, and not in subsequent I/O operations on the unit. If an error occurs, no file is opened or created. However, you can use IOSTAT in subsequent I/O statements to perform a similar function. 4 EXTENDSIZE Indicates the number of blocks by which to extend a disk file (extent) when additional storage space is needed. It takes the following form: EXTENDSIZE = e e Is a numeric expression. The space used to extend a file is contiguous if possible. Otherwise, noncontiguous space is used. The default is the system default for the device. 4 FILE Indicates the name of the file to be connected to the unit. It takes the following form: FILE = name name Is a character or numeric expression. The "name" can be any pathname (or specification) allowed by the operating system. (See the appropriate manual in the OpenVMS operating system documentation set.) Any trailing blanks in the name are ignored. If the following conditions occur: o FILE is omitted o The unit is not connected to a file o STATUS='SCRATCH' is not specified then VSI Fortran generates a file name in the form FORnnn.DAT, where "nnn" is the logical unit number (with leading zeros, if necessary). If the file name is stored in a numeric scalar or array, the name must consist of ASCII characters terminated by an ASCII null character (zero byte). However, if it is stored in a character scalar or array, it must not contain a zero byte. 4 FORM Indicates whether the file is being connected for formatted, unformatted, or binary data transfer. It takes the following form: FORM = ft ft Is a character expression with one of the following values: 'FORMATTED' Formatted *DEFAULT FOR SEQUENTIAL ACCESS* 'UNFORMATTED' Unformatted *DEFAULT FOR KEYED AND DIRECT ACCESS* 'BINARY' Binary 4 INITIALSIZE Indicates the number of blocks in the initial storage allocation (extent) for a disk file. It takes the following form: INITIALSIZE = e e Is a numeric expression. If you do not specify INITIALSIZE or if you specify zero, no initial allocation is made. The system attempts to allocate contiguous space for INITIALSIZE. If not enough contiguous space is available, noncontiguous space is allocated. 4 IOSTAT Designates a variable to store a value indicating the status of a data transfer operation. It takes the following form: IOSTAT = ios ios Is a scalar default integer variable. If no error exists, "ios" is defined as zero. If an error exists, "ios" is defined as a positive integer. IOSTAT applies only to the OPEN statement in which it appears and not to subsequent I/O operations on the logical unit that is opened. However, you can use the IOSTAT parameter in subsequent I/O statements to perform a similar function. Secondary operating system messages do not display when IOSTAT is specified. To display these messages, remove IOSTAT or use a platform-specific method such as a VMS condition handler. (For more information, see the HP Fortran for OpenVMS User Manual.) 4 KEY Defines the access keys for records in an indexed file. It takes the following form: KEY = (kspec[,kspec]...) kspec Takes the following form: e1:e2[:dt[:dr]] e1 Is the position of the first byte of the key in the record. e2 Is the position of the last byte of the key in the record. dt Is the data type of the key: CHARACTER (*DEFAULT*) or INTEGER. dr Is the direction of the key: ASCENDING (*DEFAULT*) or DESCENDING. The length of the key must not exceed 255 bytes. The first byte position of the key must be at least 1 and the last byte position must not exceed the length of the record. If the key type is INTEGER, the key length must be either 2 or 4. Defining Primary and Alternate Keys: You must define at least one key in an indexed file. This is the primary key (the default key). It usually has a unique value for each record. You can also define alternate keys. RMS allows up to 254 alternate keys. If a file requires more keys than the OPEN statement limit, you must create it from another language or with the File Definition Language (FDL). Specifying and Referencing Keys: You must specify the KEY parameter when creating an indexed file. However, you do not have to respecify it when opening an existing file because key attributes are permanent aspects of the file. These attributes include key definitions and reference numbers for subsequent I/O operations. However, if you use the KEY parameter for an existing file, your specification must be identical to the established key attributes. Subsequent I/O operations use a reference number, called the key-of-reference number, to identify a particular key. You do not specify this number; it is determined by the key's position in the specification list: the primary key is key-of-reference number 0; the first alternate key is key-of-reference number 1, and so forth. 4 MAXREC Indicates the maximum number of records that can be transferred from or to a direct access file while the file is connected. It takes the following form: MAXREC = mr mr Is an numeric expression. The default is the maximum allowed (2**32-1). 4 NAME NAME is a nonstandard synonym for FILE. (See OPEN FILE.) 4 NOSPANBLOCKS NOSPANBLOCKS Specifies that records are not to cross disk block boundaries. If a record exceeds the size of a physical block, an error occurs. 4 ORGANIZATION Indicates the internal organization of the file. It takes the following form: ORGANIZATION = org org Is a character expression with one of the following values: 'SEQUENTIAL' Records are stored in the order that they are written. Access mode must be sequential, append, or direct (fixed-length records only). (*DEFAULT FOR NEW FILES*) 'RELATIVE' Records are stored in numbered positions. Access mode must be direct or sequential. 'INDEXED' Records are stored according to the values of their keys. Access mode must be indexed or sequential. The default for an existing file is its current organization. 4 PAD Indicates whether a formatted input record is padded with blanks when an input list and format specification requires more data than the record contains. It takes the following form: PAD = pd pd Is a character expression with one of the following values: 'YES' Indicates the record will be padded with blanks when necessary (the default). 'NO' Indicates the record will not be padded with blanks. The input record must contain the data required by the input list and format specification. This behavior is different from FORTRAN 77, which never pads short records with blanks. For example, consider the following: READ (5,'(I5)') J If you enter 123 followed by a carriage return, FORTRAN 77 will turn the I5 into an I3 and J will be assigned 123. However, VSI Fortran pads the 123 with 2 blanks unless you explicitly open the unit with PAD='NO'. You can override blank padding by explicitly specifying the BN edit descriptor. The PAD specifier is ignored during output. 4 POSITION Indicates the position of a file connected for sequential access. It takes the following form: POSITION = pos pos Is a character expression with one of the following values: 'ASIS' Indicates the file position is unchanged if the file exists and is already connected. The position is unspecified if the file exists but is not connected. This is the default. 'REWIND' Indicates the file is positioned at its initial point. 'APPEND' Indicates the file is positioned at its terminal point (or before its end-of-file record, if any).) A new file (whether specified as new explicitly or by default) is always positioned at its initial point. 4 READONLY READONLY Prohibits WRITE access to the file. Enables users with READ access to access the file. READONLY is similar to specifying ACTION='READ', but READONLY prevents deletion of the file if it is closed with STATUS='DELETE' in effect. Default file access privileges are READWRITE, which can cause run-time I/O errors if the file protection does not permit write access. The READONLY specifier has no effect on the protection specified for a file. Its main purpose is to allow a file to be read simultaneously by two or more programs. For example, use READONLY if you wish to open a file so you can read it, but you also want others to be able to read the same file while you have it open. 4 RECL Indicates the length of logical records in a file connected for direct or keyed access, or the maximum length of a record in a file connected for sequential access. It takes the following form: RECL = rl rl Is an numeric expression. If necessary, the value is converted to integer data type before use. If the file is connected for formatted data transfer, the value must be expressed in bytes (characters). Otherwise, the value is expressed in 4-byte units (longwords). If the file is connected for unformatted data transfer, the value can be expressed in bytes if compiler option /ASSUME=BYTERECL is specified. The "rl" value is the length for record data only. It does not include space for control information, such as two segment control bytes (if present) or the bytes that RMS requires for maintaining record length and deleted record control information. The length specified is interpreted depending on the type of records in the connected file, as follows: o For segmented records, RECL indicates the maximum length for any segment (not including the two segment control bytes). o For fixed-length records, RECL indicates the size of each record. o For variable-length or stream records, RECL specifies the size of the buffer that will be allocated to hold records read or written. Specifying RECL for stream records (STREAM, STREAMCR or STREAMLF) is required if the longest record length in the file exceeds the default RECL value. Errors occur under the following conditions: o If your program attempts to write to an existing file a record that is longer than the logical record length o If you are opening an existing file that contains fixed-length records or has relative organization and you specify a value for RECL that is different from the actual length of the records in the file The following table lists the maximum values that can be specified for "rl" for disk files that use the fixed-length record format: Sequential formatted 32767 bytes Sequential unformatted 8191 longwords Relative formatted 32255 bytes Relative unformatted 8063 longwords Indexed formatted 32224 bytes Indexed unformatted 8056 longwords Tape formatted 9999 bytes Tape unformatted 2499 longwords For other record formats and device types, the record size limit may be less, as described in the OpenVMS Record Management Services Reference Manual. You must specify RECL when opening new files (STATUS='NEW', 'UNKNOWN, or 'SCRATCH') and when one or more of the following conditions exists: o The file is opened for direct access (ACCESS='DIRECT'). o The record format is fixed length (RECORDTYPE='FIXED'). o The file organization is relative or indexed (ORGANIZATION='RELATIVE' or 'INDEXED'). The default value depends on the setting of the RECORDTYPE specifier, as follows: RECORDTYPE value RECL value ---------------- ----------------------------------------- 'FIXED' None; value must be explicitly specified. All other types 133 bytes (for formatted records) 511 longwords (for unformatted records) 4 RECORDSIZE RECORDSIZE is the nonstandard synonym for RECL (see OPEN RECL). 4 RECORDTYPE Indicates the type of records in a file. It takes the following form: RECORDTYPE = typ typ Is a character expression with one of the following values: 'FIXED' All records are one size. Short records are padded with blanks (formatted files) or zeros (unformatted files). 'VARIABLE' Records can vary in length. 'SEGMENTED' A record consists of one or more variable length records which may exist in different physical blocks. Valid only for unformatted, sequential files with sequential access. 'STREAM' Data is not grouped into records and contains no control information. 'STREAM_CR' Variable-length records whose length is indicated by carriage-returns embedded in the data. 'STREAM_LF' Variable-length records whose length is indicated by line-feeds (new lines) embedded in the data. When you open a file, default record types are as follows: +-------------------------------------+---------------------+ | File Type | Default Record Type | +-------------------------------------+---------------------+ | Relative or indexed files | 'FIXED' | | Direct access sequential files | 'FIXED' | | Formatted sequential access files | 'VARIABLE' | | Unformatted sequential access files | 'SEGMENTED' | +-------------------------------------+---------------------+ A segmented record is a logical record consisting of one or more variable-length records (segments). The logical record can span several physical records. Only unformatted sequential-access files with sequential organization can have segmented records; 'SEGMENTED' must not be specified for any other file type. Files containing segmented records can be accessed only by unformatted sequential data transfer statements. You cannot use an unformatted READ statement to access such a file, unless you specify RECORDTYPE='SEGMENTED' in the OPEN statement. Normally, if you do not use the RECORDTYPE specifier when you are accessing an existing file, the record type of the file is used. However, if the file is an unformatted sequential-access file with sequential organization and variable-length records, the default record type is 'SEGMENTED'. If you use the RECORDTYPE specifier when you are accessing an existing file, the type that you specify must match the type of the existing file. If an output statement does not specify a full record for a file containing fixed-length records, the following occurs: o In formatted files, the record is filled with blanks o In unformatted files, the record is filled with zeros 4 SHARED SHARED Specifies that the file can be accessed by more than one user at the same time. For more information on file sharing, see the HP Fortran for OpenVMS User Manual. 4 STATUS Indicates the status of a file when it is opened. It takes the following form: STATUS = sta sta Is a character expression with one of the following values: 'OLD' Open an existing file. 'NEW' Create a new file; if the file already exists an error occurs. 'SCRATCH' Create a new file and delete it when the file is closed. 'REPLACE' Replace the file with another. If the file to be replaced exists, it is deleted and a new file is created with the same name. If the file to be replaced does not exist, a new file is created and its status changes to 'OLD'. 'UNKNOWN' Open the file as OLD; if it does not exist, then open the file as NEW. The default is 'UNKNOWN'. However, if you implicitly open a file using WRITE or you specify compiler option /NOF77 (or OPTIONS /NOF77), the default value is 'NEW'. If you implicitly open a file using READ, the default is 'OLD'. Scratch files (STATUS='SCRATCH') are created on the user's default disk (SYS$DISK) and are not placed in a directory or given a name that is externally visible. To indicate a different device, use the FILE specifier. NOTE The STATUS parameter is also used in CLOSE statements to specify the status of a file after the file is closed. However, in CLOSE statements the STATUS values are the same as those listed for the DISPOSE specifier (see OPEN DISPOSE). 4 TYPE TYPE is a nonstandard synonym for STATUS (see OPEN STATUS). 4 UNIT Indicates the logical unit to which a file is to be connected. It takes the following form: [UNIT=] u u Is a numeric expression The unit specification must appear in the parameter list, unless the unit specifier is the first element in the list. The logical unit may already be connected to a file when an OPEN statement is executed. If this file is not the same as the one to be opened, the OPEN statement executes as if a CLOSE statement had executed just before it. If the file to be opened is already connected to the unit or if the file specifier (FILE keyword) is not included in the OPEN statement, only the blank specifier (BLANK keyword) can have a value different from the one currently in effect. The position of the file is unaffected. 4 USEROPEN Indicates a user-written external function that controls the opening of the file. It takes the following form: USEROPEN = func func Is the symbolic name of the USEROPEN function. The function must be declared in a previous EXTERNAL statement; if it is typed, it must be INTEGER*4. 3 OPTIONAL Permits dummy arguments to be omitted in a procedure reference. The OPTIONAL attribute can be specified in a type declaration statement or an OPTIONAL statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] OPTIONAL [,att-ls] :: d-arg [,d-arg]... Statement: OPTIONAL [::] d-arg [,d-arg]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. d-arg Is the name of a dummy argument. The OPTIONAL attribute can only appear in the scoping unit of a subprogram or an interface body, and can only be specified for dummy arguments. A dummy argument is "present" if it associated with an actual argument. A dummy argument that is not optional must be present. You can use the PRESENT intrinsic function to determine whether an optional dummy argument is associated with an actual argument. To call a procedure that has an optional argument, you must use an explicit interface. The OPTIONAL attribute is compatible with the DIMENSION, EXTERNAL, INTENT, POINTER, TARGET, and VOLATILE attributes. EXAMPLES: The following example shows a type declaration statement specifying the OPTIONAL attribute: SUBROUTINE TEST(A) REAL, OPTIONAL, DIMENSION(-10:2) :: A END SUBROUTINE The following is an example of the OPTIONAL statement: SUBROUTINE TEST(A, B, L, X) OPTIONAL :: B INTEGER A, B, L, X IF (PRESENT(B)) THEN ! Printing of B is conditional PRINT *, A, B, L, X ! on its presence ELSE PRINT *, A, L, X ENDIF END SUBROUTINE INTERFACE SUBROUTINE TEST(ONE, TWO, THREE, FOUR) INTEGER ONE, TWO, THREE, FOUR OPTIONAL :: TWO END SUBROUTINE END INTERFACE INTEGER I, J, K, L I = 1 J = 2 K = 3 L = 4 CALL TEST(I, J, K, L) ! Prints: 1 2 3 4 CALL TEST(I, THREE=K, FOUR=L) ! Prints: 1 3 4 END Note that in the second call to subroutine TEST, the second positional (optional) argument is omitted. In this case, all following arguments must be keyword arguments. 3 OPTIONS Overrides or confirms the compiler options in effect for a program unit. Statement format: OPTIONS option [option...] option Is one of the following: /ASSUME=[NO]UNDERSCORE /CHECK=(ALL, [NO]BOUNDS, [NO]OVERFLOW, [NO]UNDERFLOW, NONE) /NOCHECK /CONVERT=(BIG_ENDIAN, CRAY, FDX, FGX, IBM, LITTLE_ENDIAN, NATIVE, VAXD, VAXG) /[NO]EXTEND_SOURCE /[NO]F77 /FLOAT=(D_FLOAT, G_FLOAT, IEEE_FLOAT) /[NO]G_FLOATING /[NO]I4 /[NO]RECURSIVE You must place the slash (/) before the option. The OPTIONS statement must be the first statement in a program unit, preceding the PROGRAM, SUBROUTINE, FUNCTION, MODULE, and BLOCK DATA statements. OPTIONS statement options have the same syntax and abbreviations as their similarly-named VMS compiler options. OPTIONS statement options override compiler options, but only until the end of the program unit for which they are defined. Thus, an OPTIONS statement must appear before each program unit in which you wish to override the compiler options. 3 PARAMETER Associates a symbolic name with a constant value. The PARAMETER attribute can be specified in a type declaration statement or an PARAMETER statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] PARAMETER [,att-ls] :: p=c [,p=c]... Statement: PARAMETER (p=c [,p=c]...) type Is a data type specifier. att-ls Is an optional list of attribute specifiers. p Is the symbolic name of the constant. c Is a constant, a compile-time expression, or the symbolic name of a constant. If the symbolic name is used as the length specifier in a CHARACTER declaration, it must be enclosed in parentheses. If the symbolic name is used as a numeric item in a FORMAT edit description, it must be enclosed in angle brackets. The symbolic name of a constant cannot appear as part of another constant, although it can appear as either the real or imaginary part of a complex constant. A symbolic name can be defined only once within the same program unit. You can only use a symbolic name defined to be a constant within the program unit containing the defining PARAMETER statement. The data type of a symbolic name associated with a constant is determined as follows: - By an explicit type declaration statement preceding the defining PARAMETER statement - By the same rules for implicit declarations that determine the data type of any other symbolic name For example, the following PARAMETER statement is interpreted as MU=1 (MU has an integer data type by implication): PARAMETER (MU=1.23) If the PARAMETER statement is preceded by an appropriate type declaration or IMPLICIT statement, it could be interpreted as MU=1.23; for example: REAL*8 MU PARAMETER (MU=1.23) Once a symbolic name is associated with a constant, it can appear anywhere in a program that any other constant can appear --- except in FORMAT statements (where constants can only be used in variable format expressions) and as the character count for Hollerith constants. For compilation purposes, writing the name is the same as writing the value. The PARAMETER attribute is compatible with the PRIVATE and PUBLIC attributes. For information on an alternate syntax for PARAMETER, see Help topic: COMPATIBILITY_FEATURES PARAMETER. 3 PAUSE The PAUSE statement displays a message on the terminal and temporarily suspends program execution, so that you can take some action. This statement has been deleted in Fortran 95; it was an obsolescent feature in Fortran 90. VSI Fortran fully supports features deleted in Fortran 95. Statement format: PAUSE [disp] disp Is an optional character constant or a string of up to six digits. (Fortran 95/90 and FORTRAN 77 limit digits to five.) If you do not specify a value for "disp", the system displays the following default message: FORTRAN PAUSE The system then displays the system prompt. If you specify a value for "disp", this value is displayed instead of the default message. EFFECT OF PAUSE IN INTERACTIVE MODE: In interactive mode, the program is suspended until you enter one of the following commands: o CONTINUE - to resume execution at the next executable statement. o DEBUG - to resume execution under control of the VMS Debugger. o EXIT - to terminate execution. Note that any command, other than CONTINUE or DEBUG, terminates execution. EFFECT OF PAUSE IN BATCH PROCESS MODE: If a program is a batch process, the program is not suspended. If you specify a value for "disp", this value is written to the system output file. 3 POINTER Specifies that an object is a pointer. The POINTER attribute can be specified in a type declaration statement or an POINTER statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] POINTER [,att-ls] :: ptr [(spec)] [,ptr [(spec)]]... Statement: POINTER [::] ptr [(spec)] [,ptr [(spec)]]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. ptr Is the name of the pointer. The pointer cannot be declared with the INTENT or PARAMETER attributes. spec Is a deferred-shape specification (: [,:]...). A pointer must not be referenced or defined unless it becomes pointer associated (through pointer assignment or an ALLOCATE statement) with a target object that can be referenced or defined. An object with the POINTER attribute has no initial storage set aside for it. If the pointer is an array, and it is given the DIMENSION attribute elsewhere in the program, it must be declared as a deferred-shape array. A pointer cannot be specified in an EQUIVALENCE or NAMELIST statement. The POINTER attribute is compatible with the AUTOMATIC, DIMENSION (with deferred shape), OPTIONAL, PRIVATE, PUBLIC, SAVE, STATIC, and VOLATILE attributes. EXAMPLES: The following example shows type declaration statements specifying the POINTER attribute: TYPE(SYSTEM), POINTER :: CURRENT, LAST REAL, DIMENSION(:,:), POINTER :: I, J, REVERSE The following is an example of the POINTER statement: TYPE(SYSTEM) :: TODAYS POINTER :: TODAYS, A(:,:) 3 PRINT Transfers output data from internal storage to external records that are sequentially accessed. 4 Formatted Translates data from binary to character format as specified by f. Statement format: PRINT f[,iolist] f Is a format specifier not prefaced by FMT=. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. 4 List-directed Translates data from binary to character format according to the data types of the variables in the I/O list. Statement format: PRINT *[,iolist] * Specifies list-directed formatting. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. 4 Namelist Translates data from binary to character format according to the data types of the list entities in the corresponding NAMELIST statement. Statement format: PRINT n n Is a namelist group name not prefaced by NML=. 3 PRIVATE_and_PUBLIC Specify the accessibility of entities in a module. (These attributes are also called accessibility attributes.) The PRIVATE and PUBLIC attributes can be specified in a type declaration statement or in a PRIVATE or PUBLIC statement, and take one of the following forms: Type Declaration Statement: type, [att-ls,] PRIVATE [,att-ls] :: ent [,ent]... type, [att-ls,] PUBLIC [,att-ls] :: ent [,ent]... Statement: PRIVATE [[::] ent [,ent]...] PUBLIC [[::] ent [,ent]...] type Is a data type specifier. att-ls Is an optional list of attribute specifiers. ent Is one of the following: A variable name A procedure name A derived type name A named constant A namelist group name In statement form, an entity can also be a generic identifier (a generic name, defined operator, or defined assignment). The PRIVATE and PUBLIC attributes can only appear in the scoping unit of a module. Only one PRIVATE or PUBLIC statement without an entity list is permitted in the scoping unit of a module; it sets the default accessibility of all entities in the module. If no PUBLIC or PRIVATE statements are specified in a module, the default is PUBLIC accessibility. Entities with PUBLIC accessibility can be accessed from outside the module by means of a USE statement. If a derived type is declared PRIVATE in a module, its components are also PRIVATE. The derived type and its components are accessible to any subprograms within the defining module through host association, but they are not accessible from outside the module. If the derived type is declared PUBLIC in a module, but its components are declared PRIVATE, any scoping unit accessing the module though use association (or host association) can access the derived-type definition, but not its components. If a module procedure has a dummy argument or a function result of a type that has PRIVATE accessibility, the module procedure must have PRIVATE accessibility. If the module has a generic identifier, it must also be declared PRIVATE. If a procedure has a generic identifier, the accessibility of the procedure's specific name is independent of the accessibility of its generic identifier. One can be declared PRIVATE and the other PUBLIC. The PRIVATE attribute is compatible with the ALLOCATABLE, DIMENSION, EXTERNAL, INTRINSIC, PARAMETER, POINTER, SAVE, STATIC, TARGET, and VOLATILE attributes. The PUBLIC attribute is compatible with the ALLOCATABLE, DIMENSION, EXTERNAL, INTRINSIC, PARAMETER, POINTER, SAVE, STATIC, TARGET, and VOLATILE attributes. EXAMPLES: The following examples show type declaration statements specifying the PUBLIC and PRIVATE attributes: REAL, PRIVATE :: A, B, C INTEGER, PUBLIC :: LOCAL_SUMS The following is an example of the PUBLIC and PRIVATE statements: MODULE SOME_DATA REAL ALL_B PUBLIC ALL_B TYPE RESTRICTED_DATA REAL LOCAL_C DIMENSION LOCAL_C(50) END TYPE RESTRICTED_DATA PRIVATE RESTRICTED_DATA END MODULE The following derived-type declaration statement indicates that the type is restricted to the module: TYPE, PRIVATE :: DATA ... END TYPE DATA The following example shows a PUBLIC type with PRIVATE components: MODULE MATTER TYPE ELEMENTS PRIVATE INTEGER C, D END TYPE ... END MODULE MATTER In this case, components C and D are private to type ELEMENTS, but type ELEMENTS is not private to MODULE MATTER. Any program unit that uses the module MATTER, can declare variables of type ELEMENTS, and pass as arguments values of type ELEMENTS. 3 PROGRAM Begins a main program. The PROGRAM statement is optional; when used, it can only be preceded by comment lines or an OPTIONS statement. Statement format: PROGRAM nam nam Is a symbolic name for the program. The name must be unique among all global names in the program. If no PROGRAM statement begins the program, the program name defaults to filename$MAIN, where filename is the name of the file containing the program. The main program cannot contain the following attributes: INTENT, OPTIONAL, PRIVATE, or PUBLIC. A main program can contain an internal subprogram (defines an internal procedure). It must be preceded by a CONTAINS statement. 3 READ Transfers data from external or internal units to internal storage. The meanings of the symbolic abbreviations used to represent the parameters in the READ statement syntax are as follows: extu Is the logical unit or internal file optionally or prefaced by UNIT=. UNIT= is required if unit is intu not the first element in the clist. fmt Specifies whether formatting is to be used for data editing, and if it is, the format specification or an asterisk (*) to indicate list-directed formatting. The "fmt" is optionally prefaced by FMT=, if "fmt" is the second parameter in the clist and the first parameter is a logical or internal unit specifier without the optional keyword UNIT=. nml Is the namelist group specification for namelist I/O. Optionally prefaced by NML=. NML= is required if namelist is not the second I/O specifier. rec Is the cell number of a record to be accessed directly. Optionally prefaced by REC= or by an apostrophe ('). iostat Is the name of a variable to contain the completion status of the I/O operation. Optionally prefaced by IOSTAT=. err Is the label of a statement to which control is transferred in the event of an error. Optionally prefaced by ERR=. end Is the label of a statement to which control is transferred in the event of an end-of-file. Optionally prefaced by END=. eor Is the label of a statement to which control is transferred in the event of an end-of-record. Optionally prefaced by EOR=. This can only be specified for nonadvancing READs. adv Specifies advancing (ADVANCE='YES') or nonadvancing input (ADVANCE='NO'). The default is 'YES'. size Specifies character count (SIZE=int). It can only be indicated for nonadvancing READs. keyspec Specifies the key of field value of a record to be accessed. Optionally prefaced by KEY=, KEYEQ=, KEYGE=, KEYGT=, KEYNXT, KEYNXTNE, KEYLT, or KEYLE. keyid Specifies the key field index that is to be searched for the specified key field value. Optionally in- cluded with keyspec and optionally prefaced by KEYID=. iolist Are the names of the variables, arrays, array elements, or character substrings from which or to which data will be transferred. Optionally an implied-DO list. The control-list parameters are "extu" (or "intu"), "fmt", "nml", "rec", "iostat", "err", "end", "adv", "size", "keyspec", and "keyid". The I/O list parameter is "iolist". 4 Sequential 5 Formatted Translates the data from character to binary format as specified by format specifications. Statement formats: 1. READ (extu, fmt [,adv][,size][,iostat][,err][,end][,eor]) [iolist] Reads from a specified external unit. 2. READ fmt [,iolist] Reads from FOR$READ (normally, the terminal). 5 List-directed List-directed sequential READ statement formats: 1. READ(extu,*[,iostat][,err][,end])[iolist] Reads from a specified external unit. Translates the data from character to binary format according to the data types of the variables in the I/O list. 2. READ * [,iolist] Reads from FOR$READ (normally, the terminal). Translates the data from character to binary format according to the data types of the variables in the I/O list. 5 Namelist Namelist sequential READ statement formats: 1. READ (extu,nml [,iostat][,err][,end]) Reads from a specified external unit. Translates the data from character to binary format according to the data types of the list entities in the corresponding NAMELIST statement. 2. READ nml Reads from FOR$READ (normally, the terminal). Translates the data from character to binary format according to the data types of the entities in the corresponding NAMELIST statement. 5 Unformatted Unformatted sequential READ statement format: READ (extu,[,iostat][,err][,end]) [iolist] Reads from a specified external unit. Does not translate the data. 4 Direct 5 Formatted Formatted direct READ statement format: READ (extu,fmt,rec[,iostat][,err]) [iolist] Reads from a specified external unit. Translates the data from character to binary format as specified by "fmt". 5 Unformatted Unformatted direct READ statement format: READ (extu,rec[,iostat][,err]) [iolist] Reads from a specified external unit. Does not translate the data. 4 Indexed 5 Formatted Formatted Indexed READ statement format: READ (extu,fmt,keyspec[,keyid][,err][,iostat]) [iolist] Reads from a specified external unit. Translates the data from character to binary format as specified by "fmt". 5 Unformatted Unformatted Indexed READ statement format: READ (extu,keyspec[,keyid][,err][,iostat]) [iolist] Reads from a specified external unit. Does not translate the data. 4 Internal Internal READ statement format: READ (intu,fmt[,err][,iostat][,end]) [iolist] Reads from a specified character variable. Translates the data from character to binary format as specified by "fmt". 3 RECORD Creates a record structure consisting of the variables and arrays specified in a previous structure declaration. Statement format: RECORD /str/rnlist[,/str/rnlist...] str Is the name of a previously declared structure. rnlist Is a list of one or more variable names, array names, or array declarators, separated by commas. All of the records named in this list have the same structure and are allocated separately in memory. Record variables can be used in COMMON and DIMENSION statements, but not in DATA, EQUIVALENCE, or NAMELIST statements. Records initially have undefined values unless you have defined their values in structure declarations. See also COMPATIBILITY_FEATURES RECORD_STRUCTURE in this Help file. 3 RETURN Transfers control from a subprogram to the calling program. You can only use RETURN in a subprogram unit. Statement format: RETURN [i] i Is an optional integer constant or expression (such as 2 or I+J) indicating the position of an alternate return from the subprogram in the actual argument list. The "i" is converted to an integer value if necessary. The argument "i" is valid only for subroutine subprograms. If no alternate return is specified or the specified alternate return does not exist in the actual argument list, control returns to the statement following the CALL statement. NOTE An alternate return is an obsolescent feature in Fortran 95 and Fortran 90. VSI Fortran fully supports this feature. If the subprogram is a function, control returns to the statement containing the function reference. If the subprogram is a subroutine, control returns either to the statement following the CALL statement, or to the label specified by the alternate return argument. 3 REWIND Positions a sequential or direct access file at the beginning of the file. Do not use a REWIND statement for a file that is open for indexed access. Use this statement only for files on disk or magnetic tape. Statement format: REWIND ([UNIT=]u[,ERR=s][,IOSTAT=ios]) REWIND u u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. s Is the label of a statement to which control is transferred if an error occurs, prefaced by ERR=. ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT=. The unit number must refer to a file on disk or magnetic tape, and the file must be open for sequential, direct, or append access. If a REWIND is done on a direct access file, the NEXTREC specifier is assigned a value of 1. A REWIND statement must not be specified for a file that is open for keyed access. If a file is already positioned at the initial point, a REWIND statement has no effect. If a REWIND statement is specified for a unit that is not open, it has no effect. See also STATEMENTS BACKSPACE in this Help file. 3 REWRITE Transfers data from internal storage and writes the data (translated if formatted; untranslated if unformatted) to the current record in the following types of files: an indexed, sequential (only if the current record and new record are the same length), or relative file. The current record is the last record accessed by a preceding, successful direct access, indexed, or sequential READ statement. Formatted REWRITE statement format: REWRITE ([UNIT=]u,[FMT=]f[,ERR=s][,IOSTAT=ios])[iolist] Translates the data from binary to character format as specified by FMT. Unformatted REWRITE statement format: REWRITE ([UNIT=]u[,ERR=s][,IOSTAT=ios])[iolist] Does not translate the binary data. Arguments: u Is an integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. f Is a format specifier. s Is the label of a statement to which control is transferred if an error condition occurs, prefaced by ERR=. ios Is an integer variable to which the completion status of the I/O operation is returned, prefaced by IOSTAT=. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. Formatted REWRITE Statement Behavior and Errors: The formatted REWRITE statement performs the following operations: o It retrieves binary values from internal storage. o It translates those values to character form as specified by FORMAT. o It writes the translated data to a current (existing) record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.) The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement. Errors occur under the following conditions: o If you attempt to rewrite more than one record in a single REWRITE statement operation o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with spaces.) o If the primary key value is changed In the following example, the REWRITE statement updates the current record contained in the relative organization file connected to logical unit 3 with the values represented by NAME, AGE, and BIRTH. REWRITE (3,10,ERR=99) NAME, AGE, BIRTH 10 FORMAT (A16,I2,A8) Unformatted REWRITE Statement Behavior and Errors: The formatted REWRITE statement performs the following operations: o It retrieves binary values from internal storage. o It writes the untranslated data to a current (existing) existing record in a file OPENed with ORGANIZATION='INDEXED', 'RELATIVE', or 'SEQUENTIAL' (For SEQUENTIAL organization, the new record must be the same length as the existing record.) The current record is the last record accessed by a preceding, successful indexed, direct access, or sequential READ statement. Errors occur under the following conditions: o If you attempt to rewrite more than one record in a single REWRITE statement operation o If a record is too long (Note that unused space in a rewritten, fixed-length record is filled with zeros.) o If the primary key value is changed 3 SAVE Causes the values and definition of objects to be saved across invocations of a subprogram. The SAVE attribute can be specified in a type declaration statement or SAVE statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] SAVE [,att-ls] :: [obj [,obj]...] Statement: SAVE [obj [,obj]...] type Is a data type specifier. att-ls Is an optional list of attribute specifiers. obj Is the name of an object, or the name of a common block enclosed in slashes (such as /CBLOCK/). In VSI Fortran, the definitions of COMMON variables, and local variables of non-recursive subprograms (other than allocatable arrays or variables declared AUTOMATIC), are saved by default. To enhance portability and avoid possible compiler warning messages, HP recommends that you use the SAVE statement to name variables whose values you want to preserve between subprogram invocations. When a SAVE statement does not explicitly contain a list, all allowable items in the scoping unit are saved. A SAVE statement cannot specify the following (their values cannot be saved): o A blank common o An object in a common block o A procedure o A dummy argument o A function result o An automatic object o A PARAMETER (named) constant Even though a common block can be included in a SAVE statement, individual variables within the common block can become undefined (or redefined) in another scoping unit. If a common block is saved in any scoping unit of a program (other than the main program), it must be saved in every scoping unit in which the common block appears. A SAVE statement has no effect in a main program. The SAVE attribute is compatible with the ALLOCATABLE, DIMENSION, POINTER, PRIVATE, PUBLIC, STATIC, TARGET, and VOLATILE attributes. 3 Statement_Function Defines a function consisting of a single expression. The function must be invoked from the program unit in which it is defined. Format: fun([p [,p]...])=e fun Is the symbolic name for the function. You can establish its type explicitly or implicitly. The value of the expression is returned to the function name when the function is invoked. p Is an unsubscripted variable name specifying a dummy argument. The arguments must agree in order, number, and type with the actual arguments of the statement invoking the function. e Is an arithmetic, logical, or character expression. If the expression contains a reference to another statement function, the referenced statement function must precede the statement function containing the reference. Declarator information does not apply to a dummy argument except for type. For example, you cannot define a dummy argument as an array or as part of a common block. If you use the name of a dummy argument outside the function statement, the name defines another separate data entity. NOTE This statement is obsolescent in Fortran 95. HP Fortran flags obsolescent features, but fully supports them. 3 SELECT_CASE See STATEMENTS CASE in this Help file. 3 SEQUENCE Permitted for derived types. Allows derived-type components to be used in COMMON and EQUIVALENCE statements. See DATA DERIVED_TYPES TYPE_DEFINITIONS in this Help file. 3 STOP Terminates program execution. Statement format: STOP [disp] disp Is a character constant or a string of up to six digits. (Fortran 95/90 and FORTRAN 77 limit digits to five.) If you specify the optional argument "disp", the STOP statement displays the contents of "disp" at your terminal, terminates program execution, and returns control to the operating system. If you do not specify a value for "disp", no message is displayed. 3 STRUCTURE Indicates the beginning of the record structure declaration and defines the name of the structure. Declaration format: STRUCTURE [/str/][fnlist] fdcl [fdcl] ... [fdcl] END STRUCTURE str Identifies a structure name, which is used in subsequent RECORD statements to refer to the structure. A structure name is enclosed in slashes. fnlist Identifies field names when used in a substructure declaration.(Only allowed in nested structure declarations.) fdcl (Also called the declaration body.) Is any declaration or combination of declarations of substructures, unions, or typed data, or PARAMETER statements. Subsequent RECORD statements use the structure name to refer to the structure. A structure name must be unique among structure names, but structures can share names with variables (scalar or array), record fields, PARAMETER constants, and common blocks. Structure declarations can be nested (contain one or more other structure declarations). A structure name is required for the structured declaration at the outermost level of nesting, and optional for the other declarations nested in it. However, if you wish to reference a nested structure in a RECORD statement in your program, it must have a name. Structure, field, and record names are all local to the defining program unit. When records are passed as arguments, the fields must match in type, order, and dimension. Unlike type declaration statements, structure declarations do not create variables. Structured variables (records) are created when you use a RECORD statement containing the name of a previously declared structure. The RECORD statement can be considered as a kind of type declaration statement. The difference is that aggregate items, not single items, are being defined. Within a structure declaration, the ordering of both the statements and the field names within the statements is important because this ordering determines the order of the fields in records. In a structure declaration, each field offset is the sum of the lengths of the previous fields. The length of the structure, therefore, is the sum of the lengths of its fields. The structure is packed; you must explicitly provide any alignment that is needed by including, for example, unnamed fields of the appropriate length. By default, fields are aligned on natural boundaries; misaligned fields are padded as necessary. To avoid padding of records, you should lay out structures so that all fields are naturally aligned. To pack fields on arbitrary byte boundaries, you must specify a compiler option. You can also specify alignment for fields by using the cDEC$ OPTIONS general directive. In the following example, the declaration defines a structure named DATE. This structure contains three scalar fields: DAY (LOGICAL*1), MONTH (LOGICAL*1), and YEAR (INTEGER*2). STRUCTURE /DATE/ LOGICAL*1 DAY, MONTH INTEGER*2 YEAR END STRUCTURE See also COMPATIBILITY_FEATURES RECORD_STRUCTURE in this Help file. 4 Type_declarations The syntax of a type declaration within a record structure is identical to that of a normal Fortran type declaration statement: it includes a data type (for example, INTEGER), one or more names of variables or arrays; and optionally, one or more data initialization values. The following rules and behavior apply to type declarations in record structures: o %FILL can be specified in place of a field name to leave space in a record for purposes such as alignment. This creates an unnamed field. %FILL can have an array declarator; for example: INTEGER %FILL (2,2) Unnamed fields cannot be initialized. For example, the following statement is invalid and generates an error message: INTEGER*4 %FILL /1980/ o Initial values can be supplied in field declaration statements. These initial values are supplied for all records that are declared using this structure. Fields not initialized will have undefined values when variables are declared by means of RECORD statements. Unnamed fields cannot be initialized; they are always undefined. o Field names must always be given explicit data types. The IMPLICIT statement has no effect on statements within a structure declaration. o All Fortran data types are allowed in field declarations. o Any required array dimensions must be specified in the field declaration statements. DIMENSION statements cannot be used to define field names. o Adjustable or assumed sized arrays and passed-length CHARACTER declarations are not allowed in field declarations. o Field names within the same declaration level must be unique, but an inner structure declaration (substructure declaration) can include field names used in an outer structure declaration without conflict. 4 Substructure_declarations A field within a structure can itself be a structured item composed of other fields, other structures, or both. You can declare a substructure in two ways: o By nesting structure declarations within other structure or union declarations (with the limitation that you cannot refer to a structure inside itself at any level of nesting). One or more field names must be defined in the STRUCTURE statement for the substructure because all fields in a structure must be named. In this case, the substructure is being used as a field within a structure or union. Field names within the same declaration nesting level must be unique, but an inner structure declaration can include field names used in an outer structure declaration without conflict. %FILL can be specified in place of a field name to leave space in a record for purposes such as alignment. o By using a RECORD statement that specifies another previously defined record structure, thereby including it in the structure being declared. 4 Union_declarations A union declaration is a multistatement declaration defining a data area that can be shared intermittently during program execution by one or more fields or groups of fields. A union declaration must be within a structure declaration. A union declaration is initiated by a UNION statement and terminated by an END UNION statement. Enclosed within these statements are two or more map declarations, initiated and terminated by MAP and END MAP statements. Each unique field or group of fields is defined by a separate map declaration. A union declaration takes the following form: UNION mdcl [mdcl] ... [mdcl] END UNION Where "mdcl" represents: MAP fdcl [fdcl] ... [fdcl] END MAP fdcl Is any declaration or combination of declarations of substructures, unions, or type declarations. As with normal Fortran type declarations, data can be initialized in field declaration statements in union declarations. However, if fields within multiple map declarations in a single union are initialized, the data declarations are initialized in the order in which the statements appear. As a result, only the final initialization takes effect and all of the preceding initializations are overwritten. The size of the shared area established for a union declaration is the size of the largest map defined for that union. The size of a map is the sum of the sizes of the fields declared within it. As the variables or arrays declared in map fields in a union declaration are assigned values during program execution, the values are established in a record in the field shared with other map fields in the union. The fields of only one of the map declarations are defined within a union at any given point in the execution of a program. However, if you overlay one variable with another smaller variable, that portion of the initial variable is retained that is not overlaid. Depending on the application, the retained portion of an overlaid variable may or may not contain meaningful data and can be utilized at a later point in the program. Manipulating data using union declarations is similar to the effect of using EQUIVALENCE statements. The difference is that data entities specified within EQUIVALENCE statements are concurrently associated with a common storage location and the data residing there; with union declarations you can use one discrete storage location to alternately contain a variety of fields (arrays or variables). With union declarations, only one map declaration within a union declaration can be associated at any point in time with the storage location that they share. Whenever a field within another map declaration in the same union declaration is referenced in your program, the fields in the prior map declaration become undefined and are succeeded by the fields in the map declaration containing the newly referenced field. In the following example, the structure WORDS_LONG is defined. This structure contains a union declaration defining two map fields. The first map field consists of three INTEGER*2 variables (WORD_0, WORD_1, and WORD_2), and the second, an INTEGER*4 variable, LONG: STRUCTURE /WORDS_LONG/ UNION MAP INTEGER*2 WORD_0, WORD_1, WORD_2 END MAP MAP INTEGER*4 LONG END MAP END UNION END STRUCTURE 4 PARAMETER_Statements PARAMETER statements: PARAMETER statements can appear in a structure declaration, but cannot be given a data type within the declaration block. Consider the following: STRUCTURE /ABC/ INTEGER*4 P PARAMETER (P=4) REAL*4 F END STRUCTURE REAL*4 A(P) In this example, the INTEGER*4 statement does not provide the data type for PARAMETER constant P, but instead declares a record field P in structure ABC. The subsequent PARAMETER statement declares a new, different symbol which is given the implicit data type for identifiers beginning with the letter P. Type declarations for PARAMETER symbolic names must precede the PARAMETER statement and be outside of a STRUCTURE declaration, as follows: INTEGER*4 P STRUCTURE /ABC/ PARAMETER (P=4) REAL*4 F END STRUCTURE REAL*4 A(P) For more information on PARAMETER statements, see STATEMENTS PARAMETER in this Help file. 3 SUBROUTINE Begins a subroutine subprogram and names the dummy arguments. The CALL statement transfers control to a subroutine subprogram; a RETURN or END statement returns control to the calling program unit. Statement format: [prefx] SUBROUTINE nam [([p[,p]...])] prefx Is one of the following keywords: RECURSIVE Permits direct recursion to occur. PURE Restricts the procedure from having side effects. ELEMENTAL Specifies PURE with certain constraints on a dummy argument: o It must be scalar and cannot have the POINTER attribute. o It cannot appear in a specification expression, except as an argument to the BIT_SIZE, KIND, or LEN intrinsic functions or the numeric inquiry intrinsic functions o It must not be * o It must not be a dummy procedure An explicit interface must be visible to the caller of an ELEMENTAL procedure. If ELEMENTAL is specified, RECURSIVE must not be specified. nam Is a symbolic name for the subroutine. The name must be unique among all global names in the program. p Is an unsubscripted variable name specifying a dummy argument. An asterisk (*) as a dummy argument specifies that the actual argument is an alternate return argument. The arguments must agree in order, number, and type with the actual arguments of the statement invoking the subroutine. A dummy argument must not be defined as an array with more elements than the actual argument holds. When control transfers to the subroutine, the values of any actual arguments in the CALL statement are associated with any corresponding dummy arguments in the SUBROUTINE statement. The statements in the subprogram are then executed. The SUBROUTINE statement must be the first statement of a subroutine, unless an OPTIONS statement is specified. A subroutine subprogram cannot contain a FUNCTION statement, a BLOCK DATA statement, a PROGRAM statement, or another SUBROUTINE statement. ENTRY statements are allowed to specify multiple entry points in the subroutine. The array declarator for a dummy argument can itself contain integer values that are dummy arguments or are references to a common block, providing for adjustable size arrays in subroutines. The upper bound of the array declarator for a dummy argument can be specified as an asterisk, in which case the upper bound of the dummy argument assumes the size of the upper bound of the actual argument. The size in a character string declarator for a dummy argument can be specified as an asterisk in parentheses, in which case the size of the actual argument is passed to the dummy argument. The values of the actual arguments in the invoking program unit become the values of the dummy arguments in the function. If you modify a dummy argument, the corresponding actual argument in the invoking program unit is also modified; the actual argument must be a variable if it is to be modified. If the actual argument is a character constant, the dummy argument can be either character or numeric in type, unless the name of the subprogram being invoked is a dummy argument in the invoking program unit. If the actual argument is a Hollerith constant, the dummy argument must be numeric. 3 TARGET Specifies that an object can become the target of a pointer. The TARGET attribute can be specified in a type declaration statement or TARGET statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] TARGET [,att-ls] :: obj [spec] [,obj [spec]]... Statement: TARGET [::] obj [spec] [,obj [spec]]... type Is a data type specifier. att-ls Is an optional list of attribute specifiers. obj Is the name of an object. The object must not be declared with the PARAMETER attribute. spec Is an array specification. A pointer is associated with a target by pointer assignment or by an ALLOCATE statement. If an object does not have the TARGET attribute or has not been allocated (using an ALLOCATE statement), no part of it can be accessed by a pointer. The TARGET attribute is compatible with the ALLOCATABLE, AUTOMATIC, DIMENSION, INTENT, OPTIONAL, PRIVATE, PUBLIC, SAVE, STATIC, and VOLATILE attributes. EXAMPLES: The following example shows type declaration statements specifying the TARGET attribute: TYPE(SYSTEM), TARGET :: FIRST REAL, DIMENSION(20, 20), TARGET :: C, D The following is an example of a TARGET statement: TARGET :: C(50, 50), D 3 TYPE Transfers output data from internal storage to external records that are sequentially accessed. 4 Formatted Translates data from binary to character format as specified by the format specifications. Statement format: TYPE f[,iolist] f Is a format specifier not prefaced by FMT=. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. 4 List-directed Translates data from binary to character format according to the data types of the variables in the I/O list. Statement format: TYPE *[,iolist] * Specifies list-directed formatting. iolist Are the names of the variables from which the data is transferred, listed in the order of transfer. 4 Namelist Translates data from binary to character format according to the data types of the list entities in the corresponding NAMELIST statement. Statement format: TYPE n n Is a namelist group name not prefaced by NML=. 3 Type_declaration Explicitly specifies the properties of data objects or functions. Type declarations must precede all executable statements, can be declared only once, and cannot be used to change the type of a symbolic name that has already been implicitly assumed to be another type. Type declaration statements can initialize data in the same way as the DATA statement: by having values, bounded by slashes, listed immediately after the symbolic name of the entity. 4 Numeric Statement format: type[*n] [[,att]...::] v [*n][/clist/][,v [*n][/clist/]]... type Is any of the following data type specifiers: BYTE (equivalent to INTEGER*1) DOUBLE PRECISION LOGICAL COMPLEX INTEGER DOUBLE COMPLEX REAL n Is an integer that specifies (in bytes) the length of "v". It overrides the length that is implied by the data type. The value of n must specify an acceptable length for the type of "v" (see the HP Fortran for OpenVMS Language Reference Manual). BYTE, DOUBLE PRECISION, and DOUBLE COMPLEX data types have one acceptable length; thus, for these data types, the "n" specifier is invalid. If an array declarator is used, the "n" specifier must be positioned immediately after the array name. att Is one of the following attribute specifiers: ALLOCATABLE POINTER AUTOMATIC PRIVATE DIMENSION PUBLIC EXTERNAL SAVE INTENT STATIC INTRINSIC TARGET OPTIONAL VOLATILE PARAMETER v Is the name of a data object or function. It can optionally be followed by: o An array specification, if the object is an array o A character length, if the object is of type character o An initialization expression or, for pointer objects, =>NULL() clist Is a list of constants, as in a DATA statement. If "v" is the symbolic name of a constant, the "clist" cannot be present. A numeric data type declaration statement can define arrays by including array specifications in the list. A numeric type declaration statement can assign initial values to variables or arrays if it specifies a list of constants (the "clist"). The specified constants initialize only the variable or array that immediately precedes them. The "clist" cannot have more than one item unless it initializes an array. When the "clist" initializes an array, it must contain a value for every element in the array. If =>NULL() appears for a pointer, the pointer's initial association status is disassociated. In a function declaration, an array must be a deferred-shape array if it has the POINTER attribute; otherwise, it must be an explicit-shape array. The double colon separator (::) is required only if the declaration contains an attribute specifier or an initialization expression; otherwise it is optional. The same attribute must not appear more than once in a given type declaration statement, and an entity cannot be given the same attribute more than once in a scoping unit. If the PARAMETER attribute is specified, the declaration must contain an initialization expression. The following objects cannot be initialized in a type declaration statement: o A dummy argument o A function result o An object in a named common block (unless the type declaration is in a block data program unit) o An object in blank common o An allocatable array o A pointer o An external name o An intrinsic name o An automatic object o An object that has the AUTOMATIC attribute 4 Character Format: CHARACTER[*len[,] [[,att]...::] v[*len] [/clist/] [,v[*len] [/clist/]]... len Is an unsigned integer constant, an integer constant expression enclosed in parentheses, or an asterisk (*) enclosed in parentheses. The value of "len" specifies the length of the character data elements. att Is one of the following attribute specifiers: ALLOCATABLE POINTER AUTOMATIC PRIVATE DIMENSION PUBLIC EXTERNAL SAVE INTENT STATIC INTRINSIC TARGET OPTIONAL VOLATILE PARAMETER v Is the symbolic name of a constant, variable, array, statement function or function subprogram, or array specification. The name can optionally be followed by a data type length specifier (*len or *(*)). clist Is a list of constants, as in a DATA statement. If "v" is the symbolic name of a constant, "clist" must not be present. If you use CHARACTER*len, "len" is the default length specification for that list. If an item in that list does not have a length specification, the item's length is "len". However, if an item does have a length specification, it overrides the default length specified in CHARACTER*len. When an asterisk length specification *(*) is used for a function name or dummy argument, it assumes the length of the corresponding function reference or actual argument. Similarly, when an asterisk length specification is used for the symbolic name of a constant, the name assumes the length of the actual constant it represents. For example, STRING assumes a 9-byte length in the following statements: CHARACTER*(*) STRING PARAMETER (STRING = 'VALUE IS:') The length specification must range from 1 to 65535. If no length is specified, a length of 1 is assumed. Character type declaration statements can define arrays if they include array specifications in their list. The array specification goes first if both an array specification and a length are specified. A character type declaration statement can assign initial values to variables or arrays if it specifies a list of constants (the clist). The specified constants initialize only the variable or array that immediately precedes them. The "clist" cannot have more than one element unless it initializes an array. When the "clist" initializes an array, it must contain a value for every element in the array. In a function declaration, an array must be a deferred-shape array if it has the POINTER attribute; otherwise, it must be an explicit-shape array. The double colon separator (::) is required only if the declaration contains an attribute specifier or an initialization expression; otherwise it is optional. The same attribute must not appear more than once in a given type declaration statement, and an entity cannot be given the same attribute more than once in a scoping unit. If the PARAMETER attribute is specified, the declaration must contain an initialization expression. The following objects cannot be initialized in a type declaration statement: o A dummy argument o A function result o An object in a named common block (unless the type declaration is in a block data program unit) o An object in blank common o An allocatable array o A pointer o An external name o An intrinsic name o An automatic object o An object that has the AUTOMATIC attribute NOTE The CHARACTER*len form for a CHARACTER declaration is obsolescent in Fortran 95. VSI Fortran flags obsolescent features, but fully supports them. 3 UNION See STATEMENTS STRUCTURE (subheads TYPE_DECLARATIONS and UNION_DECLARATIONS) in this Help file. 3 UNLOCK Frees the current record (that is, the last record read) in an indexed, relative, or sequential file. By default, a record is locked when it is read. The lock is normally held until your program performs another I/O operation on the unit (for example, rewriting the record, reading another record, or closing the file). Statement format: UNLOCK ([UNIT=]u[,ERR=s][,IOSTAT=ios]) UNLOCK u u An integer variable or constant specifying the logical unit number of the file, optionally prefaced by UNIT=. UNIT= is required if unit is not the first I/O specifier. s The label of a statement to which control is transferred if an error condition occurs. ios A scalar default integer variable that is defined as a positive integer if an error occurs and zero if no error occurs. 3 USE Gives a program unit accessibility to public entities in a module. It takes one of the following forms: USE name [, rename-ls] USE name, ONLY : [only-ls] name Is the name of the module. rename-ls Is one or more items having the following form: local-name => mod-name local-name Is the name of the entity in the program unit using the module. mod-name Is the name of a public entity in the module. only-ls Is the name of a public entity in the module or a generic identifier (a generic name, defined operator, or defined assignment). An entity in the "only-ls" can also take the form: [local-name =>] mod-name If the USE statement is specified without the ONLY option, the program unit has access to all public entities in the named module. If the USE statement is specified with the ONLY option, the program unit has access to only those entities following the option. If more than one USE statement for a given module appears in a scoping unit, the following rules apply: o If one USE statement does not have the ONLY option, all public entities in the module are accessible, and any "rename-ls"s and "only-ls"s are interpreted as a single, concatenated "rename-ls". o If all the USE statements have ONLY options, all the "only-ls"s are interpreted as a single, concatenated "only-ls". Only those entities named in one or more of the "only-ls"s are accessible. If two or more generic interfaces that are accessible in a scoping unit have the same name, the same operator, or are both assignments, they are interpreted as a single generic interface. Otherwise, multiple accessible entities can have the same name only if no reference to the name is made in the scoping unit. The local names of entities made accessible by a USE statement must not be respecified with any attribute other than PUBLIC or PRIVATE. The local names can appear in namelist group lists, but not in a COMMON or EQUIVALENCE statement. EXAMPLES: The following shows examples of the USE statement: MODULE MOD_A INTEGER :: B, C REAL E(25,5), D(100) END MODULE MOD_A ... SUBROUTINE SUB_Y USE MOD_A, DX => D, EX => E ! Array D has been renamed ! DX and array E ... ! has been renamed EX. Scalar ! variables B END SUBROUTINE SUB_Y ! and C are also available to ... ! this subroutine (using their ! module names). SUBROUTINE SUB_Z USE MOD_A, ONLY: B, C ! Only scalar variables B and ! C are ... ! available to this subroutine END SUBROUTINE SUB_Z ... The following example shows a module containing common blocks: MODULE COLORS COMMON /BLOCKA/ C, D(15) COMMON /BLOCKB/ E, F ... END MODULE COLORS ... FUNCTION HUE(A, B) USE COLORS ... END FUNCTION HUE The USE statement makes all of the variables in the common blocks in module COLORS available to the function HUE. To provide data abstraction, a user-defined data type and operations to be performed on values of this type can be packaged together in a module. The following example shows such a module: MODULE CALCULATION TYPE ITEM REAL :: X, Y END TYPE ITEM INTERFACE OPERATOR (+) MODULE PROCEDURE ITEM_CALC END INTERFACE CONTAINS FUNCTION ITEM_CALC (A1, A2) TYPE(ITEM) A1, A2, ITEM_CALC ... END FUNCTION ITEM_CALC ... END MODULE CALCULATION PROGRAM TOTALS USE CALCULATION TYPE(ITEM) X, Y, Z ... X = Y + Z ... END The USE statement allows program TOTALS access to both the type ITEM and the extended intrinsic operator + to perform calculations. 3 VIRTUAL See COMPATIBILITY_FEATURES in this Help file. 3 VOLATILE Prevents specified variables, arrays, and common blocks from being optimized during compilation. The VOLATILE attribute can be specified in a type declaration statement or VOLATILE statement, and takes one of the following forms: Type Declaration Statement: type, [att-ls,] VOLATILE [,attr-ls] :: obj [,obj]... Statement: VOLATILE obj [,obj]... type Is a data type specifier. attr-ls Is an optional list of attribute specifiers. obj Is the name of an object or a common block enclosed in slashes. A variable or COMMON block must be declared VOLATILE if it can be read or written in a way that is not visible to the compiler. For example: o If an operating system feature is used to place a variable in shared memory (so that it can be accessed by other programs), the variable must be declared VOLATILE. o If a variable is modified by a routine called by the operating system when an asynchronous event occurs, the variable must be declared VOLATILE. If an array is declared VOLATILE, each element in the array becomes volatile. If a common block is declared VOLATILE, each variable in the common block becomes volatile. If an object of derived type is declared VOLATILE, its components become volatile. If a pointer is declared VOLATILE, the pointer itself becomes volatile. A VOLATILE statement cannot specify the following: o A procedure o A function result o A namelist group The VOLATILE attribute is compatible with the ALLOCATABLE, AUTOMATIC, DIMENSION, INTENT, OPTIONAL, POINTER, PRIVATE, PUBLIC, SAVE, STATIC, and TARGET attributes. 3 WHERE Permits masked array assignment, which lets you perform an array operation on selected elements. This kind of assignment masks the evaluation of expressions and assignment of values in array assignment statements, according to the value of a logical array expression. WHERE can be specified as a construct or statement. Format: Statement form: WHERE (mask-expr1) assign-stmt Construct form: [name :] WHERE (mask-expr1) [where-body-stmt]... [ELSEWHERE (mask-expr2) [name] [where-body-stmt]...] [ELSEWHERE [name] [where-body-stmt]...] END WHERE [name] name Is the name of the WHERE construct. mask-expr1 Are logical array expressions (called mask-expr2 mask expressions). assign-stmt Is an assignment statement of the form: array variable = array expression where-body-stmt Is one of the following: o An "assign-stmt" o A WHERE statement or construct If a construct name is specified in a WHERE statement, the same name must appear in the corresponding END WHERE statement. The same construct name can optionally appear in any ELSEWHERE statement in the construct. (ELSEWHERE cannot specify a different name.) In each assignment statement, the mask expression, the variable being assigned to, and the expression on the right side, must all be conformable. Also, the assignment statement cannot be a defined assignment. Each mask expression in the WHERE construct must be conformable. Only the WHERE statement (or the first line of the WHERE construct) can be labeled as a branch target statement. The following is an example of a WHERE statement: INTEGER A, B, C DIMENSION A(5), B(5), C(5) DATA A /0,1,1,1,0/ DATA B /10,11,12,13,14/ C = -1 WHERE(A .NE. 0) C = B / A The resulting array C contains: -1,11,12,13, and -1. The assignment statement is only executed for those elements where the mask is true. Think of the mask expression in this example as being evaluated first into a logical array which has the value true for those elements where A is positive. This array of trues and falses is applied to the arrays A, B and C in the assignment statement. The right side is only evaluated for elements for which the mask is true; assignment on the left side is only performed for those elements for which the mask is true. The elements for which the mask is false do not get assigned a value. In a WHERE construct the mask expression is evaluated first and only once. Every assignment statement following the WHERE is executed as if it were a WHERE statement with "mask-expr1" and every assignment statement following the ELSEWHERE is executed as if it were a WHERE statement with ".NOT. mask-expr1". If ELSEWHERE specifies "mask-expr2", it is executed as "(.NOT. mask-expr1) .AND. mask-expr2". You should be careful if the statements have side effects, or modify each other or the mask expression. The following is an example of the WHERE construct: DIMENSION PRESSURE(1000), TEMP(1000), PRECIPITATION(1000) WHERE(PRESSURE .GE. 1.0) PRESSURE = PRESSURE + 1.0 TEMP = TEMP - 10.0 ELSEWHERE PRECIPITATION = .TRUE. ENDWHERE The mask is applied to the arguments of functions on the right side of the assignment if they are considered to be elemental functions. Only elemental intrinsics are considered elemental functions. Transformational intrinsics, inquiry intrinsics, and functions or operations defined in the subprogram are considered to be nonelemental functions. Consider the following example using LOG, an elemental function: WHERE(A .GT. 0) B = LOG(A) The mask is applied to A, and LOG is executed only for the positive values of A. The result of the LOG is assigned to those elements of B where the mask is true. Consider the following example using SUM, a nonelemental function: REAL A, B DIMENSION A(10,10), B(10) WHERE(B .GT. 0.0) B = SUM(A, DIM=1) Since SUM is nonelemental, it is evaluated fully for all of A. Then, the assignment only happens for those elements for which the mask evaluated to true. Consider the following example: REAL A, B, C DIMENSION A(10,10), B(10), C(10) WHERE(C .GT. 0.0) B = SUM(LOG(A), DIM=1)/C Because SUM is nonelemental, all of its arguments are evaluated fully regardless of whether they are elemental or not. In this example, LOG(A) is fully evaluated for all elements in A even though LOG is elemental. Notice that the mask is applied to the result of the SUM and to C to determine the right side. One way of thinking about this is that everything inside the argument list of a nonelemental function does not use the mask, everything outside does. 3 WRITE Transfers data from internal storage to user-specified external logical units (such as disks, printers, terminals, and pipes) or internal files. The meanings of the symbolic abbreviations used to represent the parameters in the WRITE statement syntax are as follows: extu Is the logical unit or internal file optionally or prefaced by UNIT=. UNIT= is required if unit is intu not the first element in the clist. fmt Specifies whether formatting is to be used for data editing, and if it is, the format specification or an asterisk (*) to indicate list-directed formatting. The "fmt" is optionally prefaced by FMT=, if "fmt" is the second parameter in the clist and the first parameter is a logical or internal unit specifier without the optional keyword UNIT=. nml Is the namelist group specification for namelist I/O. Optionally prefaced by NML=. NML= is required if namelist is not the second I/O specifier. rec Is the cell number of a record to be accessed directly. Optionally prefaced by REC= or by an apostrophe ('). iostat Is the name of a variable to contain the completion status of the I/O operation. Prefaced by IOSTAT=. err Is the label of a statement to which control is transferred in the event of an error. Prefaced by ERR=. end Is the label of a statement to which control is transferred in the event of an end of file. Prefaced by END=. adv Specifies advancing (ADVANCE='YES') or nonadvancing input (ADVANCE='NO'). The default is 'YES'. iolist Are the names of the variables, arrays, array elements, or character substrings from which or to which data will be transferred. Optionally an implied-DO list. The control-list parameters are "extu" (or "intu"), "fmt", "nml", "rec", "iostat", "err", "end", and "adv". The I/O list parameter is "iolist". 4 Sequential 5 Formatted Formatted sequential WRITE statement format: WRITE (extu,fmt [,adv][,err][,iostat]) [iolist] Writes to a specified external unit. Translates the data from binary to character format as specified by "fmt". 5 List-directed List-directed sequential WRITE statement format: WRITE (extu,*[,iostat][,err]) [iolist] Writes to a specified external unit. Translates the data from binary to character format according to the data types of the variables in the I/O list. 5 Namelist Namelist sequential WRITE statement format: WRITE (extu,nml[,iostat][,err]) Writes to a specified external unit. Translates the data from binary to character format according to the data types of the list entities in the corresponding NAMELIST statement. 5 Unformatted Unformatted sequential WRITE statement format: WRITE (extu[,iostat][,err]) [iolist] Writes to a specified external unit. Does not translate the data. 4 Direct 5 Formatted Formatted direct WRITE statement format: WRITE (extu,rec,fmt[,iostat][,err]) [iolist] Writes to a specified external unit. Translates the data from binary to character format as specified by "fmt". 5 Unformatted Unformatted direct WRITE statement format: WRITE (extu,rec[,iostat][,err]) [iolist] Writes to a specified external unit. Does not translate the data. 4 Internal Internal WRITE statement format: WRITE (intu[,fmt][,err][,iostat]) [iolist] Writes to a specified character variable. Translates the data from binary to character format as specified by "fmt". 4 Indexed 5 Formatted Formatted indexed WRITE statement format: WRITE (extu,fmt,[,err][,iostat]) [iolist] Writes to a specified external unit. Translates the data from binary to character format as specified by "fmt". 5 Unformatted Unformatted indexed WRITE statement format: WRITE (extu,[,err][,iostat]) [iolist] Writes to a specified external unit. Does not translate the data.