Silverfrost Forums

Welcome to our forums

Could you give me some examples of compiling under \\FTN95 ?

3 Aug 2008 11:51 #3651

Having read the code that opens the 2 files, why do they have to be fixed length record, direct access text files at all ? There is no reference to record numbers in either the read or write statement provided, ( can they be omitted ?)

Couldn't the file on unit 10 be opened as a default text file ? I've never used formatted direct access files (in over 30 years) to know the answer.

Why not simply set up a table in memory of all the values for CIK, CNUM, CIC, YEAR . It would only be 22,663 x 200 bytes long ! ( or only 22,633 x 21 bytes based on the format statement )

Another alternative could be :

!  open 'COMPSTATCIKCUSIP.DAT' as a text file and
! generate 'COMPCIKCUSIP9.DAT' as a 23 byte record direct access file
!
C 
CHARACTER*10 CIK 
CHARACTER*6 CNUM 
CHARACTER*3 CIC 
INTEGER*4 YEAR , i
!
i = 0
OPEN(UNIT=10,FILE='COMPSTATCIKCUSIP.DAT',STATUS='OLD',ERR=200) 

OPEN(UNIT=12,FILE='COMPCIKCUSIP9.DAT',ACCESS='DIRECT',RECL=23, 
* STATUS='NEW',ERR=100) 
do i = 1,999999
  READ (UNIT=10,FMT='(A10,A6,A3,12X,I4/)',ERR=100,END=100) CIK, CNUM, CIC, YEAR 

WRITE(UNIT=12,rec=i,ERR=100) CIK, CNUM, CIC, YEAR 
end do

100 write (*,*) i-1,' recorde creared in ','COMPCIKCUSIP9.DAT'
CLOSE (UNIT=10) 
CLOSE (UNIT=12) 
STOP 
200 write (*,*) 'could not open original file'
END 
4 Aug 2008 8:42 #3658

JKYUN:

What about:

FTN95 -LGO Program.FOR

which compiles, links AND runs, or

FTN95 -link Program.FOR

which compiles, links and runs but keeps a copy of the executable.

You could use /LGO instead of -LGO etc.

Eddie

19 Aug 2008 3:11 #3718

Finally I could get to the level of executable file. But when I ran the file, I did not get the desired output file in the directory. Is there anyway I can find what went wrong? I do not understand why I do not get the designated output file.... ummm

27 Aug 2008 5:10 #3758

Could anyone please let me know why the output file is not created even though I got the executable file???

27 Aug 2008 10:09 #3763

Put IOSTAT= in all your i/o statements and write the result to the screen to see what is going on. eg change your statements

OPEN(UNIT=10,FILE='COMPSTATCIKCUSIP.DAT',STATUS='OLD',ERR=200)

to OPEN(UNIT=10,FILE='COMPSTATCIKCUSIP.DAT',STATUS='OLD',IOSTAT=IOSTAT) write (,) 'OPEN of COMPSTATCIKCUSIP.DAT, IOSTAT=',iostat if (iostat /= 0) goto 200

and WRITE(UNIT=12,rec=i,ERR=100) CIK, CNUM, CIC, YEAR

to WRITE(UNIT=12,rec=i,IOSTAT=IOSTAT) CIK, CNUM, CIC, YEAR write (,) 'WRITE record',i,' , IOSTAT=',iostat if (iostat /= 0) goto 100

And any others that may be causing problems. You may get some idea then.

John

Please login to reply.