Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!necntc!husc6!ut-sally!utah-cs!BEEBE@SCIENCE From: BEEBE%SCIENCE@utah-cs.UUCP Newsgroups: comp.lang.fortran Subject: Re: Problem with substrings Message-ID: <12307606178.24.BEEBE@SCIENCE.UTAH.EDU> Date: Wed, 3-Jun-87 14:59:57 EDT Article-I.D.: SCIENCE.12307606178.24.BEEBE Posted: Wed Jun 3 14:59:57 1987 Date-Received: Sat, 6-Jun-87 03:52:33 EDT Lines: 26 In-Reply-To: <286@nikhefh.UUCP> X-Us-Mail: "Center for Scientific Computation, South Physics, University of Utah, Salt Lake City, UT 84112" X-Telephone: (801) 581-5254 >> CHARACTER*10 CH, STR >> >> STR = 'ABCDEFGHIJ' >> I = 6 >> NC = 0 >> CH = 'FOO'//STR(I:I+NC-1)//'BAR' >> >> My results are 1) VAX/VMS FORTRAN: CH = 'FOOBAR' >> 2) Gould UTX32 f77: CH = 'FOOBAR' >> 3) Apollo FTN : CH = 'FOOFGHIJ..' CRASH!!! Section 5.7.1 of ANSI X3.9-1978 FORTRAN 77 discusses substring expressions: CHARACTER*n S S(e1:e2) It is a REQUIREMENT that 1 <= e1 <= e2 <= n; in your example, you have e2 = e1-1, which is illegal. Presumably a run-time system should detect this error. I tried such an example on the DEC-20 (TOPS-20), and it gives a run-time error "?Illegal length for character expression". -------