HP OpenVMS Systems Documentation 
HP Fortran for OpenVMS

Previous  Contents  Index 
Integer editing is controlled by the I (decimal), B (binary), O (octal), and Z (hexadecimal) data edit descriptors.
The I edit descriptor transfers decimal integer values. It takes the following form:

The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item must be of type integer or logical.
The G edit descriptor can be used to edit integer data; it follows the same rules as Iw.
On input, the I data edit descriptor transfers w characters from an external field and assigns their integer value to the corresponding I/O list item. The external field data must be an integer constant.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the I edit descriptor:
Format  Input  Value 

I4  2788  2788 
I3   26   26 
I9  312  312 
On output, the I data edit descriptor transfers the value of the corresponding I/O list item, rightjustified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by a sign (a plus sign is optional for positive values, a minus sign is required for negative values), followed by an unsigned integer constant with no leading zeros.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the I edit descriptor:
Format  Value  Output 

I3  284  284 
I4   284   284 
I4  0  0 
I5  174  174 
I2  3244  ** 
I3   473  *** 
I7  29.812  An error; the decimal point is invalid 
I4.0  0   
I4.2  1  01 
I4.4  1  0001 
The B data edit descriptor transfers binary (base 2) values. It takes the following form:

The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
On input, the B data edit descriptor transfers w characters from an external field and assigns their binary value to the corresponding I/O list item. The external field must contain only binary digits (0 or 1) or blanks.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the B edit descriptor:
Format  Input  Value 

B4  1001  9 
B1  1  1 
B2  0  0 
On output, the B data edit descriptor transfers the binary value of the corresponding I/O list item, rightjustified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by an unsigned integer constant (consisting of binary digits) with no leading zeros. A negative value is transferred in internal form.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the B edit descriptor:
Format  Value  Output 

B4  9  1001 
B2  0  0 
The O data edit descriptor transfers octal (base 8) values. It takes the following form:

The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
On input, the O data edit descriptor transfers w characters from an external field and assigns their octal value to the corresponding I/O list item. The external field must contain only octal digits (0 through 7) or blanks.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the O edit descriptor:
Format  Input  Value 

O5  32767  32767 
O4  16234  1623 
O3  97  An error; the 9 is invalid in octal notation 
On output, the O data edit descriptor transfers the octal value of the corresponding I/O list item, rightjustified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by an unsigned integer constant (consisting of octal digits) with no leading zeros. A negative value is transferred in internal form without a leading minus sign.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the O edit descriptor:
Format  Value  Output 

O6  32767  77777 
O12  32767  37777700001 
O2  14261  ** 
O4  27  33 
O5  10.5  41050 
O4.2  7  07 
O4.4  7  0007 
The Z data edit descriptor transfers hexadecimal (base 16) values. It takes the following form:

The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
On input, the Z data edit descriptor transfers w characters from an external field and assigns their hexadecimal value to the corresponding I/O list item. The external field must contain only hexadecimal digits (0 though 9 and A (a) through F(f)) or blanks.
If the value exceeds the range of the corresponding input list item, an error occurs.
The following shows input using the Z edit descriptor:
Format  Input  Value 

Z3  A94  A94 
Z5  A23DEF  A23DE 
Z5  95.AF2  An error; the decimal point is invalid 
On output, the Z data edit descriptor transfers the hexadecimal value of the corresponding I/O list item, rightjustified, to an external field that is w characters long.
The field consists of zero or more blanks, followed by an unsigned integer constant (consisting of hexadecimal digits) with no leading zeros. A negative value is transferred in internal form without a leading minus sign.
If m is specified, the unsigned integer constant must have at least m digits. If necessary, it is padded with leading zeros.
If m is zero, and the output list item has the value zero, the external field is filled with blanks.
The following shows output using the Z edit descriptor:
Format  Value  Output 

Z4  32767  7FFF 
Z9   32767  FFFF8001 
Z2  16  10 
Z4   10.5  **** 
Z3.3  2708  A94 
Z6.4  2708  0A94 
Real and complex editing is controlled by the F, E, D, EN, ES, and G data edit descriptors.
If no field width (w) is specified for a real data edit descriptor, the system supplies default values.
Real data edit descriptors can be affected by specified scale factors.
Do not use the real data edit descriptors when attempting to parse textual input. These descriptors accept some forms that are purely textual as valid numeric input values. For example, input values T and F are treated as values 1.0 and 0.0, respectively, for .TRUE. and .FALSE.. 
The F data edit descriptor transfers real values. It takes the following form:

The value of d (the number of places after the decimal point) must not exceed the value of w (the field width).
The specified I/O list item must be of type real, or it must be the real or imaginary part of a complex type.
On input, the F data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The external field data must be an integer or real constant.
If the input field contains only an exponent letter or decimal point, it is treated as a zero value.
If the input field does not contain a decimal point or an exponent, it is treated as a real number of w digits, with d digits to the right of the decimal point. (Leading zeros are added, if necessary.)
If the input field contains a decimal point, the location of that decimal point overrides the location specified by the F descriptor.
If the field contains an exponent, that exponent is used to establish the magnitude of the value before it is assigned to the list element.
The following shows input using the F edit descriptor:
Format  Input  Value 

F8.5  123456789  123.45678 
F8.5   1234.567   1234.56 
F8.5  24.77E+2  2477.0 
F5.2  1234567.89  123.45 
On output, the F data edit descriptor transfers the real value of the corresponding I/O list item, rightjustified and rounded to d decimal positions, to an external field that is w characters long.
The w must be greater than or equal to d+3 to allow for the following:
The following shows output using the F edit descriptor:
Format  Value  Output 

F8.5  2.3547188  2.35472 
F9.3  8789.7361  8789.736 
F2.1  51.44  ** 
F10.4   23.24352  23.2435 
F5.2  325.013  ****** 
F5.2   .2   0.20 
The E and D data edit descriptors transfer real values in exponential form. They take the following form:

For the E edit descriptor, the value of d (the number of places after the decimal point) plus e (the number of digits in the exponent) must not exceed the value of w (the field width).
For the D edit descriptor, the value of d must not exceed the value of w.
The specified I/O list item must be of type real, or it must be the real or imaginary part of a complex type.
On input, the E and D data edit descriptors transfer w characters from an external field and assigns their real value to the corresponding I/O list item. The E and D descriptors interpret and assign input data in the same way as the F data edit descriptor (see Section 11.3.4.1).
The following shows input using the E and D edit descriptors:
Format  Input  Value 

E9.3  734.432E3  734432.0 
E12.4  1022.43E  6  1022.43E  6 
E15.3  52.3759663  52.3759663 
E12.5  210.5271D+10 ^{1}  210.5271E10 
BZ,D10.2  12345  12345000.0D0 
D10.2  123.45  123.45D0 
D15.3  367.4981763D+04  3.674981763D+06 
On output, the E and D data edit descriptors transfer the real value of the corresponding I/O list item, rightjustified and rounded to d decimal positions, to an external field that is w characters long.
The w should be greater than or equal to d+7 to allow for the following:
The exponent takes one of the following forms:
Edit Descriptor 
Absolute Value of Exponent 
Positive Form of Exponent 
Negative Form of Exponent 

Ew.d  exp <= 99  E+nn  Enn 
99 < exp <= 999  +nnn  nnn  
Ew.dEe  exp <= 10 ^{e}  1  E+n _{1}n _{2}...n _{e}  En _{1}n _{2}...n _{e} 
Dw.d  exp <= 99  D+nn or E+nn  Dnn or Enn 
99 < exp <= 999  +nnn  nnn 
If the exponent value is too large to be converted into one of these forms, an error occurs.
The exponent field width (e) is optional for the E edit descriptor; if omitted, the default value is 2. If e is specified, the w should be greater than or equal to d+e+5.
The w can be as small as d+5 or d+e+3, if the optional fields for the sign and the zero are omitted. 
The following shows output using the E and D edit descriptors:
Format  Value  Output 

E11.2  475867.222  0.48E+06 
E11.5  475867.222  0.47587E+06 
E12.3  0.00069  0.690E  03 
E10.3   0.5555   0.556E+00 
E5.3  56.12  ***** 
E14.5E4   1.001   0.10010E+0001 
E13.3E6  0.000123  0.123E000003 
D14.3  0.0363  0.363D  01 
D23.12  5413.87625793  0.541387625793D+04 
D9.6  1.2  ********* 
Previous  Next  Contents  Index 