fortran question

5 messages 5 people Latest: Nov 27, 2000

fortran question

From: Joern Loetsch Date: November 27, 2000 technical
From: "Joern Loetsch" <jloetsch@stanford.edu> Subject: fortran question Date: Mon, 27 Nov 2000 06:54:24 +0100 Dear NONMEM users, how can one overcome the 80 characters limitation in user written code? I have a statemtnt as follows: " SOME STATEMENT " ABCDEFGHI " MORE CODE I need the line ABCDEFGHI longer than 80 characters. How do I tell the compiler that a second line belongs to the same statement? Thank you in advance Jorn Lotsch _______________________________________________________ Joern Loetsch, MD pharmazentrum frankfurt Department of Clinical Pharmacology J.W.Goethe-University Frankfurt/Main Theodor-Stern-Kai 7 D-60590 Frankfurt/Main, Germany Phone: +49-69-6301-4589 Fax: +49-69-6301-7617

Re: fortran question

From: Pierre Maitre Date: November 27, 2000 technical
From: Pierre Maitre <maitre@cdg.ch> Subject: Re: fortran question Date: Mon, 27 Nov 2000 18:23:55 +0100 Dear Joern In Fortran 77, the fortran statement can be written from column 7 to column 72. Columns 1 to 6 and columns 73 to 80 are reserved. In particular, columns 1 to 5 are reserved for statement numbers, and column 6 is reserved for CONTINUATION CHARACTER. So is you want write a long fortran statement, start your second line by putting a character in columns 6. Any nonblank character - except zero, is ok. Most people put a "*" there. A fortran statement may have several continuation lines if it is too long to fit on one line. Best regards. Pierre Maitre ________________________________________________ Pierre Maitre, M.D. Privat Docent FMH Clinical Pharmacology FMH Anesthesiology CH-1273 Arzier, Switzerland

Re: fortran question

From: Nick Holford Date: November 27, 2000 technical
From: Nick Holford <n.holford@auckland.ac.nz> Subject: Re: fortran question Date: Tue, 28 Nov 2000 08:22:59 +1300 Joern, Here is a working example. It illustrates use of verbatim code to extend a Fortran statement. In this case the line: "E0=E0+ would be illegal if the next verbatim line was not recognized as a continuation line. Note that while the first verbatim line has no preceding blanks the subsequent examples of continuation lines have exactly 5 blanks before the continuation character (I show the use of *, % and & as continuation chars which were acceptable to the Compaq Visual Fortran compiler version 6.5). My example does not change the value of E0 so I was able to check that this gave the same output as I get without the verbatim code. If I code the first verbatim line as: " E0=E0+ i.e. exactly 5 blanks before E0 the compiler uses an error message. So be careful with the number of blanks you put before verbatim code statements. $PROB theophylline pharmacodynamics $DATA theopd.dat IGNORE # $INPUT ID TIME THEO AGE WT GEND RACE DIAG PEFR=DV $ESTIM $COV $THETA (0,150.,) ; E0 $THETA (0,200.,) ; EMAX $THETA (.001,10,) ; EC50 $OMEGA 0.5 ; CVE0 $OMEGA 0.5 ; CVEMAX $OMEGA 0.5 ; CVEC50 $SIGMA 100 ; SD 1 $PRED E0= THETA(1)*EXP(ETA(1)) EMAX=THETA(2)*EXP(ETA(2)) EC50=THETA(3)*EXP(ETA(3)) "E0=E0+ " *0D0+ " %0D0+ " &0D0 Y = E0 + EMAX*THEO/(THEO+EC50) + ERR(1) $TABLE ID TIME E0 NOPRINT ONEHEADER FILE=long.fit A fragment of the generated FSUBS.for showing what happens is here: C A00040 = DERIVATIVE OF EC50 W.R.T. ETA(03) A00040=THETA(03)*B00003 E0=E0+ *0D0+ %0D0+ &0D0 B00004=THEO+EC50 Nick -- Nick Holford, Divn Pharmacology & Clinical Pharmacology University of Auckland, 85 Park Rd, Private Bag 92019, Auckland, New Zealand email:n.holford@auckland.ac.nz tel:+64(9)373-7599x6730 fax:373-7556 http://www.phm.auckland.ac.nz/Staff/NHolford/nholford.htm

Re: fortran question

From: Alison Boeckmann Date: November 27, 2000 technical
From: ABoeckmann <alison@c255.ucsf.edu> Subject: Re: fortran question Date: Mon, 27 Nov 2000 11:30:52 -0800 (PST) Everyone's comments are correct. The rule is docuemented in Guide III and in on-line help, in the entry for verbatim code: Continuation lines If blanks occur in positions 1-5 following the initial " and a non-blank in position 6, this conforms to the usual FORTRAN syn- tax for continuation lines, and the text is not moved from these positions. Example: " X +D/E

Re: fortran question

From: John C Lukas Date: November 27, 2000 technical
From: John C Lukas <johnl@u.washington.edu> Subject: Re: fortran question Date: Mon, 27 Nov 2000 12:09:39 -0800 Joern, Most new compilers will accept any of the symbols & or % in the *sixth* column of your second line. John **************************************************************************** John Lukas, MS, PhD Resource Facility for Population Kinetics (RFPK) Bioengineering, AERL#241 Mail Stop 352255 University of Washington Seattle 98195-2255 phone: +(206) 543 4120 fax: +(206) 543 3081 johnl@u.washington.edu http://tanami.rfpk.washington.edu/ ****************************************************************************