home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21605 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.3 KB  |  65 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!ulowell!woods.ulowell.edu!sabotkap
  3. From: sabotkap@woods.ulowell.edu
  4. Subject: Re: mailboxes with DCL?
  5. Message-ID: <1993Jan21.021820.1@woods.ulowell.edu>
  6. Lines: 53
  7. Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
  8. Organization: University of Lowell
  9. References: <1993Jan21.032056.373@wega.rz.uni-ulm.de>
  10. Date: Thu, 21 Jan 1993 07:18:20 GMT
  11.  
  12. ORAKEL@rzmain.rz.uni-ulm.de (Framstag) requests:
  13. ->  
  14. ->  Some (easy, of course :-) ) examples of DCL programs handling with
  15. ->  mailboxes with normal user privs (netmbx,tmpmbx).
  16. ->  
  17.  
  18. The following hack DCL procedure opens a channel to the mailbox created
  19. during a SPAWN, and keeps it open after the subprocess terminates.  
  20. Note that processes reading/writing this mailbox could very easily end up
  21. hung waiting for the other processes' read/write, if the command procedures
  22. you are using to do the communications are not synchronized.  Also, you 
  23. will not be able to set the buffer size, protection mask, or other flags.
  24. All attributes of the mailbox are initialized when it is created via a 
  25. SPAWN.  
  26.    
  27. ^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v^-v-^
  28. Pete Sabotka, Meteorology Dept.                   sabotkap@woods.ulowell.edu
  29. University of Massachusetts - Lowell      
  30. "Days like this let you savor a bad mood."        - Calvin (Calvin & Hobbes)
  31. ^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v-^-v^-v-^
  32. $!    CREMBX.COM
  33. $!    Creates a mailbox for DCL use
  34. $!
  35. $!    parameters:  p1 - logical name to open for mailbox
  36. $!    
  37. $ if p1 .eqs. "SUB" then goto subprocess
  38. $Mainprocess:
  39. $ channel=p1
  40. $ if channel .eqs. "" then read sys$command channel/end=done/prompt="_Log name: "
  41. $ if channel .eqs. "" then goto Mainprocess
  42. $ program=f$environment("procedure")
  43. $ parent_pid=f$getjpi(0,"pid")
  44. $ spawn/nolog/nowait @'program' SUB 'parent_pid'
  45. $ set process/suspend/id=0
  46. $ spawn_pid=f$trnlog("SPAWN_PID")
  47. $ mbxnum=f$trnlog("MBXNUM")
  48. $ mailbox="MBA''mbxnum':"
  49. $ open/read/write 'channel' 'mailbox'
  50. $ stop/id='spawn_pid'
  51. $ deassign/job SPAWN_PID
  52. $ deassign/job MBXNUM
  53. $ w "Mailbox device ''mailbox' opened"
  54. $Done:
  55. $ exit
  56. $Subprocess:
  57. $ spawn_pid=f$getjpi(0,"pid")
  58. $ if p2 .nes. "" then resume_pid=p2
  59. $ mbxnum=f$getjpi(0,"TMBU")
  60. $ define/job/nolog SPAWN_PID 'spawn_pid'
  61. $ define/job/nolog MBXNUM 'mbxnum'
  62. $ set process/resume/id='resume_pid'
  63. $ set process/suspend/id=0
  64.  
  65.