|
Prev: #define in fortran
Next: How to decide using COMMON block variables or function/subroutine parameters?
From: Rostyslaw J. Lewyckyj on 25 Oct 2006 00:59 Andrew Swallow wrote: > Morten Reistad wrote: > >> In article <1685.523T2487T6125896(a)kltpzyxm.invalid>, >> Charlie Gibbs <cgibbs(a)kltpzyxm.invalid> wrote: >> >>> In article <FXj%g.7851$Fd7.394(a)bignews6.bellsouth.net>, >>> urjlew(a)bellsouth.net (Rostyslaw J. Lewyckyj) writes: >>> >>>> Where were you at? I thought that our i/o charges for print lines were >>>> consistant at UNC-CH. So you shouldn't have been charged a whole lot >>>> different. Anyway you should have been able to run your deck through >>>> PLC (Cornell PL/I dialect, debugging compiler. Sort of equivalent to >>>> WATFOR/WATFIV for Fortran, but not as well developed) for about the >>>> same charge. >>>> >>>> For funsies, the program >>>> 1 READ(1,100,END=99) >>>> 100 FORMAT(' ',80H >>>> X ) >>>> WRITE(3,100) >>>> GO TO 1 >>>> 99 CONTINUE >>>> END >>>> should list your deck handily. At least it used to work. >> >> >> That would give you a nice, blank deck. Never trust programs >> posted on the Internet ;-) > > > The original Fortran did not have Character variables. The > data could be stored in an array of 80 Integers using 80A1 > 80A1 :) Man can you think of a way to pessimise the program some more? Probably you'd also recommend DIMENSION IA(80) 1 READ 100,(IA(I),I=1,80) 100 FORMAT(80A1) etc. :) rather than READ 100,IA :), or choosing a variable type that would hold the largest number of characters and use an array of those type variables. :) > > format or in the actual Format statement. If you read character > data in using H format the actual H statement is corrupted/over > written. The program works by a trick > That was no TRICK. It is a perfectly valid use of the language definition. The ability to read into the hollerith item of a FORMAT statement was provided for flexible headings. > > but I strongly recommend > you rewrite it to avoid self modifying code. > Then are you against execution time assembling of FORMAT statements as well? OR even reading in FORMAT statements as was a common technique in the BMD and other statistical package programs? >> >> First, you need somewhere to store what you read; >> add >> CHARACTER*80 FOO >> to the top. >> >> Then add FOO to the end of the READ and WRITE statements. >> And change the format to >> 100 FORMAT(' ',A80) > >
From: Walter Spector on 25 Oct 2006 09:05 "Rostyslaw J. Lewyckyj" wrote: > > In article <1685.523T2487T6125896(a)kltpzyxm.invalid>, > > Charlie Gibbs <cgibbs(a)kltpzyxm.invalid> wrote: > > > >>In article <FXj%g.7851$Fd7.394(a)bignews6.bellsouth.net>, > >>urjlew(a)bellsouth.net (Rostyslaw J. Lewyckyj) writes: > >>>For funsies, the program > >>> 1 READ(1,100,END=99) > >>> 100 FORMAT(' ',80H > >>> X ) > >>> WRITE(3,100) > >>> GO TO 1 > >>> 99 CONTINUE > >>> END > >>>should list your deck handily. At least it used to work. > > > > That would give you a nice, blank deck. Never trust programs > > posted on the Internet ;-) As Richard Maine noted, the above is a Fortran-66ism that was removed when Fortran-77 was written. So in modern Fortran it should give a run-time error. Possibly some compilers are smart enough to detect it at compile time. > I don't have access to a computer with Fortran anymore. > But would someone pleast try it, especialy on an IBM system > to verify that it won't work any more. Well, for 'funsies' I tried it out with some ancient CDC compilers: /list PROGRAM TESTHOL (INPUT, OUTPUT, TAPE5=INPUT, TAPE6=OUTPUT) 10 READ (5,100) IF (EOF (5) .EQ. 1) GO TO 20 WRITE (6,100) GO TO 10 20 STOP 100 FORMAT (80H & ) END / With FTN (version 4.8+538), which was CDCs main F66 compiler for many years, the above works as it is required to by the F66 Standard. With MNF (version 5.4), which was a popular student compiler written at the U of Minnesota, the above also works. With FTN5 (version 5.1+538), CDCs main F77 compiler, the error is detected at run-time: /lgo ? this is a test FORMAT (80H ....'.....12345678901234567890 0*ERROR WITH FORMAT NO. 100 :*H,',", ILLEGAL INPUT FORMATS FTN - FATAL ERROR NUMBER 167 TRACEBACK INITIATED BY SYSERR AT REL(ABS) ADDRESS 122(13261). CALLED BY FECESE. AT ADDRESS 304(13415) WITH NO AP-LIST. CALLED BY FMTAP= AT ADDRESS 416(2402) WITH NO AP-LIST. CALLED BY INPC= AT ADDRESS 111(4733) WITH NO AP-LIST. CALLED BY TESTHOL AT LINE 2, ADDRESS 22(123) WITH APLIST 11453(11554). .018 CP SECONDS EXECUTION TIME. /return,lgo And finally, with M77 (version 2.1), the U of Minnesotas F77 followon to MNF, the old code works! However, at EOF I got: /lgo ? this is a test THIS IS A TEST ? of the fortran-66 capability to OF THE FORTRAN-66 CAPABILITY TO ? read data into a format statement READ DATA INTO A FORMAT STATEMENT ? FORMAT .; * ILLEGAL CHARACTER OR INCORRECT NUMBER IN FORMAT ERROR NUMBER 68 FOUND IN INOUT= CALLED BY TESTHOL AT LINE 4 EXCHANGE PACKAGE/MEMORY DUMP ON FILE ZZZDUMP. ILLEGAL I/O REQUEST ON FILE ZZZZDMP AT 4463. / Sadly, the old CDC RUN compiler is probably lost to the 'Great Bit Bucket in the Sky'. I tried something similar to the above on either the Cray or SGI compilers (or both) a few years ago, and the feature seemed to have been 'forgotten about'. Walt
From: Richard E Maine on 25 Oct 2006 12:08 Walter Spector <w6ws_xthisoutx(a)earthlink.net> wrote: > With FTN (version 4.8+538), which was CDCs main F66 compiler for many years,.. > With FTN5 (version 5.1+538), CDCs main F77 compiler,... I used to use those compilers (well, I forget the exact version numbers, but anyway, CDC's FTN and FTN5 compilers of some version) for many years (specifically, a little from about 1969 to 1972, and a lot from 1973 to 1986). I still recall and occasionally cite things about them. I'd sure love to be able to still run them on occasion to refresh my memory or to illustrate a point without having to rely solely on my memory. Seeing that you can still run them prompts me to ask... I think I've asked a more general version before, but I don't recall getting an answer. I suspect that's because the answer is "no", but it doesn't hurt a lot to ask anyway. I'm not asking you for anything illegal or in violation of any proprietary restrictions. Are there publically available copies of the software necessary to run these compilers? I have the free (and nifty) Desktop Cyber emulator. But I haven't seen either the compilers or the OS that they run on anywhere publically available. (I see the Chippewa (sp?) OS available, but that's not one I worked with in real life and I don't know whether it would support the compilers or not). I recall someone (likely you) mentioning a site that occasionally has a real, life CDC machine available on the Web. But I'd be much more intrigued by having the software to run with the Desktop Cyber emulator. -- Richard Maine | Good judgment comes from experience; email: my first.last at org.domain| experience comes from bad judgment. org: nasa, domain: gov | -- Mark Twain
From: Morten Reistad on 25 Oct 2006 11:32 In article <453F6126.2E6CFCA9(a)earthlink.net>, Walter Spector <w6ws_xthisoutx(a)earthlink.net> wrote: >"Rostyslaw J. Lewyckyj" wrote: >> > In article <1685.523T2487T6125896(a)kltpzyxm.invalid>, >> > Charlie Gibbs <cgibbs(a)kltpzyxm.invalid> wrote: >> > >> >>In article <FXj%g.7851$Fd7.394(a)bignews6.bellsouth.net>, >> >>urjlew(a)bellsouth.net (Rostyslaw J. Lewyckyj) writes: >> >>>For funsies, the program >> >>> 1 READ(1,100,END=99) >> >>> 100 FORMAT(' ',80H >> >>> X ) >> >>> WRITE(3,100) >> >>> GO TO 1 >> >>> 99 CONTINUE >> >>> END I just had to test with g77. With -ff66 it says mrr(a)pilt tmp]$ cat ff.f PROGRAM TESTHOL 10 READ (5,100,END=20) WRITE (6,100) GO TO 10 20 STOP 100 FORMAT (80H & ) END [mrr(a)pilt tmp]$ g77 -ff66 ff.f -o ff [mrr(a)pilt tmp]$ ./ff foo foo bar bar [mrr(a)pilt tmp]$ Works with -ff77 and -ff90 as well. It just proves that sometimes old dogs can learn new tricks. -- mrr
From: Andrew Swallow on 25 Oct 2006 13:48 Rostyslaw J. Lewyckyj wrote: > Andrew Swallow wrote: > >> Morten Reistad wrote: >> >>> In article <1685.523T2487T6125896(a)kltpzyxm.invalid>, >>> Charlie Gibbs <cgibbs(a)kltpzyxm.invalid> wrote: >>> >>>> In article <FXj%g.7851$Fd7.394(a)bignews6.bellsouth.net>, >>>> urjlew(a)bellsouth.net (Rostyslaw J. Lewyckyj) writes: >>>> >>>>> Where were you at? I thought that our i/o charges for print lines were >>>>> consistant at UNC-CH. So you shouldn't have been charged a whole lot >>>>> different. Anyway you should have been able to run your deck through >>>>> PLC (Cornell PL/I dialect, debugging compiler. Sort of equivalent to >>>>> WATFOR/WATFIV for Fortran, but not as well developed) for about the >>>>> same charge. >>>>> >>>>> For funsies, the program >>>>> 1 READ(1,100,END=99) >>>>> 100 FORMAT(' ',80H >>>>> X ) >>>>> WRITE(3,100) >>>>> GO TO 1 >>>>> 99 CONTINUE >>>>> END >>>>> should list your deck handily. At least it used to work. >>> >>> >>> That would give you a nice, blank deck. Never trust programs >>> posted on the Internet ;-) >> >> >> The original Fortran did not have Character variables. The >> data could be stored in an array of 80 Integers using 80A1 > > > 80A1 :) Man can you think of a way to pessimise the program some > more? Probably you'd also recommend > DIMENSION IA(80) > 1 READ 100,(IA(I),I=1,80) > 100 FORMAT(80A1) > etc. :) > rather than READ 100,IA :), or choosing a variable type > that would hold the largest number of characters and use an array > of those type variables. :) Anything over A2 was not machine independent. A1 allowed the integer array to pretend to be a string variable. >> >> format or in the actual Format statement. If you read character >> data in using H format the actual H statement is corrupted/over >> written. The program works by a trick > > > That was no TRICK. It is a perfectly valid use of the language > definition. The ability to read into the hollerith item of a FORMAT > statement was provided for flexible headings. > > > > but I strongly recommend >> you rewrite it to avoid self modifying code. >> > Then are you against execution time assembling of FORMAT statements > as well? OR even reading in FORMAT statements as was a common > technique in the BMD and other statistical package programs? >>> >>> First, you need somewhere to store what you read; >>> add >>> CHARACTER*80 FOO >>> to the top. >>> >>> Then add FOO to the end of the READ and WRITE statements. >>> And change the format to >>> 100 FORMAT(' ',A80) >> >> >
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: #define in fortran Next: How to decide using COMMON block variables or function/subroutine parameters? |