Why won't this work?!?!?! 
Author Message
 Why won't this work?!?!?!

Hello All,

   I'm testing a piece of code to open a file.  I'm using DVF 5.0D on a
Win95/NT machine.  The file I'm
trying to open is what's called a GRIB (GRIdded Binary) file which is
packed, binary data.  Here is the
code:
 PROGRAM TEST
CHARACTER*44 INFILE
PRINT *,' TYPE IN THE NAME OF THE EDITION 1 GRIB FILE:'
READ (*,.'(A)') INFILE
PRINT *,' INFILE = ',INFILE
OPEN (UNIT=11,FILE=NFILE,STATUS='OLD',ACCESS='SEQUENTIAL',
& FORM='BINARY',IOSTAT=MERR,RECL=KBYTES)
IF (MERR.NE.0) THEN
PRINT *,'ERROR ACCESSING FILE - ',INFILE
PRINT *,'MERR = ',MERR
ENDIF
PRINT *,'GOT IT!!!'
END

Now, if I try it with this type of OPEN statment, I get an IOSTAT error of
43 which says:

severe (43): File name specification error

FOR$IOS_FILENAM$SP, A pathname or file name given to an OPEN or INQUIRE
statement
was not acceptable to the DIGITAL fortran I/O system.

Well, gee...the file name is 078.grb ...what is wrong with that???  So... I
tried a different OPEN
statement of:

OPEN (UNIT=11,FILE=NFILE,STATUS='OLD',ACCESS='DIRECT',
& FORM='UNFORMATTED',IOSTAT=MERR)

This OPEN yields a different IOSTAT error of 37 which says:

severe (38): inconsistant record lenght
FOR$IOCRECLEN, An attempt was made to open a direct access file without
specifying a record lenght.

The size of 078.grb is 278 kbytes.  The problem is that for my use in my
main program, the files may be
smaller...or up to 50 Mbytes.

How do I make this work???

Thanks in advance for any & all help.
Jeff Krob

*** Posted from RemarQ - http://www.*-*-*.com/ - Discussions Start Here (tm) ***



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!

...

Quote:
>PRINT *,' INFILE = ',INFILE
>OPEN (UNIT=11,FILE=NFILE,STATUS='OLD',ACCESS='SEQUENTIAL',
>& FORM='BINARY',IOSTAT=MERR,RECL=KBYTES)

The problem may be that you've spelled the variable "INFILE" in one
place and "NFILE" in the other.  Is that really what the program says
or did you transcribe the problem wrong when you wrote the news
article?  If the program actually uses the same name in both places, then
the problem really is with the I/O library.  If the problem really is that
you've misspelled the name, try putting IMPLICIT NONE at the
start of all your procedures - this will help (but only help) identify
misspelled variables.

--
J. Giles



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!

Quote:

>Subject: Why won't this work?!?!?!
>From: Jeff Krob
>Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
>Date: Fri, 22 Jan 1999 09:13:45 -0800
>Newsgroups: comp.lang.fortran

>Hello All,

>   I'm testing a piece of code to open a file.  I'm using DVF 5.0D on a
>Win95/NT machine.  The file I'm
>trying to open is what's called a GRIB (GRIdded Binary) file which is
>packed, binary data.  Here is the
>code:
> PROGRAM TEST
>CHARACTER*44 INFILE
>PRINT *,' TYPE IN THE NAME OF THE EDITION 1 GRIB FILE:'
>READ (*,.'(A)') INFILE
>PRINT *,' INFILE = ',INFILE

                      ^^^^^^
Quote:
>OPEN (UNIT=11,FILE=NFILE,STATUS='OLD',ACCESS='SEQUENTIAL',

                    ^^^^^

So, is it NFILE or INFILE? Check the spelling!

See the related threads on undefined variables!

- Show quoted text -

Quote:
>& FORM='BINARY',IOSTAT=MERR,RECL=KBYTES)
>IF (MERR.NE.0) THEN
>PRINT *,'ERROR ACCESSING FILE - ',INFILE
>PRINT *,'MERR = ',MERR
>ENDIF
>PRINT *,'GOT IT!!!'
>END

>Now, if I try it with this type of OPEN statment, I get an IOSTAT error of
>43 which says:

>severe (43): File name specification error

>FOR$IOS_FILENAM$SP, A pathname or file name given to an OPEN or INQUIRE
>statement
>was not acceptable to the DIGITAL Fortran I/O system.

>Well, gee...the file name is 078.grb ...what is wrong with that???  So... I
>tried a different OPEN
>statement of:

>OPEN (UNIT=11,FILE=NFILE,STATUS='OLD',ACCESS='DIRECT',
>& FORM='UNFORMATTED',IOSTAT=MERR)

>This OPEN yields a different IOSTAT error of 37 which says:

>severe (38): inconsistant record lenght
>FOR$IOCRECLEN, An attempt was made to open a direct access file without
>specifying a record lenght.

>The size of 078.grb is 278 kbytes.  The problem is that for my use in my
>main program, the files may be
>smaller...or up to 50 Mbytes.

>How do I make this work???

>Thanks in advance for any & all help.
>Jeff Krob

>*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!
Sorry of the typo's, guys...it's INFILE (as in INcomming FILE) all the way
through the code.
I was typing the message longhand & it got past me...sorry.

Jeff Krob

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!

Quote:
>Hello All,

>   I'm testing a piece of code to open a file.  I'm using DVF 5.0D on a
>Win95/NT machine.  The file I'm
>trying to open is what's called a GRIB (GRIdded Binary) file which is
>packed, binary data.  Here is the
>code:

[snip]

There's not enough here to test - coupled with the apparent typos in the
text here, I can't be sure how closely this resembles your actual code.


file of your sample program's workspace and a data file to try it out on.
It's also important to know HOW you are running this program (from a command
prompt, from inside Developer Studio (and how), etc.)

I'll note that for direct access unformatted files, you must specify a
correct RECL.  For BINARY files, the RECL doesn't matter.



DIGITAL Fortran Development     http://www.digital.com/info/slionel.html
Compaq Computer Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698           "Free advice is worth every cent"

DIGITAL Fortran web site: http://www.digital.com/fortran



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!
Nevermind...I found it.  Come to find out, if you take out the RECL option &
change the STATUS
from 'OLD' (which should work since the file is already there) to 'UNKNOWN'
(which I guess "would"
work)
then the code progresses.

Thanks anyway...maybe next time ;-) (I see another problem brewing)

Jeff krob

*** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ***



Wed, 18 Jun 1902 08:00:00 GMT  
 Why won't this work?!?!?!

Quote:

> The problem may be that you've spelled the variable "INFILE" in one
> place and "NFILE" in the other.  Is that really what the program says
> or did you transcribe the problem wrong when you wrote the news
> article?  If the program actually uses the same name in both places, then
> the problem really is with the I/O library.  If the problem really is that
> you've misspelled the name, try putting IMPLICIT NONE at the
> start of all your procedures - this will help (but only help) identify
> misspelled variables.

Alternatively, you can turn on the DVF compiler option that warns of
undeclared variables.  The effect is the same.

John Bollinger



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Why won't this work

2. why won't this work ??

3. Why won't it work?

4. Why won't this work?

5. WHY WON'T THIS WORK?

6. Tkinter: Why won't it work?

7. Why won't this work?

8. Why Won't This Work?

9. Why won't this work???

10. Why won't this work??

11. Why won't this work?

12. The ACCEPT loop - why won't it work?

 

 
Powered by phpBB® Forum Software