From: MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 24-JAN-1993 18:25:11.64 To: info-vax@kl.sri.com CC: Subj: Re: Please explain SUBMIT action. In article <1993Jan22.161212.1@woods.ulowell.edu>, welchb@woods.ulowell.edu writes: = I am used to the fact that I often have trouble with submitting =jobs. In particular, if the job creates a file, and if the execution =time is lengthy, I often try to look at the log file, or the file being =created (with TYPE, DUMP, EDIT) with no luck; the file is locked by =another user. Are you sure you were looking at the log file, and not another file being created by the batch job? You see, the batch job log file is automatically created with read sharing allowed, and is automatically flushed periodically (once per minute by default; type the command HELP SET OUTPUT_RATE for details). Also, files created as the primary output files for process created with a command like: $ SPAWN/INPUT=inpfile/OUTPUT=outfile where both inpfile and outfile are non-terminal devices will be so created and so flushed. Files explicitly created by your program, however, will NOT be flushed automatically, nor will they necessarily be created with read sharing enabled. If you fopen() a file with "w" access via VAX C, read sharing is automatically enabled from C. To OPEN a file shared in FORTRAN, you need to specify the SHARED keyword in the OPEN statement. To flush a file in FORTRAN, use a statement of the form: CALL SYS$FLUSH(%VAL(FOR$RAB(lun))) where "lun" is the logical unit number associated with the file you want to flush. To flush a file opened via the VAX C RTL, you need to use both fflush() and fsync(). Either: FILE *fp; fp = fopen("test.dat", "w"); ... fflush(fp); fsync(fileno(fp)); Or: FILE *fp; int fd; fd = open(file_spec, flags, mode); ... fp = fdopen(fd, "w"); ... fflush(fp); fsync(fd); -------------------------------------------------------------------------------- Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My understanding of astronomy is purely at the amateur level (or below). So unless what I'm saying is directly related to VAX/VMS, don't hold me or my organization responsible for it. If it IS related to VAX/VMS, you can try to hold me responsible for it, but my organization had nothing to do with it.