XL Fortran for AIX 8.1

Language Reference


Data Edit Descriptors

A (Character) Editing

Forms:

A
Aw

The A edit descriptor directs the editing of character values. It can correspond to an input/output list item of type character or any other type. The kind type parameter of all characters transferred and converted is implied by the corresponding list item.

On input, if w is greater than or equal to the length (call it len) of the input list item, the rightmost len characters are taken from the input field. If the specified field width is less than len, the w characters are left-justified, with ( len - w ) trailing blanks added.

On output, if w is greater than len, the output field consists of ( w - len ) blanks followed by the len characters from the internal representation. If w is less than or equal to len, the output field consists of the leftmost w characters from the internal representation.

If w is not specified, the width of the character field is the length of the corresponding input/output list item.

B (Binary) Editing

Forms:

Bw
Bw.m

The B edit descriptor directs editing between values of any type in internal form and their binary representation. (A binary digit is either 0 or 1.)

On input, w binary digits are edited and form the internal representation for the value of the input list item. The binary digits in the input field correspond to the rightmost binary digits of the internal representation of the value assigned to the input list item. m has no effect on input.

On input, w must be greater than zero.

+---------------------------------Fortran 95---------------------------------+

On output, w can be zero. If w is zero, the output field consists of the least number of characters required to represent the output value.

+-----------------------------End of Fortran 95------------------------------+

The output field for Bw consists of zero or more leading blanks followed by the internal value in a form identical to the binary digits without leading zeros. Note that a binary constant always consists of at least one digit.

The output field for Bw.m is the same as for Bw, except that the digit string consists of at least m digits. If necessary, the digit string is padded with leading zeros. The value of m must not exceed the value of w unless w is zero. If m is zero and the value of the internal data is zero, the output field consists of only blank characters, regardless of the sign control in effect.

If m is zero, w is positive and the value of the internal datum is zero, the output field consists of w blank characters. FORTRAN 95 BeginsIf both w and m are zero, and the value of the internal datum is zero, the output field consists of only one blank character. FORTRAN 95 Ends

If the nooldboz suboption of the -qxlf77 compiler option is specified (the default), asterisks are printed when the output field width is not sufficient to contain the entire output. On input, the BN and BZ edit descriptors affect the B edit descriptor.

+-------------------------------IBM Extension--------------------------------+

If the oldboz suboption of the -qxlf77 compiler option is specified, the following occurs on output:

If w is zero, the oldboz suboption will be ignored.

With the oldboz suboption, the BN and BZ edit descriptors do not affect the B edit descriptor.

+----------------------------End of IBM Extension----------------------------+

Examples of B Editing on Input

Input      Format      Value
111        B3          7
110        B3          6

Examples of B Editing on Output

Value      Format          Output                 Output
                   (with -qxlf77=oldboz)  (with -qxlf77=nooldboz)
 7          B3             111                    111
 6          B5             00110                  bb110
17          B6.5           b10001                 b10001
17          B4.2           0001                   ****
22          B6.5           b10110                 b10110
22          B4.2           0110                   ****
 0          B5.0           bbbbb                  bbbbb
 2          B0             10                     10

E, D, and Q (Extended Precision) Editing

Forms:

Ew.d
Ew.d Ee
Dw.d
IBM Extension BeginsEw.d De IBM Extension Ends
IBM Extension BeginsEw.d Qe IBM Extension Ends
IBM Extension BeginsQw.d IBM Extension Ends

The E, D, and extended precision Q edit descriptors direct editing between real and complex numbers in internal form and their character representations with exponents. An E, D, or extended precision Q edit descriptor can correspond to an input/output list item of type real, to either part (real or imaginary) of an input/output list item of type complex, IBM Extension Beginsor to any other type in XL Fortran, as long as the length is at least 4 bytes. IBM Extension Ends

The form of the input field is the same as for F editing. e has no effect on input.

The form of the output field for a scale factor of 0 is:



>>-+-----+--+-----+--.--digit_string--decimal_exponent---------><
   +- + -+  '- 0 -'
   '- - -'
 
 

digit_string
is a digit string whose length is the d most significant digits of the value after rounding.

decimal_exponent
is a decimal exponent of one of the following forms (z is a digit):

Edit Descriptor Absolute Value of Exponent (with scale factor of 0) Form of Exponent
Ew.d |decimal_exponent| <= 99 E±z1z2
Ew.d 99<|decimal_exponent| <= 309 ±z1z2z3
Ew.dEe |decimal_exponent| <= (10e)-1 E±z1z2...ze
Ew.dDe * |decimal_exponent| <= (10e)-1 * D±z1z2...ze *
Ew.dQe * |decimal_exponent| <= (10e)-1 * Q±z1z2...ze *
Dw.d |decimal_exponent| <= 99 D±z1z2
Dw.d 99<|decimal_exponent| <= 309 ±z1z2z3
Qw.d * |decimal_exponent| <= 99 * Q±z1z2 *
Qw.d * 99<|decimal_exponent| <= 309 * ±z1z2z3 *
Note:
* IBM Extensions

The scale factor k (see P (Scale Factor) Editing) controls decimal normalization. If -d<k<=0, the output field contains |k| leading zeros and d - |k| significant digits after the decimal point. If 0<k<d+2, the output field contains k significant digits to the left of the decimal point and d-k+1 significant digits to the right of the decimal point. You cannot use other values of k.

See Editing for additional information.

+-------------------------------IBM Extension--------------------------------+

Note:
If the value to be displayed using the real edit descriptor is outside of the range of representable numbers, XL Fortran supports the ANSI/IEEE floating-point format by displaying the following:

Table 12. Floating-Point Display

Display Meaning
NaNQ
+NaNQ
Positive Quiet NaN (not-a-number)
-NaNQ Negative Quiet NaN
NaNS
+NaNS
Positive Signaling NaN
-NaNS Negative Signaling NaN
INF
+INF
Positive Infinity
-INF Negative Infinity

+----------------------------End of IBM Extension----------------------------+

Examples of E, D, and Extended Precision Q Editing on Input

(Assume BN editing is in effect for blank interpretation.)

Input      Format      Value
12.34      E8.4        12.34
.1234E2    E8.4        12.34
2.E10      E12.6E1     2.E10

Examples of E, D, and Extended Precision Q Editing on Output

Value      Format           Output                    Output
                    (with -qxlf77=noleadzero)  (with -qxlf77=leadzero)
1234.56    E10.3          bb.123E+04                b0.123E+04
1234.56    D10.3          bb.123D+04                b0.123D+04
 
 

+---------------------------------Fortran 95---------------------------------+

                    (with -qxlf90=signedzero)  (with -qxlf90=nosignedzero)
-0.001     E5.2           -0.00                     b0.00

+-----------------------------End of Fortran 95------------------------------+

EN Editing

Forms:

ENw.d
ENw.dEe

The EN edit descriptor produces an output field in the form of a real number in engineering notation such that 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, except when the output value is zero. The scale factor has no effect on output.

The EN edit descriptor can correspond to an input/output list item of type real, to either part (real or imaginary) of an input/output list item of type complex, IBM Extension Beginsor to any other type in XL Fortran, as long as the length is at least 4 bytes. IBM Extension Ends

The form and interpretation of the input field is the same as for F editing.

The form of the output field is:



>>-+-----+--+-------+--.--digit_string--exp--------------------><
   +- + -+  '- yyy -'
   '- - -'
 
 

yyy
are the 1 to 3 decimal digits representative of the most significant digits of the value of the datum after rounding (yyy is an integer such that 1 <= yyy < 1000 or, if the output value is zero, yyy = 0).

digit_string
are the d next most significant digits of the value of the datum after rounding.

exp
is a decimal exponent, divisible by 3, of one of the following forms (z is a digit):

Edit Descriptor Absolute Value of Exponent Form of Exponent
ENw.d |exp| <= 99 z1z2
ENw.d 99 < |exp| <= 309 ±z1z2z3
ENw.dEe |exp| <= 10e-1 z1 ... ze

For additional information on numeric editing, see Editing.

Examples of EN Editing

Value         Format       Output
3.14159       EN12.5       b3.14159E+00
1.41425D+5    EN15.5E4     141.42500E+0003
3.14159D-12   EN15.5E1     ***************
 
 

+---------------------------------Fortran 95---------------------------------+

                      (with -qxlf90=signedzero)  (with -qxlf90=nosignedzero)
-0.001        EN9.2        -1.00E-03                   -1.00E-03      

+-----------------------------End of Fortran 95------------------------------+

ES Editing

Forms:

ESw.d
ESw.dEe

The ES edit descriptor produces an output field in the form of a real number in scientific notation such that the absolute value of the significand is greater than or equal to 1 and less than 10, except when the output value is zero. The scale factor has no effect on output.

The ES edit descriptor can correspond to an input/output list item of type real, to either part (real or imaginary) of an input/output list item of type complex, IBM Extension Beginsor to any other type in XL Fortran, as long as the length is at least 4 bytes. IBM Extension Ends

The form and interpretation of the input field is the same as for F editing.

The form of the output field is:



>>-+-----+--+-----+--.--digit_string--exp----------------------><
   +- + -+  '- y -'
   '- - -'
 
 

y
is a decimal digit representative of the most significant digit of the value of the datum after rounding.

digit_string
are the d next most significant digits of the value of the datum after rounding.

exp
is a decimal exponent having one of the following forms (z is a digit):

Edit Descriptor Absolute Value of Exponent Form of Exponent
ESw.d |exp| <= 99 z1z2
ESw.d 99 < |exp| <= 309 ±z1z2z3
ESw.dEe |exp| <= 10e-1 z1 ... ze

For additional information on numeric editing, see Editing.

Examples of ES Editing

Value         Format      Output
31415.9       ES12.5      b3.14159E+04
14142.5D+3    ES15.5E4    bb1.41425E+0007
31415.9D-22   ES15.5E1    ***************
 

+---------------------------------Fortran 95---------------------------------+

                      (with -qxlf90=signedzero)  (with -qxlf90=nosignedzero)
-0.001        ES9.2        -1.00E-03                   -1.00E-03      

+-----------------------------End of Fortran 95------------------------------+

F (Real without Exponent) Editing

Form:

Fw.d

The F edit descriptor directs editing between real and complex numbers in internal form and their character representations without exponents.

The F edit descriptor can correspond to an input/output list item of type real, to either part (real or imaginary) of an input/output list item of type complex, IBM Extension Beginsor to any other type in XL Fortran, as long as the length is at least 4 bytes. IBM Extension Ends

The input field for the F edit descriptor consists of, in order:

  1. An optional sign.
  2. A string of digits optionally containing a decimal point. If the decimal point is present, it overrides the d specified in the edit descriptor. If the decimal point is omitted, the rightmost d digits of the string are interpreted as following the decimal point, and leading blanks are converted to zeros if necessary.
  3. Optionally, an exponent, having one of the following forms:

The output field for the F edit descriptor consists of, in order:

  1. Blanks, if necessary.
  2. A minus sign if the internal value is negative, or an optional plus sign if the internal value is zero or positive.
  3. A string of digits that contains a decimal point and represents the magnitude of the internal value, as modified by the scale factor in effect and rounded to d fractional digits. See P (Scale Factor) Editing for more information.

See Editing for additional information.

On input, w must be greater than zero.

+---------------------------------Fortran 95---------------------------------+

In Fortran 95 on output, w can be zero. If w is zero, the output field consists of the least number of characters required to represent the output value.

+-----------------------------End of Fortran 95------------------------------+

Examples of F Editing on Input

(Assume BN editing is in effect for blank interpretation.)

Input      Format      Value
-100       F6.2        -1.0
2.9        F6.2        2.9
4.E+2      F6.2        400.0

Examples of F Editing on Output

Value      Format         Output                     Output
                   (with -qxlf77=noleadzero)  (with -qxlf77=leadzero)
+1.2       F8.4          bb1.2000                   bb1.2000
.12345     F8.3          bbbb.123                   bbbb0.123
-12.34     F6.2          -12.34                     -12.34
 

+---------------------------------Fortran 95---------------------------------+

-12.34     F0.2          -12.34                     -12.34
 
                   (with -qxlf90=signedzero)  (with -qxlf90=nosignedzero)
-0.001     F5.2          -0.00                       b0.00

+-----------------------------End of Fortran 95------------------------------+

G (General) Editing

Forms:

Gw.d
Gw.dEe
IBM Extension BeginsGw.dDe IBM Extension Ends
IBM Extension BeginsGw.dQe IBM Extension Ends

The G edit descriptor can correspond to an input/output list item of any type. Editing of integer data follows the rules of the I edit descriptor; editing of real and complex data follows the rules of the E or F edit descriptors (depending on the magnitude of the value); editing of logical data follows the rules of the L edit descriptor; and editing of character data follows the rules of the A edit descriptor.

Generalized Real and Complex Editing

If the nogedit77 suboption (the default) of the -qxlf77 option is specified, the method of representation in the output field depends on the magnitude of the datum being edited. Let N be the magnitude of the internal datum. If 0 < N < 0.1-0.5×10 -d-1 or N >= 10 d-0.5 or N is 0 and d is 0, Gw.d output editing is the same as kPE w.d output editing and Gw.dEe output editing is the same as kPEw.dEe output editing, where kP refers to the scale factor ( P (Scale Factor) Editing) currently in effect. If 0.1-0.5×10-d-1  <= N < 10d-0.5 or N is identically 0 and d is not zero, the scale factor has no effect, and the value of N determines the editing as follows:

Magnitude of Datum
Equivalent Conversion
N = 0
F(w-n).(d-1),n('b')
(d must not be 0)
0.1-0.5×10-d-1 <= N < 1-0.5×10-d
F(w-n).d,n('b')
1-0.5×10-d <= N < 10-0.5×10-d+1
F(w-n).(d-1),n('b')
10-0.5×10-d+1 <= N < 100-0.5×10-d+2
F(w-n).(d-2),n('b')
...
...
10d-2-0.5×10-2 <= N < 10d-1-0.5×10-1
F(w-n).1,n('b')
10d-1-0.5×10-1 <= N < 10d-0.5
F(w-n).0,n('b')

where b is a blank. n is 4 for Gw.d and e+2 for Gw.dEe. The value of w-n must also be positive.

Note that the scale factor has no effect unless the magnitude of the datum to be edited is outside the range that permits effective use of F editing.

+-------------------------------IBM Extension--------------------------------+

If 0 < N <  0.1-0.5×10-d-1, N >= 10d-0.5, or N is 0 and d is 0, Gw.dDe output editing is the same as kPEw.dDe output editing and Gw.dQe output editing is the same as kPEw.dQe output editing.

+----------------------------End of IBM Extension----------------------------+

On output, if the gedit77 suboption of the -qxlf77 compiler option is specified, the number is converted using either E or F editing, depending on the number. The field is padded with blanks on the right as necessary. Letting N be the magnitude of the number, editing is as follows:

Note:
While FORTRAN 77 does not address how rounding of values affects the output field form, Fortran 90 does. Therefore, using -qxlf77=gedit77 may produce a different output form than -qxlf77=nogedit77 for certain combinations of values and G edit descriptors.

See Editing for additional information.

Examples of G Editing on Output

Value      Format         Output                  Output
                   (with -qxlf77=gedit77)    (with -qxlf77=nogedit77)
0.0        G10.2         bb0.00E+00               bbb0.0
0.0995     G10.2         bb0.10E+00               bb0.10
99.5       G10.2         bb100.                   bb0.10E+03

I (Integer) Editing

Forms:

Iw
Iw.m

The I edit descriptor directs editing between integers in internal form and character representations of integers. The corresponding input/output list item can be of type integer IBM Extension Beginsor any other type in XL Fortran. IBM Extension Ends

w includes the optional sign.

m must have a value that is less than or equal to w, FORTRAN 95 Beginsunless w is zero in Fortran 95. FORTRAN 95 Ends

The input field for the I edit descriptor must be an optionally signed digit string, unless it is all blanks. If it is all blanks, the input field is considered to be zeros.

m is useful on output only. It has no effect on input.

On input, w must be greater than zero.

+---------------------------------Fortran 95---------------------------------+

On output, w can be zero. If w is zero, the output field consists of the least number of characters required to represent the output value.

+-----------------------------End of Fortran 95------------------------------+

The output field for the I edit descriptor consists of, in order:

  1. Zero or more leading blanks
  2. A minus sign, if the internal value is negative, or an optional plus sign, if the internal value is zero or positive
  3. The magnitude in the form of:

For additional information about numeric editing, see editing.

If m is zero, w is positive and the value of the internal datum is zero, the output field consists of w blank characters. If both w and m are zero and the value of the internal datum is zero, the output field consists of only one blank character.

Examples of I Editing on Input

(Assume BN editing is in effect for blank interpretation.)

Input      Format      Value
-123       I6          -123
123456     I7.5        123456
1234       I4          1234

Examples of I Editing on Output

Value      Format      Output
-12        I7.6        -000012
12345      I5          12345
 

+---------------------------------Fortran 95---------------------------------+

0          I6.0        bbbbbb
0          I0.0        b
2          I0          2

+-----------------------------End of Fortran 95------------------------------+

L (Logical) Editing

Form:

Lw

The L edit descriptor directs editing between logical values in internal form and their character representations. The L edit descriptor can correspond to an input/output list item of type logical, IBM Extension Beginsor any other type in XL Fortran. IBM Extension Ends

The input field consists of optional blanks, followed by an optional decimal point, followed by a T for true or an F for false. w includes blanks. Any characters following the T or F are accepted on input but are ignored; therefore, the strings .TRUE. and .FALSE. are acceptable input forms.

The output field consists of T or F preceded by ( w - 1 ) blanks.

Examples of L Editing on Input

Input      Format      Value
T          L4          true
.FALSE.    L7          false

Examples of L Editing on Output

Value      Format      Output
TRUE       L4          bbbT
FALSE      L1          F

O (Octal) Editing

Forms:

Ow
Ow.m

The O edit descriptor directs editing between values of any type in internal form and their octal representation. (An octal digit is one of 0-7.)

w includes blanks.

On input, w octal digits are edited and form the internal representation for the value of the input list item. The octal digits in the input field correspond to the rightmost octal digits of the internal representation of the value assigned to the input list item. m has no effect on input.

On input, w must be greater than zero.

+---------------------------------Fortran 95---------------------------------+

On output, w can be zero. If w is zero, the output field consists of the least number of characters required to represent the output value.

+-----------------------------End of Fortran 95------------------------------+

The output field for Ow consists of zero or more leading blanks followed by the internal value in a form identical to the octal digits without leading zeros. Note that an octal constant always consists of at least one digit.

The output field for Ow.m is the same as for Ow, except that the digit string consists of at least m digits. If necessary, the digit string is padded with leading zeros. The value of m must not exceed the value of w, unless w is zero. If m is zero and the value of the internal datum is zero, the output field consists of only blank characters, regardless of the sign control in effect.

If the nooldboz suboption of the -qxlf77 compiler option is specified (the default), asterisks are printed when the output field width is not sufficient to contain the entire output. On input, the BN and BZ edit descriptors affect the O edit descriptor.

+-------------------------------IBM Extension--------------------------------+

If the oldboz suboption of the -qxlf77 compiler option is specified, the following occurs on output:

If w is zero, the oldboz suboption will be ignored.

With the oldboz suboption, the BN and BZ edit descriptors do not affect the O edit descriptor.

+----------------------------End of IBM Extension----------------------------+

If m is zero, w is positive and the value of the internal datum is zero, the output field consists of w blank characters. If both w and m are zero and the value of the internal datum is zero, the output field consists of only one blank character.

Examples of O Editing on Input

Input      Format      Value
123        O3          83
120        O3          80

Examples of O Editing on Output

Value      Format         Output                 Output
                  (with -qxlf77=oldboz)  (with -qxlf77=nooldboz)
80         O5             00120                  bb120
83         O2             23                     **
 

+---------------------------------Fortran 95---------------------------------+

0          O5.0           bbbbb                  bbbbb
0          O0.0           b                      b
80         O0             120                    120

+-----------------------------End of Fortran 95------------------------------+

+-------------------------------IBM Extension--------------------------------+

Q (Character Count) Editing

Form:

Q

The character count Q edit descriptor returns the number of characters remaining in an input record. The result can be used to control the rest of the input.

There also exists the extended precision Q edit descriptor. By default, XL Fortran only recognizes the extended precision Q edit descriptor described earlier. See E, D, and Q (Extended Precision) Editing for more information. To enable both Q edit descriptors, you must specify the -qqcount compiler option. See "-qqcount Option" in the User's Guide for more information.

When you specify the -qqcount compiler option, the compiler will distinguish between the two Q edit descriptors by the way the Q edit descriptor is used. If only a solitary Q is found, the compiler will interpret it as the character count Q edit descriptor. If Qw. or Qw.d is encountered, XL Fortran will interpret it as the extended precision Q edit descriptor. You should use correct format specifications with the proper separators to ensure that XL Fortran correctly interprets which Q edit descriptor you specified.

The value returned as a result of the character count Q edit descriptor depends on the length of the input record and on the current character position in that record. The value is returned into a scalar integer variable on the READ statement whose position corresponds to the position of the character count Q edit descriptor in the FORMAT statement.

The character count Q edit descriptor can read records of the following file types and access modes:

In an output operation, the character count Q edit descriptor is ignored. The corresponding output item is skipped.

Examples of Character Count Q Editing on Input

@PROCESS QCOUNT
       CHARACTER(50) BUF
       INTEGER(4) NBYTES
       CHARACTER(60) STRING
       ...
       BUF = 'This string is 29 bytes long.'
       READ( BUF, FMT='(Q)' ) NBYTES
       WRITE( *,* ) NBYTES
! NBYTES equals 50 because the buffer BUF is 50 bytes long.
       READ(*,20) NBYTES, STRING
20     FORMAT(Q,A)
! NBYTES will equal the number of characters entered by the user.
       END

+----------------------------End of IBM Extension----------------------------+

Z (Hexadecimal) Editing

Forms:

Zw
Zw.m

The Z edit descriptor directs editing between values of any type in internal form and their hexadecimal representation. (A hexadecimal digit is one of 0-9, A-F, or a-f.)

On input, w hexadecimal digits are edited and form the internal representation for the value of the input list item. The hexadecimal digits in the input field correspond to the rightmost hexadecimal digits of the internal representation of the value assigned to the input list item. m has no effect on input.

+---------------------------------Fortran 95---------------------------------+

On output, w can be zero. If w is zero, the output field consists of the least number of characters required to represent the output value.

+-----------------------------End of Fortran 95------------------------------+

The output field for Zw consists of zero or more leading blanks followed by the internal value in a form identical to the hexadecimal digits without leading zeros. Note that a hexadecimal constant always consists of at least one digit.

The output field for Zw.m is the same as for Zw, except that the digit string consists of at least m digits. If necessary, the digit string is padded with leading zeros. The value of m must not exceed the value of w, FORTRAN 95 Beginsunless w is zero. FORTRAN 95 Ends If m is zero and the value of the internal datum is zero, the output field consists of only blank characters, regardless of the sign control in effect.

If m is zero, w is positive and the value of the internal datum is zero, the output field consists of w blank characters.

+---------------------------------Fortran 95---------------------------------+

If both w and m are zero and the value of the internal datum is zero, the output field consists of only one blank character.

+-----------------------------End of Fortran 95------------------------------+

If the nooldboz suboption of the -qxlf77 compiler option is specified (the default), asterisks are printed when the output field width is not sufficient to contain the entire output. On input, the BN and BZ edit descriptors affect the Z edit descriptor.

+-------------------------------IBM Extension--------------------------------+

If the oldboz suboption of the -qxlf77 compiler option is specified, the following occurs on output:

If w is zero, the oldboz suboption will be ignored.

With the oldboz suboption, the BN and BZ edit descriptors do not affect the Z edit descriptor.

+----------------------------End of IBM Extension----------------------------+

Examples of Z Editing on Input

Input      Format      Value
0C         Z2          12
7FFF       Z4          32767

Examples of Z Editing on Output

Value      Format         Output                 Output
                  (with -qxlf77=oldboz)  (with -qxlf77=nooldboz)
-1         Z2             FF                     **
12         Z4             000C                   bbbC
 

+---------------------------------Fortran 95---------------------------------+

12         Z0             C                      C
0          Z5.0           bbbbb                  bbbbb
0          Z0.0           b                      b    

+-----------------------------End of Fortran 95------------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]