forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

linking programs to data and running them

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
DavidColeman



Joined: 06 Apr 2022
Posts: 12

PostPosted: Thu Apr 28, 2022 8:34 pm    Post subject: linking programs to data and running them Reply with quote

Another elementary question. Various kind users have helped me to compile ancient (1980s) programs. Now, despite your clear documentation, I cannot get the (short) programs to read the (simple) data and produce the results, either using the dos box or Plato. They used to work, decades ago. I'm afraid that I don't see any way round that unless I could inflict a specimen program and data on someone. Once I know how to do one, I'm sure I can do the lot.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1021
Location: Morrison, CO, USA

PostPosted: Thu Apr 28, 2022 11:42 pm    Post subject: Reply with quote

I would suggest that, if possible, you put the program and data onto a cloud drive (DropBox, GoogleDrive, etc.) and share it. There are a number of people here who can take some time to help you get past whatever issues your code (or data file) may be having.

Posting a simple example extracted from the real code is useful to get past the issues, at least the first time.

Perhaps if you described the problem in a bit more detail (even without posting code), you might be able to get further along faster.

Just a thought or two.
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Fri Apr 29, 2022 1:00 am    Post subject: Reply with quote

David, "I cannot get the program to..." does not tell us what steps you tried.

As Bill suggested, and as you did in your previous post http://forums.silverfrost.com/viewtopic.php?t=4621 , upload the source, data and output files, as appropriate, to a cloud service.

Then, post a message here with a link to the uploaded file(s), and write details such as "I compiled and linked program X using compiler options OP and attempted to run the resulting program on data file D. The outcome was that I saw warning messages W and run time errors E and the output results were R1 instead of R2 as expected."

Here is a short example to help you get started. First, the source code, file rcw.f90:

Code:
program RCW
implicit none
integer i
real x,y
!
open(10,file='input.dat',status='old')
open(11,file='results.dat',status='replace')
i = 0
do
   read (10, *, end=100) x,y
   i = i + 1
   write (11, *) i, x, y, x+y
end do
100 close(10)
close(11)
end program RCW


The input data file, input.dat:

Code:
2.0 3.5
4.3 2.7
1.5 2e3
1e-3 2e-4


Check that the program source file and the input data file are in the same directory. Make that directory the current directory.

Compile and link:

Code:
ftn95 rcw.f90 /link


Run the program and display the results:

Code:
rcw
type results.dat


The output file contents:

Code:
            1     2.00000         3.50000         5.50000
            2     4.30000         2.70000         7.00000
            3     1.50000         2000.00         2001.50
            4    1.000000E-03    2.000000E-04    1.200000E-03
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2310
Location: Yateley, Hants, UK

PostPosted: Fri Apr 29, 2022 6:30 pm    Post subject: Reply with quote

Just pure speculation on my part, but is there a chance that David was used to putting input and output files on the command line, in which case they were automatically associated with logical unit numbers 5 and 6? I seem to remember that being the case with a system long, long, ago.

Eddie
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Fri Apr 29, 2022 7:19 pm    Post subject: Reply with quote

David Coleman did mention "ICL 2988 mainframe at Oxford" in an earlier post.

I do not know what OS (other than "ICL") and Fortran compiler he used, and what type of job entry system was used. Never used an ICL.

Wikipedia mentions " the University of Salford produced a FORTRAN 77 compiler for George 3 ", so the compiler that David used could have been a distant relative of FTN95!
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 406
Location: Manchester

PostPosted: Sat Apr 30, 2022 1:08 pm    Post subject: Reply with quote

Code from the George 3 compiler is present in FTN77
Back to top
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Sat Apr 30, 2022 3:04 pm    Post subject: Re: Reply with quote

Robert wrote:
Code from the George 3 compiler is present in FTN77


Awesome! A few issues of the ICL Technical Journal are hosted by Fujitsu; here is a link to the first issue (1978):

https://www.fujitsu.com/ie/imagesgig5/ICL-Technical-Journal-v01i01.pdf
Back to top
View user's profile Send private message
DavidColeman



Joined: 06 Apr 2022
Posts: 12

PostPosted: Sat Apr 30, 2022 6:14 pm    Post subject: Re: Reply with quote

mecej4 wrote:
Robert wrote:
Code from the George 3 compiler is present in FTN77


Awesome! A few issues of the ICL Technical Journal are hosted by Fujitsu; here is a link to the first issue (1978):

https://www.fujitsu.com/ie/imagesgig5/ICL-Technical-Journal-v01i01.pdf


In reply to LitusSaxonicum, mecej4 and Robert I am ashamed to report that I fell at the first fence (see below) I had to rename the file rce as freeformat1 but it compiled all right and produced an executable file. But when I tried to run it according to instructions it failed with a run time error '128 file does not exist'. However according to the directory freeformat1 is an exe file of size 11,776. I had the same result through the DOS box and when using the symbols on the Plato top line.

Microsoft Windows [Version 10.0.19042.928]
(c) Microsoft Corporation. All rights reserved.

D:\David\Documents\Population programs\Fortran programs\Newprog>dir
Volume in drive D is Data
Volume Serial Number is EC18-21BC

Directory of D:\David\Documents\Population programs\Fortran programs\Newprog

30/04/2022 17:19 <DIR> .
30/04/2022 17:19 <DIR> ..
30/04/2022 17:07 170 BuildLog
30/04/2022 17:07 102 ErrorLog
30/04/2022 17:07 11,776 FreeFormat1.EXE
30/04/2022 16:58 266 FreeFormat1.f95
30/04/2022 16:58 1,909 FreeFormat1.obj
29/04/2022 14:24 36 input.dat.txt
29/04/2022 13:34 12,469 program RCW.docx
30/04/2022 17:11 272 program RCW.txt
30/04/2022 17:19 272 ~program RCW.txt
9 File(s) 27,272 bytes
2 Dir(s) 709,462,937,600 bytes free

D:\David\Documents\Population programs\Fortran programs\Newprog>ftn95 freeformat1
[FTN95/Win32 Ver. 8.80.0 Copyright (c) Silverfrost Ltd 1993-2021]
NO ERRORS [<RCW> FTN95 v8.80.0]

D:\David\Documents\Population programs\Fortran programs\Newprog> ftn95 freeformat1.90 /link
[FTN95/Win32 Ver. 8.80.0 Copyright (c) Silverfrost Ltd 1993-2021]
*** Source file 'D:\David\Documents\Population programs\Fortran
programs\Newprog\freeformat1.90' cannot be opened

D:\David\Documents\Population programs\Fortran programs\Newprog>ftn95 freeformat1 /link
[FTN95/Win32 Ver. 8.80.0 Copyright (c) Silverfrost Ltd 1993-2021]
NO ERRORS [<RCW> FTN95 v8.80.0]
Creating executable: freeformat1.EXE

D:\David\Documents\Population programs\Fortran programs\Newprog>freeformat1 type results.dat



At least I am arousing some antiquarian interest.The programs were mostly first produced on Hollerith cards for the IBM 360/65 at UCL then transferred to the Oxford ICL and then to the VAX cluster. Yes, 5 and 6 were card reader and line printer respectively. They did work, whether by card or by terminal. I had lots of programs but they were all wiped from the archive and all I have are two or three printer copies.

I have not forgotten the suggestion that I should upload the vexing programs for inspection and i shall now get on with that.

I cringe at the amount of people's time that i am taking up. I did get a local professional computing guru to look at it but he had no more success than I did.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Sat Apr 30, 2022 7:32 pm    Post subject: Reply with quote

Here are a couple of slip-ups that I noticed.

You gave the program source file name a .f95 extension, but used .f90 as the extension in the compilation command.

You named the data file as input.dat.txt, which does not match the name input.dat in the program.

There is evidence that you tried to use a word processor to create the program source file (the .docx extension is the sign). That will not work, since the compiler can only process program source contained in text files.
Back to top
View user's profile Send private message
DavidColeman



Joined: 06 Apr 2022
Posts: 12

PostPosted: Sat Apr 30, 2022 8:30 pm    Post subject: Reply with quote

Following the advice of wahorger I installed Google Drive with a document containing the program lifeab and its data mx, the program marexmatrix and its data mm and an excel document with the simple output (just a half matrix) from the marex program. That is the only thing I have made to work (except for the Squares program in the Silverfrost introduction) but I cannot remember how i did it.

The output from Liftab ought to be a table with 18 rows corresponding to ages 0, 1, 5, 9 etc and several columns corresponding to lx (persons alive at age x) qx (probability of dying between age x and the next age) and finally ex the expectation of life in years at age x.

Not ever having used Google Drive before I do not exactly know how others are meant to access it but the email is carausius287@gmail.com and the password AP56EFCxtype.
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Sat Apr 30, 2022 11:59 pm    Post subject: Reply with quote

For each file that you wish to give access, in your Google Drive, select the file, right click, Get Link, change Restricted to Anyone with the Link, copy the link, and post the link in your reply.

It is generally a bad practice to share Google Drive passwords with anyone, and doing so may be a violation of some web sites' policies.

---
MAREXMATRIX.f has one error. Change WRITE(7, to WRITE(6, on line 34. Once you fix that, you can compile and link the program.

However, the program wishes to read from unit 5 and write to unit 6. That kind of input/output is best done at the command line, using the redirection facilities of the OS.

Code:
ftn95 /check marexmatrix.f /link
marexmatrix < mm.dat


If you wish to build and run from Plato, instead, copy the contents of mm.dat to the clipboard, and paste that in the console window that is opened when you press Start Run.

---
Lifetab.for has several problems. The name of the input file given in the program does not match the actual name of the file. An executable statement is placed in the midst of declaration statements. Some array bounds are exceeded. An input format is wrong. The first READ statement is without purpose.

FTN95 can help you catch these errors if you ask for a Checkmate build.

Fixing these errors is best done by a person who knows the purpose of the program and the calculation methods used.
Back to top
View user's profile Send private message
DavidColeman



Joined: 06 Apr 2022
Posts: 12

PostPosted: Sun May 01, 2022 1:05 am    Post subject: Re: Reply with quote

mecej4 wrote:
Here are a couple of slip-ups that I noticed.

You gave the program source file name a .f95 extension, but used .f90 as the extension in the compilation command.

You named the data file as input.dat.txt, which does not match the name input.dat in the program.

There is evidence that you tried to use a word processor to create the program source file (the .docx extension is the sign). That will not work, since the compiler can only process program source contained in text files.



Thank you for all the comments and corrections.. The f90 issue has been dealt with.
The Google Drive link is https://drive.google.com/drive/folders/1nBQp_f0o1dRRZ7mJSiZsUP2GvPdiqdkn?usp=sharing
I put all the programs including Lifetab through Checkmate and corrected any errors reported. I introduced the misplaced n=18 later, in response to a warning, now corrected.
According to Plato it compiles and links, as do others, but no results follow. I shall try the code which you supplied.
I wrote Lifetab and the others, and they all used to work, although a very long time ago!
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1680

PostPosted: Sun May 01, 2022 1:48 am    Post subject: Reply with quote

You wrote: "I wrote Lifetab and the others, and they all used to work, although a very long time ago!"

That may apply to the program that ran on the ICL, but errors may have been introduced when you reconstructed the program by reading old program listings.

For instance, consider this loop:

Code:
c
      do 4 I=1,n
    4 tx(1)=blx(I)+blx(I+1)


The array element tx(1) is being calculated 18 times, and tx(2), tx(3), ... are left undefined. In a later loop, tx(I) is used with I ranging from 1 to 18, so the results placed into ex(I) for I = 1..18 are all wrong.

If you were to post a scanned image of the program listing, and a printout of the old results, some of these errors could be pointed out. After all, these are quite simple programs and it should be possible to get them working correctly without much effort provided one understands what they are supposed to do.
Back to top
View user's profile Send private message
DavidColeman



Joined: 06 Apr 2022
Posts: 12

PostPosted: Sun May 01, 2022 3:17 am    Post subject: Re: Reply with quote

mecej4 wrote:
For each file that you wish to give access, in your Google Drive, select the file, right click, Get Link, change Restricted to Anyone with the Link, copy the link, and post the link in your reply.

It is generally a bad practice to share Google Drive passwords with anyone, and doing so may be a violation of some web sites' policies.

---
MAREXMATRIX.f has one error. Change WRITE(7, to WRITE(6, on line 34. Once you fix that, you can compile and link the program.

However, the program wishes to read from unit 5 and write to unit 6. That kind of input/output is best done at the command line, using the redirection facilities of the OS.


Yes, that works. Thank you very much!



D:\David\Documents\Population programs\Fortran programs\Marex> ftn95 /check marexmatrix.f /link
[FTN95/Win32 Ver. 8.80.0 Copyright (c) Silverfrost Ltd 1993-2021]
NO ERRORS [<main program> FTN95 v8.80.0]
Creating executable: marexmatrix.EXE

D:\David\Documents\Population programs\Fortran programs\Marex>marexmatrix <mm.dat


MARRIAGE EXCHANGE INPUT DATA

42. 15. 5. 7. 8. 3. 8.

12. 28. 5. 4. 3. 4. 6.

1. 6. 8. 3. 0. 0. 1.

7. 4. 2. 23. 2. 4. 4.

3. 5. 1. 1. 3. 2. 2.

6. 2. 0. 1. 1. 10. 1.

10. 2. 1. 2. 0. 0. 12.

ROW TOTALS OF RAW DATA

88. 62. 19. 46. 17. 21. 27.



COLUMN TOTALS OF RAW DATA

81. 62. 22. 41. 17. 23. 34.





STOCH HALFMATRIX AVE EXCH

15.08191 0.00000 0.00000 0.00000 0.00000 0.00000 5.00952
5.07273 0.00000 0.00000 0.00000 0.00000 7.05469 4.03791
3.03125 0.00000 0.00000 0.00000 8.02956 3.06329 0.02667
2.01653 0.00000 0.00000 3.05634 4.02381 0.00000 4.01527
2.02564 0.00000 8.08696 6.02162 1.01961 4.02703 2.00000
1.00000
15.08191 0.00000 0.00000 0.00000 0.00000 0.00000
5.00952 5.07273 0.00000 0.00000 0.00000 0.00000
7.05469 4.03791 3.03125 0.00000 0.00000 0.00000
8.02956 3.06329 0.02667 2.01653 0.00000 0.00000
3.05634 4.02381 0.00000 4.01527 2.02564 0.00000
8.08696 6.02162 1.01961 4.02703 2.00000 1.00000

D:\David\Documents\Population programs\Fortran programs\Marex>
Code:
ftn95 /check marexmatrix.f /link
marexmatrix < mm.dat


If you wish to build and run from Plato, instead, copy the contents of mm.dat to the clipboard, and paste that in the console window that is opened when you press Start Run.

---
Lifetab.for has several problems. The name of the input file given in the program does not match the actual name of the file. An executable statement is placed in the midst of declaration statements. Some array bounds are exceeded. An input format is wrong. The first READ statement is without purpose.

FTN95 can help you catch these errors if you ask for a Checkmate build.

Fixing these errors is best done by a person who knows the purpose of the program and the calculation methods used.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group