home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / vms / 14360 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  5.0 KB

  1. Path: sparky!uunet!olivea!decwrl!concert!ais.com!bruce
  2. From: bruce@ais.com (Bruce C. Wright)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: at the risk of drawing severe flamage - q's about VMS/DCL & Unix
  5. Message-ID: <1992Aug31.110413.5741@ais.com>
  6. Date: 31 Aug 92 11:04:12 GMT
  7. References: <1992Aug31.094150.584@glas.rtsg.mot.com>
  8. Organization: Applied Information Systems, Chapel Hill, NC
  9. Lines: 88
  10.  
  11. In article <1992Aug31.094150.584@glas.rtsg.mot.com>, waider@glas.rtsg.mot.com (Ronan Waide) writes:
  12. > Hi all,
  13. > I'm currently working with a Unix system and will soon be returning (after
  14. > Christmas) to a VAX 8350 (8530??) running VMS 5.3 ish. What I want to know
  15. > is if the vanilla VMS comes with any feature resembling a Unix pipe? To any
  16. > who may be unfamiliar with the concept, it's a means of connecting the output
  17. > of one program/command directly to another so for instance, you could run a
  18. > file through sort to sort it and then put the output through a program to
  19. > throw away doubles; on Unix, this is simply a matter of piping sort's output
  20. > to the input of the second prog, while the only way I'm aware of on VMS to do
  21. > this would by to /OUTPUT=SYS$SCRATCH:TEMPFILE and then read TEMPFILE into the
  22. > next program.
  23. > <<<<<Now donning NOMEX underwear in anticipation of flamage ;-7 >>>>>
  24.  
  25. Not sure why you're afraid of flamage;  that seems like a reasonable
  26. question.
  27.  
  28. There are several ways this kind of facility can be accomplished on
  29. VMS.  They all have some advantages and disadvantages.
  30.  
  31.     1)    You can use mailboxes.  This is the usual VMS interprocess
  32.     communications mechanism;  for many purposes this is exactly
  33.     what you want.  The problem is that it is not "exactly" a
  34.     Unix pipe, you give it "records" rather than "streams of bytes";
  35.     this causes problems with programs that want to read their input
  36.     as a stream of bytes because each "read" operation from the
  37.     mailbox wants to read the entire "record" that had been written.
  38.     If you control the program's use of the mailbox this isn't a
  39.     problem because you can always write a low-level routine that
  40.     hides this implementation from the high-level code, but if
  41.     you're trying to use a program from elsewhere (DEC for example),
  42.     it may or may not work the way you'd expect.  Mailboxes are
  43.     usually one-way;  although the "consumer" program can write
  44.     to its input mailbox this just has the effect of sending the
  45.     data right back to itself.
  46.  
  47.     2)    The older style pseudo-terminal driver (versions available from
  48.     DECUS and from DEC with older versions of DECwindows).  This
  49.     mechanism has two drivers, a "producer" driver (PYDRIVER) and a
  50.     "consumer" driver (TWDRIVER) that implement a two-way terminal-
  51.     like connection between two programs.  Unlike pipes and mailboxes,
  52.     this is an effective two-way connection;  this may or may not be
  53.     desirable for your application.  It's very easy to use, and can
  54.     be used very nicely to do things like create virtual terminal
  55.     sessions and the like.
  56.  
  57.     3)    The newer style pseudo-terminal driver found with newer versions
  58.     of DECwindows.  This uses the FTDRIVER, which is somewhat more
  59.     difficult to use (from the "producer" side, not the "consumer"
  60.     side, which still just sees a "normal" terminal connection) than
  61.     the TWDRIVER/PYDRIVER combination, but on the other hand is more
  62.     efficient.
  63.  
  64.     4)    You can also use the DECnet task-to-task mechanism.  This is
  65.     sort of like a two-way mailbox in that both programs can read
  66.     and write to each other in the expected way, but the interaction
  67.     is record-oriented like a mailbox rather than byte-oriented like
  68.     a pseudo-terminal.
  69.  
  70. There isn't a very pretty command-line interface to these facilities
  71. in standard DCL like there is in the Unix shell - most people use the
  72. mechanism you described with /OUTPUT=tempfile and then starting the
  73. next program with /INPUT=tempfile (or however the respective programs
  74. support I/O redirection;  often they'll allow redirecting SYS$OUTPUT and
  75. SYS$INPUT which is conceptually more like the way it's done on Unix
  76. although the syntax is much wordier).
  77.  
  78. But there are programs around that will allow you to use the |, >, and <
  79. characters to do this like you can on Unix - you can get VMS Posix or
  80. the DECUS software tools (see the DECUS library posting I put on here
  81. a few days ago).  The down side to it is that processes on VMS are very
  82. "heavyweight" compared to processes on Unix, and have much more context
  83. that needs to be copied -- therefore this use of pipes is much less CPU
  84. efficient than it is on Unix.  (The usual VMS way to chain programs
  85. together is to use dynamic linking, and call in a new image into the
  86. _same_ process either as a subroutine or to replace the current image.
  87. This is very efficient, even more so than forking a new process on Unix,
  88. but less flexible - the called image often has to be aware that it might
  89. be called dynamically, and you can't normally do this dynamically from
  90. the command line, only within your program code).
  91.  
  92. That's a quick summary of your possible approaches - you need to look
  93. at the documentation to get the complete story, but this will give you
  94. enough to know where to look & what your choices are -
  95.  
  96. Bruce C. Wright
  97.