Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucsd!rutgers!modus!otello!gear!cadlab!martelli From: martelli@cadlab.sublink.ORG (Alex Martelli) Newsgroups: comp.lang.fortran Subject: Re: INDEX() and "_" in FORTRAN 77 under SUN 4.1 OS Message-ID: <890@cadlab.sublink.ORG> Date: 4 Jun 91 08:15:26 GMT References: <1991May31.141830.10778@xn.ll.mit.edu> Organization: CAD.LAB, Bologna, Italia Lines: 45 delaney@xn.ll.mit.edu (John R. Delaney) writes: :A colleague has run into an apparent inconsistency in the way the :underscore character is handled in the FORTRAN 77 which came with SUN's 4.1 :OS. That character is acceptable in variable names and can be printed out :if in a string. But the INDEX function acts as if it wasn't there in the :same strings. : :Is this a well-know problem or are we experiencing some sort of local :quirk? I think you are experiencing *several* quirks... first, no Fortran 77 compiler comes with SunOs 4.1 - Sun Fortran is an "unbundled" program, to be purchased separately. It would thus be necessary to know about f77's version number - use 'f77 -V source.f' to see version id's for each compiler pass. With what we have, which identifies itself as version 1.3.1, this program: PROGRAM PROI * CALL INDEX_CHECK('FIRST_STRING', 'STST') CALL INDEX_CHECK('FIRST_STRING', 'ST_ST') CALL INDEX_CHECK('SECOND STRING', 'ND ST') CALL INDEX_CHECK('SECOND STRING', 'ND_ST') STOP END SUBROUTINE INDEX_CHECK(HAYSTACK, NEEDLE) CHARACTER*(*) HAYSTACK,NEEDLE WRITE(*,*) 'INDEX(',HAYSTACK,',',NEEDLE,')=', . INDEX(HAYSTACK,NEEDLE) RETURN END gives the following, expected output: INDEX(FIRST_STRING,STST)= 0 INDEX(FIRST_STRING,ST_ST)= 4 INDEX(SECOND STRING,ND ST)= 5 INDEX(SECOND STRING,ND_ST)= 0 Thus, in no sense does INDEX() "act is if [the underline] wasn't there". What does this program output for you? What release does -V tell you that you have? I suspect that you may have misanalized your problem... -- Alex Martelli - CAD.LAB s.p.a., v. Stalingrado 53, Bologna, Italia Email: (work:) martelli@cadlab.sublink.org, (home:) alex@am.sublink.org Phone: (work:) ++39 (51) 371099, (home:) ++39 (51) 250434; Fax: ++39 (51) 366964 (work only), Fidonet: 332/407.314 (home only).