home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21806 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  2.7 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL
  2. From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: Please explain SUBMIT action.
  5. Date: 23 Jan 1993 01:27:13 GMT
  6. Organization: HST Wide Field/Planetary Camera
  7. Lines: 49
  8. Distribution: world
  9. Message-ID: <1jq6tiINNlh9@gap.caltech.edu>
  10. References: <1993Jan22.161212.1@woods.ulowell.edu>
  11. Reply-To: carl@SOL1.GPS.CALTECH.EDU
  12. NNTP-Posting-Host: sol1.gps.caltech.edu
  13.  
  14. In article <1993Jan22.161212.1@woods.ulowell.edu>, welchb@woods.ulowell.edu writes:
  15. =    I am used to the fact that I often have trouble with submitting
  16. =jobs.  In particular, if the job creates a file, and if the execution
  17. =time is lengthy, I often try to look at the log file, or the file being
  18. =created (with TYPE, DUMP, EDIT) with no luck; the file is locked by
  19. =another user.
  20.  
  21. Are you sure you were looking at the log file, and not another file being
  22. created by the batch job?  You see, the batch job log file is automatically
  23. created with read sharing allowed, and is automatically flushed periodically
  24. (once per minute by default; type the command HELP SET OUTPUT_RATE for details).
  25. Also, files created as the primary output files for process created with a
  26. command like:
  27.     $ SPAWN/INPUT=inpfile/OUTPUT=outfile
  28. where both inpfile and outfile are non-terminal devices will be so created and
  29. so flushed.
  30.  
  31. Files explicitly created by your program, however, will NOT be flushed
  32. automatically, nor will they necessarily be created with read sharing enabled.
  33. If you fopen() a file with "w" access via VAX C, read sharing is automatically
  34. enabled from C.  To OPEN a file shared in FORTRAN, you need to specify the
  35. SHARED keyword in the OPEN statement.  To flush a file in FORTRAN, use a
  36. statement of the form:
  37.     CALL SYS$FLUSH(%VAL(FOR$RAB(lun)))
  38. where "lun" is the logical unit number associated with the file you want to
  39. flush.  To flush a file opened via the VAX C RTL, you need to use both fflush()
  40. and fsync(). Either:
  41.     FILE *fp;
  42.  
  43.     fp = fopen("test.dat", "w");
  44.         ...
  45.     fflush(fp); fsync(fileno(fp));
  46. Or:
  47.     FILE *fp;
  48.     int fd;
  49.  
  50.     fd = open(file_spec, flags, mode);
  51.         ...
  52.     fp = fdopen(fd, "w");
  53.         ...
  54.     fflush(fp); fsync(fd);
  55. --------------------------------------------------------------------------------
  56. Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
  57.  
  58. Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
  59. understanding of astronomy is purely at the amateur level (or below).  So
  60. unless what I'm saying is directly related to VAX/VMS, don't hold me or my
  61. organization responsible for it.  If it IS related to VAX/VMS, you can try to
  62. hold me responsible for it, but my organization had nothing to do with it.
  63.