[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP Fortran for OpenVMS
Language Reference Manual


Previous Contents Index

11.3.4.3 EN Editing

The EN data edit descriptor transfers values by using engineering notation. It takes the following form:


  • ENw.d[Ee]

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).

The specified I/O list item must be of type real, or it must be the real or imaginary part of a complex type.

Rules for Input Processing

On input, the EN data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The EN descriptor interprets and assigns input data in the same way as the F data edit descriptor (see Section 11.3.4.1).

The following shows input using the EN edit descriptor:

Format Input Value
EN11.3 --5.321E+00 5.32100
EN11.3 --600.00E - 03 - .60000
EN12.3 ---3.150E - 03 .00315
EN12.3 ---3.829E+03 3829.0

Rules for Output Processing

On output, the EN data edit descriptor transfers the real value of the corresponding I/O list item, right-justified and rounded to d decimal positions, to an external field that is w characters long. The real value is output in engineering notation, where the decimal exponent is divisible by 3 and the absolute value of the significand is greater than or equal to 1 and less than 1000 (unless the output value is zero).

The w should be greater than or equal to d+9 to allow for the following:

  • A sign (optional if the value is positive and descriptor SP is not in effect)
  • One to three digits to the left of the decimal point
  • The decimal point
  • The d digits to the right of the decimal point
  • The exponent

The exponent takes one of the following forms:

Edit
Descriptor
Absolute Value
of Exponent
Positive Form
of Exponent
Negative Form
of Exponent
ENw.d |exp| <= 99 E+nn E--nn
  99 < |exp| <= 999 +nnn --nnn
ENw.dEe |exp| <= 10 e - 1 E+n 1n 2...n e E--n 1n 2...n e

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; if omitted, the default value is 2. If e is specified, the w should be greater than or equal to d+e+5.

The following shows output using the EN edit descriptor:

Format Value Output
EN11.2 475867.222 -475.87E+03
EN11.5 475867.222 ***********
EN12.3 0.00069 -690.000E-06
EN10.3 - 0.5555 **********
EN11.2 0.0 -000.00E-03

For More Information:

11.3.4.4 ES Editing

The ES data edit descriptor transfers values by using scientific notation. It takes the following form:


  • ESw.d[Ee]

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).

The specified I/O list item must be of type real, or it must be the real or imaginary part of a complex type.

Rules for Input Processing

On input, the ES data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The ES descriptor interprets and assigns input data in the same way as the F data edit descriptor (see Section 11.3.4.1).

The following shows input using the ES edit descriptor:

Format Input Value
ES11.3 --5.321E+00 5.32100
ES11.3 - 6.000E-01 - .60000
ES12.3 ---3.150E - 03 .00315
ES12.3 ---3.829E+03 3829.0

Rules for Output Processing

On output, the ES data edit descriptor transfers the real value of the corresponding I/O list item, right-justified and rounded to d decimal positions, to an external field that is w characters long. The real value is output in scientific notation, where the absolute value of the significand is greater than or equal to 1 and less than 10 (unless the output value is zero).

The w should be greater than or equal to d+7 to allow for the following:

  • A sign (optional if the value is positive and descriptor SP is not in effect)
  • One digit to the left of the decimal point
  • The decimal point
  • The d digits to the right of the decimal point
  • The exponent

The exponent takes one of the following forms:

Edit
Descriptor
Absolute Value
of Exponent
Positive Form
of Exponent
Negative Form
of Exponent
ESw.d |exp| <= 99 E+nn E--nn
  99 < |exp| <= 999 +nnn --nnn
ESw.dEe |exp| <= 10 e - 1 E+n 1n 2...n e E--n 1n 2...n e

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; if omitted, the default value is 2. If e is specified, the w should be greater than or equal to d+e+5.

The following shows output using the ES edit descriptor:

Format Value Output
ES11.2 473214.356 ---4.73E+05
ES11.5 473214.356 4.73214E+05
ES12.3 0.00069 ---6.900E-04
ES10.3 - .5555 - 5.555E-01
ES11.2 0.0 -0.000E+00

For More Information:

11.3.4.5 G Editing

The G data edit descriptor generally transfers values of real type, but it can be used to transfer values of any intrinsic type. It takes the following form:


  • Gw.d[Ee]

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).

The specified I/O list item can be of any intrinsic type.

When used to specify I/O for integer, logical, or character data, the edit descriptor follows the same rules as Iw, Lw, and Aw, respectively, and d and e have no effect.

Rules for Real Input Processing

On input, the G data edit descriptor transfers w characters from an external field and assigns their real value to the corresponding I/O list item. The G descriptor interprets and assigns input data in the same way as the F data edit descriptor (see Section 11.3.4.1).

Rules for Real Output Processing

On output, the G data edit descriptor transfers the real value of the corresponding I/O list item, right-justified and rounded to d decimal positions, to an external field that is w characters long.

The form in which the value is written is a function of the magnitude of the value, as described in Table 11-2.

Table 11-2 Effect of Data Magnitude on G Format Conversions
Data Magnitude Equivalent Conversion
0 < m < 0.1 - 0.5 x 10 -d-1 Ew.d[Ee]
m = 0 F(w - n).(d - 1), n( ' b ' )
0.1 - 0.5 x 10 -d-1 <= m < 1 - 0.5 x 10 -d F(w - n).d, n( ' b ' )
1 - 0.5 x 10 -d <= m < 10 - 0.5 x 10 -d+1 F(w - n).(d - 1), n( ' b ' )
10 - 0.5 x 10 -d+1 <= m < 100 - 0.5 x 10 -d+2 F(w - n).(d - 2), n( ' b ' )
. .
. .
. .
10 d-2 - 0.5 x 10 -2 <= m < 10 d-1 - 0.5 x 10 -1 F(w - n).1, n( ' b ' )
10 d-1 - 0.5 x 10 -1 <= m < 10 d - 0.5 F(w - n).0, n( ' b ' )
m => 10 d - 0.5 Ew.d[Ee]

The ' b ' is a blank following the numeric data representation. For Gw.d, n( ' b ' ) is 4 blanks. For Gw.dEe, n( ' b ' ) is e+2 blanks.

The w should be greater than or equal to d+7 to allow for the following:

  • A sign (optional if the value is positive and descriptor SP is not in effect)
  • One digit to the left of the decimal point
  • The decimal point
  • The d digits to the right of the decimal point
  • The 4-digit or e+2-digit exponent

If e is specified, the w should be greater than or equal to d+e+5.

The following shows output using the G edit descriptor and compares it to output using equivalent F editing:

Value Format Output with G Format Output with F
0.01234567 G13.6 -0.123457E - 01 F13.6 -----0.012346
- 0.12345678 G13.6 - 0.123457---- F13.6 ---- - 0.123457
1.23456789 G13.6 --1.23457---- F13.6 -----1.234568
12.34567890 G13.6 --12.3457---- F13.6 ----12.345679
123.45678901 G13.6 --123.457---- F13.6 ---123.456789
- 1234.56789012 G13.6 - - 1234.57---- F13.6 - - 1234.567890
12345.67890123 G13.6 --12345.7---- F13.6 -12345.678901
123456.78901234 G13.6 --123457.---- F13.6 123456.789012
- 1234567.89012345 G13.6 - 0.123457E+07 F13.6 *************

For More Information:

11.3.4.6 Complex Editing

A complex value is an ordered pair of real values. Complex editing is specified by a pair of real edit descriptors, using any combination of the forms: Fw.d, Ew.d[Ee], Dw.d, ENw.d[Ee], ESw.d[Ee], or Gw.d[Ee].

Rules for Input Processing

On input, the two successive fields are read and assigned to the corresponding complex I/O list item as its real and imaginary part, respectively.

The following shows input using complex editing:

Format Input Value
F8.5,F8.5 1234567812345.67 123.45678, 12345.67
E9.1,F9.3 734.432E8123456789 734.432E8, 123456.789

Rules for Output Processing

On output, the two parts of the complex value are transferred under the control of repeated or successive real edit descriptors. The two parts are transferred consecutively without punctuation or blanks, unless control or character string edit descriptors are specified between the pair of real edit descriptors.

The following shows output using complex editing:

Format Value Output
2F8.5 2.3547188, 3.456732 -2.35472 -3.45673
E9.2, ' -,- ' ,E5.3 47587.222, 56.123 -0.48E+06-,-*****

For More Information:

11.3.5 Logical Editing (L)

The L data edit descriptor transfers logical values. It takes the following form:


  • Lw

The specified I/O list item must be of type logical or integer.

The G edit descriptor can be used to edit logical data; it follows the same rules as Lw.

Rules for Input Processing

On input, the L data edit descriptor transfers w characters from an external field and assigns their logical value to the corresponding I/O list item. The value assigned depends on the external field data, as follows:

  • .TRUE. is assigned if the first nonblank character is .T, T, .t, or t. The logical constant .TRUE. is an acceptable input form.
  • .FALSE. is assigned if the first nonblank character is .F, F. .f, or f, or the entire field is filled with blanks. The logical constant .FALSE. is an acceptable input form.

If an other value appears in the external field, an error occurs.

Rules for Output Processing

On output, the L data edit descriptor transfers the following to an external field that is w characters long: w - 1 blanks, followed by a T or F (if the value is .TRUE. or .FALSE., respectively).

The following shows output using the L edit descriptor:

Format Value Output
L5 .TRUE. ----T
L1 .FALSE. F

For More Information:

On the general form for data edit descriptors, see Section 11.3.1.

11.3.6 Character Editing (A)

The A data edit descriptor transfers character or Hollerith values. It takes the following form:


  • A[w]

If the corresponding I/O list item is of type character, character data is transferred. If the list item is of any other type, Hollerith data is transferred.

The G edit descriptor can be used to edit character data; it follows the same rules as Aw.

Rules for Input Processing

On input, the A data edit descriptor transfers w characters from an external field and assigns them to the corresponding I/O list item.

The maximum number of characters that can be stored depends on the size of the I/O list item, as follows:

  • For character data, the maximum size is the length of the corresponding I/O list item.
  • For noncharacter data, the maximum size depends on the data type, as shown in Table 11-3.

Table 11-3 Size Limits for Noncharacter Data Using A Editing
I/O List Element Maximum Number of Characters
BYTE 1
LOGICAL(1) or LOGICAL*1 1
LOGICAL(2) or LOGICAL*2 2
LOGICAL(4) or LOGICAL*4 4
LOGICAL(8) or LOGICAL*8 8
INTEGER(1) or INTEGER*1 1
INTEGER(2) or INTEGER*2 2
INTEGER(4) or INTEGER*4 4
INTEGER(8) or INTEGER*8 8
REAL(4) or REAL*4 4
DOUBLE PRECISION 8
REAL(8) or REAL*8 8
REAL(16) or REAL*16 16
COMPLEX(4) or COMPLEX*8 8 1
DOUBLE COMPLEX 16 1
COMPLEX(8) or COMPLEX*16 16 1
COMPLEX(16) or COMPLEX*32 32 1

1Complex values are treated as pairs of real numbers, so complex editing requires a pair of real edit descriptors. (See Section 11.3.4.6.)

If w is equal to or greater than the length (len) of the input item, the rightmost characters are assigned to that item. The leftmost excess characters are ignored.

If w is less than len, or less than the number of characters that can be stored, w characters are assigned to the list item, left-justified, and followed by trailing blanks.

The following shows input using the A edit descriptor:

Format Input Value Data Type
A6 PAGE-# # CHARACTER(LEN=1)
A6 PAGE-# E-# CHARACTER(LEN=3)
A6 PAGE-# PAGE-# CHARACTER(LEN=6)
A6 PAGE-# PAGE-#-- CHARACTER(LEN=8)
A6 PAGE-# # LOGICAL(1)
A6 PAGE-# -# INTEGER(2)
A6 PAGE-# GE-# REAL(4)
A6 PAGE-# PAGE-#-- REAL(8)


Previous Next Contents Index