PRB: Run-time Error F6103: READ (internal) - invalid REALLast reviewed: December 9, 1995Article ID: Q125470 |
The information in this article applies to:
SYMPTOMSYou receive the following message when attempting to run a FORTRAN program:
run-time error F6103: READ(internal) - invalid REAL CAUSEThis error may be generated by an internal READ when the string that is the target of the read is not padded with blanks to fill the size of the REAL format edit descriptor.
RESOLUTIONInitialize the string variable before using it. This will cause the string to be padded to its full size with spaces, if necessary.
MORE INFORMATIONThe FORTRAN standard does not demand that string variables be initialized by the compiler until an assignment is made. The memory locations will be zeroed, but will not contain proper ASCII codes for characters in a REAL. If you assign characters to a single-element sub-string, the full string will not be initialized. In the "Sample Code" section of this article, the string buffer will have the characters 1, 2, and 3 in the first three elements of the string. However, because you are not assigning to the entire string, the string is not initialized and the remaining memory locations will contain a 0 (zero) or the NULL character. Because the NULL character is not a legal ASCII value for a REAL, the internal read generates the error message as given above. To solve the problem, initialize the entire string by assigning a character to it. In the code below, change the comment into an excuted line to solve the problem by assigning a blank to the string. This simple assignment results in the string being filled with all blanks or ASCII character 32, replacing the zeros that were there initially. Blanks are acceptable characters in a READ of a REAL value.
Sample CodeC Compile options needed: none
CHARACTER*80 buffer REAL numC buffer = ' '
buffer(1:1) = '1' buffer(2:2) = '2' buffer(3:3) = '3' READ(buffer, '(F7.1)') num PRINT*, 'buffer = ', buffer, ' num = ', num END REFERENCESFORTRAN ANSI X3.9-1978, para 10.4
|
Additional reference words: 1.00 1.00a 4.00 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |