Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

PRINT

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Writes to standard output.

Syntax

The syntax of the PRINT statement can take one of two forms:

  • Formatted and list-directed syntax:

    PRINT format [, output-list ]
  • Namelist-directed syntax:

    PRINT name
format

is one of the following:

  • An asterisk (*), specifying list-directed I/O.

  • The label of a FORMAT statement containing the format specification.

  • An integer variable that has been assigned the label of a FORMAT statement.

  • An embedded format specification.

name

is the name of a namelist group, as previously defined by a NAMELIST statement . Using the namelist-directed syntax, the PRINT statement sends data in the namelist group to standard output. To direct output to a connected file, you must use the WRITE statement and include the NML= specifier.

output-list

is a comma-separated list of data items for output. The data items can include expressions and implied-DO lists.

Description

The PRINT statement transfers data from memory to standard output. (Unit 6 is preconnected to the HP-UX standard output.) The PRINT statement can be used to perform formatted, list-directed, and namelist-directed I/O only.

To direct output to a connected file, use the WRITE statement.

Examples

The examples in this section illustrate different uses of the PRINT statement.

Formatted output

The following statement writes the contents of the variables num and des to standard output, using the format specification in the FORMAT statement at label 10:

PRINT 10, num, des

List-directed output

The following statement uses list-directed formatting to print the literal string x= and the value of the variable x:

PRINT *, 'x=', x

Embedded format specification

The following statement uses an embedded format specification to print the same output:

PRINT '(A2, F8.2)', 'x=', x

Namelist-directed output

The following statement prints all variables in the namelist group coord, using namelist-directed formatting:

PRINT coord

Related statements

FORMAT and WRITE

Related concepts

For related information, see the following:

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.