home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / vms / 13896 < prev    next >
Encoding:
Text File  |  1992-08-20  |  3.2 KB  |  83 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!gatech!darwin.sura.net!jvnc.net!yale.edu!news.yale.edu!neutron!dcs
  3. From: dcs@neutron.chem.yale.edu (Dave Schweisguth)
  4. Subject: Anyone want to neaten this up? (DCL exercise)
  5. Message-ID: <1992Aug20.200921.122@news.yale.edu>
  6. Sender: news@news.yale.edu (USENET News System)
  7. Nntp-Posting-Host: neutron.chem.yale.edu
  8. Organization: Yale University
  9. X-Newsreader: Tin 1.1 PL4
  10. Date: Thu, 20 Aug 1992 20:09:21 GMT
  11. Lines: 70
  12.  
  13. Hi all,
  14.  
  15. I have here this little FORTRAN data-munging program ("f2a") which reads from
  16. FOR005 and writes to FOR006. I used to use a little script wrapper that did the
  17. assigns and ran the program once and that was that. I just got ambitious and
  18. wrote a new wrapper that deals with wildcards and multiple targets on the
  19. command line. It works fine so far. OTOH, it's awful scruffy-looking and I
  20. would not be at all surprised to find that there are better ways to do some of
  21. these things. Perhaps some of you DCL gurus would find this entertaining.
  22.  
  23. Well, here are some of the things that bother _me_:
  24.  
  25. - If I feed this, say "file.*", meaning to run "f2a" on file.001, file.002,
  26.   etc., I'll get file.001a, file.002a, etc. as output. (Mind you, I do need
  27.   those names.) F$SEARCH will also pick up the output files, so I have to have
  28.   an extra loop where I read all the source file names in before I run "f2a"
  29.   the first time.
  30.  
  31. - If I feed this just "file.001", f$search will spit back the same single
  32.   file over and over, so I have to have this "old_target" check.
  33.  
  34. - The string of F$PARSEs is really ugly. Any way to just delete the version?
  35.  
  36. Note that I can't really test the input files to see if they're legal before
  37. running "f2a", since they're just unformatted binary data and this will be
  38. running in an environment where there will be other unformatted binary files
  39. that will make "f2a" cough up a lung ... thus the "on error" business.
  40.  
  41. OK, here it is:
  42.  
  43. $        pcount = 1
  44. $ ploop: if p'pcount' .eqs. "" then exit
  45. $        targets = 0
  46. $        old_target := none
  47. $ sloop: target = f$search(p'pcount',1)
  48. $        if target .nes. "" .and. target .nes. old_target
  49. $        then
  50. $          targets = targets + 1
  51. $          target'targets' = target
  52. $          old_target = target
  53. $          goto sloop
  54. $        endif
  55. $        tcount = 0
  56. $ tloop: if tcount .lt. targets
  57. $        then
  58. $          tcount = tcount + 1
  59. $          target = target'tcount'
  60. $          targeta = f$parse(target,,,"device") + -
  61.              f$parse(target,,,"directory") + f$parse(target,,,"name") + -
  62.              f$parse(target,,,"type") + "a"
  63. $          assign /nolog 'target' for005
  64. $          assign /nolog 'targeta' for006
  65. $          on error then gosub clean ! can't stop Joe User from feeding in
  66. $          run f2a                   ! a bad file in the first place ...
  67. $          on error then exit
  68. $          goto tloop
  69. $        endif
  70. $        pcount = pcount + 1
  71. $        goto ploop
  72. $ clean: dead_meat = f$search(targeta)
  73. $        if dead_meat .nes. "" then delete 'dead_meat'
  74. $        return
  75.  
  76. Mail would be fine; I'll summarize anything interesting.
  77.  
  78. Cheers,
  79.  
  80. --
  81. | Dave Schweisguth   Yale MB&B & Chemistry   Email: dcs@neutron.chem.yale.edu |
  82. | Lab phone: 203-432-5208      Fax: 203-432-6144     Home phone: 203-624-3866 |
  83.