home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!rutgers!cmcl2!sbcs.sunysb.edu!engws8.ic.sunysb.edu!mlubran
- From: mlubran@engws8.ic.sunysb.edu
- Newsgroups: comp.lang.fortran
- Subject: Upgrading obsolete code
- Keywords: FORTRAN,DECODE,UPGRADE,HOLLERITH
- Message-ID: <1992Sep4.202958.29575@sbcs.sunysb.edu>
- Date: 4 Sep 92 20:29:58 GMT
- Article-I.D.: sbcs.1992Sep4.202958.29575
- Sender: usenet@sbcs.sunysb.edu (Usenet poster)
- Organization: State University of New York at Stony Brook
- Lines: 59
- Originator: mlubran@engws8.ic.sunysb.edu
- Nntp-Posting-Host: engws8.ic.sunysb.edu
-
-
- I have to find a way to simulate the effect of the DECODE statement,
- because MS-FORTRAN 5.0 does not seem to support it. A sample of what
- I need would resemble something like this...
-
-
-
- * MAIN
- IER=1
- CALL TEST(IER,6HMYSUB )
- END
- *******************************************
- SUBROUTINE TEST(IER,NAME)
-
- INTEGER IER,NAME(1)
- INTEGER STRING(6)
-
- CALL UNPACK(NAME,6,STRING)
-
- PRINT *,'ERROR #',IER,'DETECTED IN ROUTINE ',STRING
-
- RETURN
- END
- ********************************************
- SUBROUTINE UNPACK(NAME,I,NAM)
-
- INTEGER I,NAME(1),NAM(1)
-
- * NOTE: MAX CHARS IS 129
-
- DECODE (I,150,NAME) (NAM(J),J=1,I)
- 150 FORMAT (129A1)
-
- RETURN
- END
-
-
-
- THE RESULT SHOULD BE:
-
- ERROR # 1 DETECTED IN ROUTINE MYSUB
-
-
-
-
- VMS AND UNIX LOVE THIS KIND OF STUFF, BUT MY PC
- SEEMS TO REGARD THIS AS COMPLETELY OBSOLETE!!!
-
- Is there a way to make UNPACK work without the DECODE??
- If not, can anyone suggest a compiler for a PC which
- can handle this?? (preferably by anonymous ftp)
-
- BTW, I would re-write this to use CHARACTER variables,
- but UNPACK is called by far too many other routines
-
- Any and all assisstance will be appreciated.
-
-
- M. Lubrano
-