Interview Questions

Format Specification

A format specification provides explicit editing information to the processor on the structure of a formatted data record. It is used with formatted I/O statements to allow conversion and data editing under program control. An asterisk (*) used as a format identifier in an I/O statement specifies list-directed formatting.

A format specification may be defined in a FORMAT statement or through the use of arrays, variables, or expressions of type character. During input, field descriptors specify the external data fields and establish correspondence between a data field and an input list item. During output, field descriptors are used to describe how internal data is to be recorded on an external medium and to define a correspondence between an output list item and an external data field.

This section describes the FORMAT statement, field descriptors, edit descriptors, and list-directed formatting. It also contains a discussion of carriage-control characters for vertical control in printing formatted records.

As extensions to Fortran 77, the compiler supports additional processor-dependent capabilities, which are described in the Fortran 77 Programmer’s Guide.

Format specifications can be given in two ways: in FORMAT statements or as values of character arrays, character variables, and other character expressions.

Format Stored as a Character Entity

In a formatted input or output statement, the format identifier can be a character entity, provided its value has the syntax of a format specification, as detailed below, on execution. This capability allows a character format specification to be read in during program execution.

When the format identifier is a character array name, the format specification is a concatenation of all the elements in the array. When the format identifier is a character array element name, the format specification is only that element of the array. Therefore, format specifications read through a character array name can fill the whole array, while those read through a character array element name must fit in a single element of that array.


Pragna Meter
Next Chapter  
e-University Search
Related Jobs