Programmer Guide > Format Strings > FORTRAN Formats for Data Import and Export
  

FORTRAN Formats for Data Import and Export
You can use FORTRAN format strings with any PV-WAVE function or procedure. FORTRAN format strings must be enclosed in parentheses, and the individual format specifiers must be separated by commas. This section discusses each of the format specifiers that can be used to produce a FORTRAN format string.
FORTRAN Format Specifiers
The following tables show the FORTRAN format specifiers that you can use in PV-WAVE.
FORTRAN Format Codes that Transfer Data shows data conversion characters, which specify the type of data that is being transferred.
 
Table A-1: FORTRAN Format Codes that Transfer Data  
Conversion Character
How the Data is Transferred
[n]A[w]
Transfers character data. n is a number specifying the number of times to repeat the conversion. If n is not specified, the conversion is performed once. w is a number specifying the number of characters to transfer. If w is not specified, all the characters are transferred.
[n]D[w.d]
Transfers double-precision floating-point data. n is a number specifying the number of times to repeat the conversion. w specifies the number of characters in the external field, and d specifies the number of decimal positions.
[n]E[w.d]
Transfers single-precision floating-point data using scientific (exponential) notation. The options are the same as for the D conversion character.
[n]F[w.d]
Transfers single-precision floating-point data. The options are the same as for the D conversion character.
[n]G[w.d]
Uses E or F conversion, depending on the magnitude of the value being processed. The options are the same as for the D conversion character.
[n]I[w] or [n]I[w.m]
Transfers integer data. n is a number specifying the number of times to repeat the conversion. w specifies the width of the field in characters. m specifies the minimum number of non-blank digits required.
[n]O[w] or [n]O[w.m]
Transfers octal data. The options are the same as for the I conversion character.
[n]Z[w] or [n]Z[w.m]
Transfers hexadecimal data. The options are the same as for the I conversion character.
Q
Obtains the number of characters in the input record to be transferred during a read operation. This conversion character is used for input only. In an output statement, the Q format code has no effect except that the corresponding I/O list element is skipped.
 
note
Characters in square brackets [ ] are optional.
Data Appearance Format Codes
FORTRAN Format Codes that Do Not Transfer Data shows specifiers that are used only to specify the appearance of data, such as the number of spaces between values in a file.
 
Table A-2: FORTRAN Format Codes that Do Not Transfer Data  
Specifier
Appearance of Transferred Data
:
The colon format code in a format string terminates format processing if no more items remain in the argument list. It has no effect if variables still remain on the list.
$
During input, the $ format code is ignored. During output, if a $ format code is placed anywhere in the format string, the newline implied by the closing parenthesis of the format string is suppressed.
quoted string
During input, quoted strings are ignored. During output, the contents of the string are written out.
nH
FORTRAN-style Hollerith string, where n is the number of characters. Hollerith strings are treated exactly like quoted strings.
nX
Skips n character positions.
Tn
Tab. Sets the absolute character position n in the current record.
TLn
Tab Left. Specifies that the next character to be transferred to or from the current record is the nth character to the left of the current position.
TRn
Tab Right. Specifies that the next character to be transferred to or from the current record is the nth character to the right of the current position.
 
note
For more information about the format codes shown in the previous two tables, refer to the detailed descriptions in the next section.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.