For compatibility with other versions of FORTRAN, the following alternate notation is allowed for octal and hexadecimal notation. This alternate does not work for binary, nor does it work in DATA or PARAMETER statements.
For an octal notation, enclose a string of octal digits in apostrophes and append the letter O.
'37'O 37'O Invalid -- missing initial apostrophe '37' Not numeric -- missing letter O '397'O Invalid -- invalid digit
For hexadecimals, enclose a string of hex digits in apostrophes and append the letter X.
'ab'X 3fff'X '1f'X '1fX Invalid-missing trailing apostrophe '3f' Not numeric- missing X '3g7'X Invalid-invalid digit g
Here are the rules and restrictions for binary, octal, and hexadecimal constants:
These constants are for use anywhere numeric constants are allowed.
These constants are typeless. They are stored in the variables without any conversion to match the type of the variable, but they are stored in the appropriate part of the receiving field--low end, high end.
If the receiving data type has more digits than are specified in the constant, zeros are filled on the left.
If the receiving data type has fewer digits than are specified in the constant, digits are truncated on the left. If nonzero digits are lost, an error message is displayed.
Specified leading zeros are ignored.
You can specify up to 8 bytes of data for any one constant--at least that's all that are used.
If a typeless constant is an actual argument, it has no data type, but it is always 4 bytes that are passed.
For binary constants, each digit must be 0 or 1.
For octal constants, each digit must be in the range 0 to 7.
For hexadecimal constants, each digit must be in the range 0 to 9 or in the range A to F, or a to f.
Outside of DATA statements, such constants are treated as the type required by the context. If a typeless constant is used with a binary operator, it gets the data type of the other operand (8.0 + '37'O).
In DATA statements, such constants are treated as typeless binary, hexadecimal, or octal constants.