home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3435 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.7 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!rutgers!cmcl2!sbcs.sunysb.edu!engws8.ic.sunysb.edu!mlubran
  2. From: mlubran@engws8.ic.sunysb.edu
  3. Newsgroups: comp.lang.fortran
  4. Subject: Upgrading obsolete code
  5. Keywords: FORTRAN,DECODE,UPGRADE,HOLLERITH
  6. Message-ID: <1992Sep4.202958.29575@sbcs.sunysb.edu>
  7. Date: 4 Sep 92 20:29:58 GMT
  8. Article-I.D.: sbcs.1992Sep4.202958.29575
  9. Sender: usenet@sbcs.sunysb.edu (Usenet poster)
  10. Organization: State University of New York at Stony Brook
  11. Lines: 59
  12. Originator: mlubran@engws8.ic.sunysb.edu
  13. Nntp-Posting-Host: engws8.ic.sunysb.edu
  14.  
  15.  
  16. I have to find a way to simulate the effect of the DECODE statement,
  17. because MS-FORTRAN 5.0 does not seem to support it. A sample of what
  18. I need would resemble something like this...
  19.  
  20.  
  21.  
  22. *      MAIN
  23.        IER=1
  24.        CALL TEST(IER,6HMYSUB )
  25.        END
  26. *******************************************
  27.        SUBROUTINE TEST(IER,NAME)
  28.  
  29.        INTEGER IER,NAME(1)
  30.        INTEGER STRING(6)
  31.  
  32.        CALL UNPACK(NAME,6,STRING)
  33.  
  34.        PRINT *,'ERROR #',IER,'DETECTED IN ROUTINE ',STRING
  35.  
  36.        RETURN
  37.        END
  38. ********************************************
  39.        SUBROUTINE UNPACK(NAME,I,NAM)
  40.  
  41.        INTEGER I,NAME(1),NAM(1)
  42.  
  43. * NOTE: MAX CHARS IS 129
  44.  
  45.        DECODE (I,150,NAME) (NAM(J),J=1,I)
  46. 150    FORMAT (129A1)
  47.  
  48.        RETURN
  49.        END
  50.  
  51.  
  52.  
  53. THE RESULT SHOULD BE:
  54.  
  55. ERROR # 1 DETECTED IN ROUTINE MYSUB
  56.  
  57.  
  58.  
  59.  
  60. VMS AND UNIX LOVE THIS KIND OF STUFF, BUT MY PC
  61. SEEMS TO REGARD THIS AS COMPLETELY OBSOLETE!!!
  62.  
  63. Is there a way to make UNPACK work without the DECODE??
  64. If not, can anyone suggest a compiler for a PC which
  65. can handle this?? (preferably by anonymous ftp)
  66.  
  67. BTW,   I would re-write this to use CHARACTER variables,
  68.        but UNPACK is called by far too many other routines
  69.  
  70. Any and all assisstance will be appreciated.
  71.  
  72.  
  73. M. Lubrano
  74.