- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Fortran-fans,
When I read a sequential file, I see two abnormalities:
1) If a record consists of one byte Cntrl/Z (decimal 26),
READ returns EOF, i.e. IOSTAT variable is -1.
2) If the last character of the record is Cntrl/M (decimal 13), READ
does not return this character. But it does return if Cntrl/M
is not the last character of the record.
Documentation claims that situation (1) should occur when -vms
flag is on, which is by default is off. So, if you do not use -vms
flag, you should expect READ should not return EOF in that case.
I did not find anything related to situation (2) in documentation.
One should expect that RECORDTYPE='STREAM_LF' uses character LF
(decimal code 10) as a record delimiter, all other character being
considered as a record body.
Is there any trick which would allow to get rid of these "features"?
/tmp> /opt/intel/fortran/bin/ifort -V
Intel Fortran Compiler for 32-bit applications, Version 8.1
Build 20040803Z Package ID: l_fc_p_8.1.018
Leonid
13-FEB-2005 13:58:45
When I read a sequential file, I see two abnormalities:
1) If a record consists of one byte Cntrl/Z (decimal 26),
READ returns EOF, i.e. IOSTAT variable is -1.
2) If the last character of the record is Cntrl/M (decimal 13), READ
does not return this character. But it does return if Cntrl/M
is not the last character of the record.
Documentation claims that situation (1) should occur when -vms
flag is on, which is by default is off. So, if you do not use -vms
flag, you should expect READ should not return EOF in that case.
I did not find anything related to situation (2) in documentation.
One should expect that RECORDTYPE='STREAM_LF' uses character LF
(decimal code 10) as a record delimiter, all other character being
considered as a record body.
Is there any trick which would allow to get rid of these "features"?
/tmp> /opt/intel/fortran/bin/ifort -V
Intel Fortran Compiler for 32-bit applications, Version 8.1
Build 20040803Z Package ID: l_fc_p_8.1.018
Leonid
13-FEB-2005 13:58:45
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What exactly are you trying to do? Might you be better served by opening the file FORM='BINARY' and reading the bytes directly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I want to read a file with records separated by a delimiter:
character LF (10 decimal). All characters which are not delimiters,
i.e in the range (-128-9, 11-127), are considered as a part of records.
Of course, I can use system call read or something like that, but I wonder
is there a way to implement this using ordinary sequential READ? How to
turn off special interpretation of Cntrl/Z, Cntrl/M?
Leonid
16-FEB-2005 21:23:23
I want to read a file with records separated by a delimiter:
character LF (10 decimal). All characters which are not delimiters,
i.e in the range (-128-9, 11-127), are considered as a part of records.
Of course, I can use system call read or something like that, but I wonder
is there a way to implement this using ordinary sequential READ? How to
turn off special interpretation of Cntrl/Z, Cntrl/M?
Leonid
16-FEB-2005 21:23:23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't "turn off" recognition of CTRL-Z, but I would have expected that saying that the file is STREAM_LF would do what you want. The problem with formatted reads is that data can be interpreted as delimiters. I suggest using unformatted reads with FORM='BINARY' into a buffer and look for the LF yourself.

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