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 90 Programmer's Reference: HP Fortran 90 Programmer's Reference > Chapter 10 HP Fortran 90 statements

FORMAT

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

Describes how I/O data is to be formatted.

Syntax

label FORMAT (format-list)
label

is a statement label.

format-list

is a comma-separated list of format items, where each item in the list can be either one of the edit descriptors described in Table 9-1 “Edit descriptors” or (format-list). If format-list is a list item, it may be optionally preceded by a repeat specification—a positive integer that specifies how may times format-list is to be repeated.

Description

The FORMAT statement holds the format specification that indicates how data in formatted I/O is to be translated between internal (binary) representation and formatted (ASCII) representation. The translation makes it possible to represent data in a humanly readable format.

Although a format specification can be embedded within a data transfer statement, the point to using a FORMAT statement is to make it available to any number of data transfer statements. Several data transfer statements can use the same format specification contained in a FORMAT statement by referencing label.

Another advantage of the FORMAT statement over the use of embedded format specifications is that it is "pre-compiled", reducing the runtime overhead of processing the format specification and providing compile-time error checking of the FMT= specifier.

Examples

   PROGRAM format_example
WRITE (15,FMT=20) 1234, 45, -12
20 FORMAT (I6, 2I4)
END PROGRAM format_example

When compiled and executed, this program outputs the following (where b represents the blank character):

bb1234bb45b-12

Related statements

READ and WRITE

Related concepts

For information about I/O formatting, see Chapter 9 “I/O formatting”.

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