- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have found that one form of internal read that I used with CVF and DVF does not work the same IVF. Is there an alternate form for this statement that would return the integer 1?
Notes:
- I'm using IVF 11.1 update 3
- Windows Vista
- Have tried replacing the blanks in the string below with nuls, but that returns an error.
With the following code, CVF yielded NNODE=1 but IVF returns NNODE=10000000. I would like it to be interpreted as a 1.
Thanks in advance for your suggestions,
Bruce
------------------------
Notes:
- I'm using IVF 11.1 update 3
- Windows Vista
- Have tried replacing the blanks in the string below with nuls, but that returns an error.
With the following code, CVF yielded NNODE=1 but IVF returns NNODE=10000000. I would like it to be interpreted as a 1.
Thanks in advance for your suggestions,
Bruce
------------------------
[plain]! TestInternalRead.f90 CHARACTER*8 LABEL CHARACTER*1 NUL INTEGER NNODE OPEN (23,FILE='JUNK.TXT', STATUS='UNKNOWN') WRITE (23,*) 'Test internal read' NNODE=0 LABEL='1 ' READ (LABEL,'(I8)',ERR=3,END=3) NNODE ! Internal read WRITE (23,*) 'No error from internal read.' WRITE (23,*) NNODE,'=NNODE' GOTO 2 3 WRITE (23,*) 'Error from internal read.' WRITE (23,*) NNODE,'=NNODE' 2 CLOSE (23,STATUS='KEEP') END [/plain]
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't have IVF handy to try this at the moment, but what happens if you change the
(I8) to (BN,I8) ?
Looks like IVF default is BZ (treat blanks as zero). CVF default is BN (ignore imbedded and trailing blanks).
Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
READ (label(1:LEN_TRIM(label)),'(I)') nnode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't have IVF handy to try this at the moment, but what happens if you change the
(I8) to (BN,I8) ?
Looks like IVF default is BZ (treat blanks as zero). CVF default is BN (ignore imbedded and trailing blanks).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't have IVF handy to try this at the moment, but what happens if you change the
(I8) to (BN,I8) ?
Looks like IVF default is BZ (treat blanks as zero). CVF default is BN (ignore imbedded and trailing blanks).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that it looks like this should work, but the READ fails and NNODE stays at zero.
-Bruce
Quoting - Paul Curtis
-Bruce
Quoting - Paul Curtis
READ (label(1:LEN_TRIM(label)),'(I)') nnode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried this and it worked correctly in IVF 11.1 Update 3 - NNODE was 1. IVF and CVF have the same default of BN for internal reads, as dictated by the F77 standard.
Can anyone else reproduce the other behavior?
Can anyone else reproduce the other behavior?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are my compiler settings. Steve, what were your settings?
Thanks,
Bruce
Quoting - Steve Lionel (Intel)
Thanks,
Bruce
[plain]/nologo /arch:IA32 /vms /module:"Release" /object:"Release" /libs:static /threads /c[/plain]
Quoting - Steve Lionel (Intel)
I tried this and it worked correctly in IVF 11.1 Update 3 - NNODE was 1. IVF and CVF have the same default of BN for internal reads, as dictated by the F77 standard.
Can anyone else reproduce the other behavior?
Can anyone else reproduce the other behavior?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, /vms. Didn't think of that one. Remove /vms and you'll see the behavior you want. CVF behaved the same way with /vms. Here's what the documentation says:
Treatment of blanks in input
The vms option causes the defaults for the keyword BLANK in OPEN statements to become 'NULL' for an explicit OPEN and 'ZERO' for an implicit OPEN of an external or internal file.
This option is mainly for compatibility with VAX Fortran 77.
Treatment of blanks in input
The vms option causes the defaults for the keyword BLANK in OPEN statements to become 'NULL' for an explicit OPEN and 'ZERO' for an implicit OPEN of an external or internal file.
This option is mainly for compatibility with VAX Fortran 77.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm... that puts me in a bind. I don't really want the /vms switch, but was forced to do that to correct the end-of-file behavior. See the topic "EOF handling in IVF vs. DVF"
Any suggestions on how to deal with those two problems simultaneously?
Thanks,
Bruce
Quoting - Steve Lionel (Intel)
Any suggestions on how to deal with those two problems simultaneously?
Thanks,
Bruce
Quoting - Steve Lionel (Intel)
Ah, /vms. Didn't think of that one. Remove /vms and you'll see the behavior you want. CVF behaved the same way with /vms. Here's what the documentation says:
Treatment of blanks in input
The vms option causes the defaults for the keyword BLANK in OPEN statements to become 'NULL' for an explicit OPEN and 'ZERO' for an implicit OPEN of an external or internal file.
This option is mainly for compatibility with VAX Fortran 77.
Treatment of blanks in input
The vms option causes the defaults for the keyword BLANK in OPEN statements to become 'NULL' for an explicit OPEN and 'ZERO' for an implicit OPEN of an external or internal file.
This option is mainly for compatibility with VAX Fortran 77.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Put BN at the beginning of your format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can do that, but would rather dump the /vms switch. Any chance that the EOF behavior will be fixed so that I don't need the /vms?
I have internal reads sprinkled through 30 different projects, so it would be nice not to have to track them down and change each one.
Quoting - Steve Lionel (Intel)
I have internal reads sprinkled through 30 different projects, so it would be nice not to have to track them down and change each one.
Quoting - Steve Lionel (Intel)
Put BN at the beginning of your format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not expect that other issue to be fixed soon, though I have pinged the developers on it. However, I have to ask - how are you creating these input files with ENDFILE records in them?
Sorry, I don't know another workaround other than compiling only the files that read from this input file with /vms - the others can be compiled without /vms.
Sorry, I don't know another workaround other than compiling only the files that read from this input file with /vms - the others can be compiled without /vms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, thanks.
The input files are being written by someone else's exe. That exe is in Delphi Pascal -- I don't know if that is default behavior when it writes a text file, but omitting the EOF mark might be another solution.
Quoting - Steve Lionel (Intel)
The input files are being written by someone else's exe. That exe is in Delphi Pascal -- I don't know if that is default behavior when it writes a text file, but omitting the EOF mark might be another solution.
Quoting - Steve Lionel (Intel)
I do not expect that other issue to be fixed soon, though I have pinged the developers on it. However, I have to ask - how are you creating these input files with ENDFILE records in them?
Sorry, I don't know another workaround other than compiling only the files that read from this input file with /vms - the others can be compiled without /vms.
Sorry, I don't know another workaround other than compiling only the files that read from this input file with /vms - the others can be compiled without /vms.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page