HP OpenVMS Systems Documentation
HP Fortran for OpenVMS
The /SYNTAX_ONLY qualifier requests that source file be 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 with /WARNINGS=UNINITIALIZED). This qualifier allows you to do a quick syntax check of your source file, and is especially useful in conjunction with /WARNINGS=ARGUMENT_CHECKING.
The /VERSION qualifier can be used alone on the FORTRAN command line to display the HP Fortran version number. If you specify /VERSION, compilation does not occur.
$ FORTRAN /VERSION HP Fortran V8.n-nnn-nnnn $
The /TIE qualifier enables compiled code to be 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, and follow the guidelines provided in Section B.6.
On appropriate LINK command qualifiers, see Section 3.2.1 and
2.3.50 /VMS --- Request Compaq Fortran 77 for OpenVMS VAX Compatibility
This qualifier is the default.
The /VMS qualifier specifies the following aspects of the run-time system:
Note that the /VMS qualifier allows use of /LIST or /NOLIST in INCLUDE statement specifications. (Also see /ASSUME=SOURCE_INCLUDE to control included directory.)
To override the effects of the /VMS qualifier, specify /NOVMS.
On the OPEN statement, see the HP Fortran for OpenVMS Language Reference Manual.
2.3.51 /WARNINGS --- Warning Messages and Compiler Checking
The following /WARNINGS keywords prevent the display of warning messages:
NOALIGNMENT (default is ALIGNMENT)
NOGENERAL (default is GENERAL)
NOGRANULARITY (default is GRANULARITY)
NOUNCALLED (default is UNCALLED)
NOUNINITIALIZED (default is UNINITIALIZED)
NOUSAGE (default is USAGE)
The following /WARNINGS keywords can display additional warning messages (request additional checking):
ARGUMENT_CHECKING (default is NOARGUMENT_CHECKING)
DECLARATIONS (default is NODECLARATIONS)
IGNORE_LOC (default is NOIGNORE_LOC)
TRUNCATED_SOURCE (default is NOTRUNCATED_SOURCE)
UNUSED (default is NOUNUSED)
If you omit /WARNINGS, the defaults are:
/WARNINGS=(ALIGNMENTS,NOARGUMENT_CHECKING, NODECLARATIONS, NOERRORS,FILEOPTS,GENERAL,GRANULARITY, NOIGNORE_LOC,NOSTDERRORS,NOTRUNCATED_SOURCE,UNCALLED, UNINITIALIZED, NOUNUSED,USAGE)
The qualifier has the following form:
[NO]ALIGNMENTControls 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 ALIGNMENT. To suppress diagnostic messages about unaligned data, specify NOALIGNMENT.
To control the alignment of fields in common blocks, derived types, and record structures, use the /ALIGNMENT qualifier (see Section 2.3.3).
[NO]ARGUMENT_CHECKINGControls whether the compiler issues diagnostic messages for argument mismatches between caller and callee (when compiled together). The default is /WARNINGS=NOARGUMENT_CHECKING.
[NO]DECLARATIONSControls 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 NODECLARATIONS.
[NO]GENERALControls whether the compiler issues I-level and W-level diagnostic messages. An I-level message indicates that a correct HP 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 GENERAL.
[NO]GRANULARITYControls whether the compiler issues the compiler diagnostic message "Unable to generate code for requested granularity" to indicate when data access might not occur safely from different threads in a shared memory system (such as asynchronous write access from outside the user process). The default is /WARNINGS=GRANULARITY.
For more information on data granularity and controlling the size of data that can be safely accessed from different threads, see Section 2.3.23.
[NO]IGNORE_LOCRequests that the compiler issue warnings when %LOC is stripped from an argument due to specification of the IGNORE_LOC attribute. The default is /WARNINGS=NOIGNORE_LOC (does not issue a warning for this condition).
[NO]TRUNCATED_SOURCEControls 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 whether /EXTEND_SOURCE qualifier was specified (or its OPTIONS statement qualifier).
This option has no effect on truncation; lines that exceed the maximum column width are always truncated.
The default is /WARNINGS=NOTRUNCATED_SOURCE.
[NO]UNCALLEDSuppresses the compiler warning diagnostic message when a statement function is never called. The default is /WARNINGS=UNCALLED.
[NO]UNINITIALIZEDControls whether warning messages are issued when a variable is referenced before a value was assigned to it. Specify NOUNINITIALIZED to suppress such warning messages.
The default, /WARNINGS=UNINITIALIZED, issues warning messages when a variable is referenced before a value was assigned to it.
[NO]UNUSEDRequests warning messages for a variable that is declared but never used. The default is /WARNINGS=NOUNUSED.
[NO]USAGESpecifying /WARNINGS=NOUSAGE suppresses informational messages about questionable programming practices and the use of intrinsic functions that use only two digits to represent years (such as 2000). The compiler allows such programming practices, although they are often an artifact of programming errors. For example, a continued character or Hollerith literal whose first part ends before the statement field and appears to end with trailing spaces.
The default is USAGE.
ALLCauses the compiler to print all I-level and W-level diagnostic messages, including warning messages for any unaligned data and untyped data items. Specifying ALL is equivalent to /WARNINGS and has the effect of specifying /WARNINGS=(ALIGNMENT, DECLARATIONS, GENERAL, UNCALLED, UNINITIALIZED).
NONESuppresses all I-level and W-level messages. Specifying /NOWARNINGS is equivalent to /WARNINGS=NONE.
A text library contains library modules of source text. To include a library module from a text library in a program, use an INCLUDE statement.
Library modules in text libraries can contain any kind of text; this section only discusses their use when HP Fortran language source is used.
You should be aware of the difference between library modules that reside in text libraries and the HP Fortran post-compiled module files (.F90$MOD file type) that support use association (see Section 2.2.3).
Use the LIBRARY command (OpenVMS Librarian Utility) to create text libraries and insert, replace, delete, copy, or list library modules in text libraries. Text libraries have a default file type of TLB.
Figure 2-2 shows the creation of a text library and its use in compiling HP Fortran programs.
Figure 2-2 Creating and Using a Text Library
Table 2-3 summarizes the commands that create libraries and provide maintenance functions. For a complete list of the qualifiers for the LIBRARY command and a description of other DIGITAL Command Language (DCL) commands listed in Table 2-3, see the Guide to Using VMS Command Procedures or enter HELP LIBRARY.
|Create a library.||LIBRARY/TEXT/CREATE library-name file-spec,...|
|Add one or more library modules to a library.||LIBRARY/TEXT/INSERT library-name file-spec,...|
|Replace one or more library modules in a library.||LIBRARY/TEXT/REPLACE library-name file-spec,... 2|
|Specify the names of library modules to be added to a library.||
|Delete one or more library modules from a library.||LIBRARY/TEXT/DELETE=( module-name,...) library-name|
|Copy a library module from a library into another file.||
|List the library modules in a library.||LIBRARY/TEXT/LIST= file-spec library-name|
When the LIBRARY command adds a library module to a library, by default it uses the file name of the input file as the name of the library module. In the example in Figure 2-2, the LIBRARY command adds the contents of the files APPLIC.SYM and DECLARE.FOR to the library and names the library modules APPLIC and DECLARE.
Alternatively, you can name a module in a library with the /MODULE qualifier. For example:
$ LIBRARY/TEXT/INSERT FORFILES DECLARE.FOR /MODULE=EXTERNAL_DECLARATIONS
The preceding command inserts the contents of the file DECLARE.FOR into the library FORFILES under the name EXTERNAL_DECLARATIONS. This library module can be included in an HP Fortran source file during compilation with the following statement:
CDD/Repository is an optional software product available under a separate license. The CDD/Repository product allows you to maintain shareable data definitions (language-independent structure declarations) that are defined by a data or repository administrator.
CDD/Repository supports both the Common Data Dictionary (Version 3) and CDD/Plus (Version 4) interfaces. Older dictionary versions need to be converted to repository (CDD/Repository) format using a supplied conversion utility. For detailed information about CDD/Repository, see the CDD/Repository documentation.
CDD/Repository data definitions are organized hierarchically in much the same way that files are organized in directories and subdirectories. For example, a repository for defining personnel data might have separate directories for each employee type.
Descriptions of data definitions are entered into the dictionary in a special-purpose language called CDO (Common Dictionary Operator, which replaces the older interface called CDDL, Common Data Dictionary Language). CDD/Repository converts the data descriptions to an internal form---making them independent of the language used to access them---and inserts them into the repository.
During the compilation of an HP Fortran program, CDD/Repository data definitions can be accessed by means of DICTIONARY statements. If the data attributes of the data definitions are consistent with HP Fortran requirements, the data definitions are included in the HP Fortran program. CDD/Repository data definitions, in the form of HP Fortran source code, appear in source program listings if you specify the /SHOW=DICTIONARY qualifier on the FORTRAN command line or the /LIST qualifier in the DICTIONARY statement.
The advantage in using CDD/Repository instead of HP Fortran source for structure declarations is that CDD/Repository record declarations are language-independent and can be used with several supported OpenVMS languages.
The following examples demonstrate how data definitions are written for CDD/Repository. The first example is a structure declaration written in CDDL. The second example shows the same structure as it would appear in a FORTRAN output listing.
define field name datatype is text size is 30. define field address datatype is text size is 40. define field salesman-id datatype is longword unsigned size is 4. define record payroll-record name. address. salesman-id. end record.
HP Fortran Source Code Representation:
STRUCTURE /PAYROLL_RECORD/ STRUCTURE SALESMAN CHARACTER*30 NAME CHARACTER*40 ADDRESS STRUCTURE SALESMAN_ID BYTE %FILL(4) END STRUCTURE END STRUCTURE END STRUCTURE
A repository or data administrator uses CDO to create repositories, define directory structures, and insert record and field definitions into the repository. Many repositories can be linked together to form one logical repository. If the paths are set up correctly, users can access definitions as if they were in a single repository regardless of physical location.
CDO also creates the record paths. Once established, records can be extracted from the repository by means of DICTIONARY statements in HP Fortran programs. At compile time, the record definition and its attributes are extracted from the designated repository. Then the compiler converts the extracted record definition into an HP Fortran structure declaration and includes it in the object module.
The DICTIONARY statement incorporates CDD/Repository data definitions into the current HP Fortran source file during compilation. The DICTIONARY statement can occur anywhere in an HP Fortran source file that a specification statement (such as a STRUCTURE...END STRUCTURE block) is allowed. The format of the DICTIONARY statement is described in the HP Fortran for OpenVMS Language Reference Manual.
A DICTIONARY statement must appear as a statement by itself; it cannot be used within an HP Fortran structure declaration. For example, consider the following DICTIONARY statement:
INTEGER*4 PRICE DICTIONARY 'ACCOUNTS'
This would result in a declaration of the following form:
INTEGER*4 PRICE STRUCTURE /ACCOUNTS/ STRUCTURE NUMBER CHARACTER*3 LEDGER CHARACTER*5 SUBACCOUNT END STRUCTURE CHARACTER*12 DATE . . . END STRUCTURE
When you extract a record definition from the repository, you can choose to include this translated record in the program's listing by using the /LIST qualifier in the DICTIONARY statement or the /SHOW=DICTIONARY qualifier in the FORTRAN command line.
CDD/Repository data definitions can contain explanatory text in the DESCRIPTION IS clause. If you specify /SHOW=DICTIONARY on the FORTRAN command (or /LIST in the DICTIONARY statement), this text is included in the HP Fortran output listing as comments.
Because the DICTIONARY statement generally contains only structure
declaration blocks, you will usually also need to include one or more
RECORD statements in your program to make use of these structures. (See
the HP Fortran for OpenVMS Language Reference Manual for information about structure declaration blocks or
the RECORD statement.)
2.5.2 HP Fortran and CDD/Repository Data Types
The CDD/Repository supports some data types that are not native to HP Fortran. If a data definition contains a field declared with an unsupported data type, HP Fortran replaces the field with one declared as an inner STRUCTURE containing a single unnamed field (%FILL field) that is a BYTE array with an appropriate dimension. The HP Fortran compiler does not attempt to approximate a data type that it does not support.
For example, CDD/Repository's data type UNSIGNED LONG is not supported by HP Fortran. As a result, if the field FIELD1 is declared to be UNSIGNED LONG using CDO, HP Fortran replaces the definition of FIELD1 with the following declaration:
STRUCTURE FIELD1 BYTE %FILL(4) END STRUCTURE
HP Fortran does not declare it as INTEGER*4, which results in signed operations if the field was used in an arithmetic expression.
Table 2-4 summarizes the CDO data types and corresponding HP Fortran data types.
|CDO Data Type||HP Fortran Data Type|
|DATE||STRUCTURE (length 8)|
|DATE AND TIME||STRUCTURE (length n)|
|BIT m ALIGNED||STRUCTURE (length n+7/8)|
|BIT m||STRUCTURE (length n+7/8)|
|UNSPECIFIED||STRUCTURE (length n)|
|VARYING TEXT||STRUCTURE (length n)|
|VARYING STRING||STRUCTURE (length n)|
|D_FLOATING||REAL*8 (/FLOAT=D_FLOAT only)|
|D_FLOATING COMPLEX||COMPLEX*16 (/FLOAT=D_FLOAT only)|
|F_FLOATING||REAL*4 (/FLOAT=D_FLOAT or /FLOAT=G_FLOAT)|
|F_FLOATING COMPLEX||COMPLEX*8 (/FLOAT=D_FLOAT or /FLOAT=G_FLOAT)|
|G_FLOATING||REAL*8 (/FLOAT=G_FLOAT only)|
|G_FLOATING COMPLEX||COMPLEX*16 (/FLOAT=G_FLOAT only)|
|H_FLOATING||STRUCTURE (length 16)|
|H_FLOATING COMPLEX||STRUCTURE (length 32)|
|UNSIGNED BYTE||STRUCTURE (length 1)|
|UNSIGNED WORD||STRUCTURE (length 2)|
|UNSIGNED LONGWORD||STRUCTURE (length 4)|
|SIGNED QUADWORD||STRUCTURE (length 8)|
|UNSIGNED QUADWORD||STRUCTURE (length 8)|
|SIGNED OCTAWORD||STRUCTURE (length 16)|
|UNSIGNED OCTAWORD||STRUCTURE (length 16)|
|PACKED NUMERIC||STRUCTURE (length n)|
|SIGNED NUMERIC||STRUCTURE (length n)|
|UNSIGNED NUMERIC||STRUCTURE (length n)|
|LEFT OVERPUNCHED||STRUCTURE (length n)|
|LEFT SEPARATE||STRUCTURE (length n)|
|RIGHT OVERPUNCHED||STRUCTURE (length n)|
|RIGHT SEPARATE||STRUCTURE (length n)|
D_floating and G_floating data types cannot be mixed in one subroutine because both types cannot be handled simultaneously. You can use both types, each in a separate subroutine, depending on the OPTIONS statement qualifier in effect for the individual subroutine. For a discussion of the handling of REAL*8 data types in HP Fortran, see the HP Fortran for OpenVMS Language Reference Manual.