From: briggs@encompasserve.org Sent: Friday, April 12, 2002 11:18 AM To: Info-VAX@Mvb.Saic.Com Subject: Re: Redirect SYS$OUTPUT for detached process In article <2c0966c2.0204120637.5be57503@posting.google.com>, hchen3@uwo.ca (Sammy) writes: ... [write timestamp to newsysoutput.log] [create process] > // all qiow use IO$_WRITEVBLK|IO$M_NOW Why are you using IO$M_NOW? > sys$qiow(write "open/append sys$output newSysOutput.log" to the mailbox) > sys$qiow(write "open/append sys$error newSysError.err" to the mailbox) > > sys$qiow(write "write sys$output "stdout" " to the mailbox) > sys$qiow(write "write sys$error "stderr" " to the mailbox) ... > I have 3 files at the end. > > report.log -> just the regular login info and accouting stuff > > newSysOutput.log;1 -> only the time stamp is here > > newSysError.err;1 -> only the time stamp is here. Oh yeah. That problem. The issue is that the $ OPEN SYS$OUTPUT is a NOOP. The DCL OPEN command silently fails if the logical name specified is already open as a process permanent file. I gave you bad advice when I recommended that you merely OPEN SYS$OUTPUT. You'd have to close it first. Which is difficult to do. Hmmm. How do we get DCL to open SYS$OUTPUT, appending to an existing file. Let's play some games interactively... First try... $ DEFINE SYS$OUTPUT "^ & *" %DCL-E-OPENOUT, error opening ^ & * as output -RMS-F-SYN, file specification syntax error $ SHOW LOG SYS$OUTPUT "SYS$OUTPUT" = "_ALPHA$VTA1215:" (LNM$PROCESS_TABLE) Ok. So you can't close SYS$OUTPUT that way. Second try... $ CLOSE SYS$OUTPUT $ SHOW LOG SYS$OUTPUT "SYS$OUTPUT" = "_ALPHA$VTA1215:" (LNM$PROCESS_TABLE) Nope. You might be able to close it that way, but it automatically re-opens. Third try... $ CREATE your-file.dat time-stamp ^Z $ OPEN Q your-file.dat $ DEFINE SYS$OUTPUT Q $ WRITE SYS$OUTPUT "some text" $ DEASSIGN SYS$OUTPUT $ CLOSE Q $ TYPE your-file.dat time-stamp some text $ *BINGO -- we have a winner* sys$qiow(write "open/append newsysout newSysOutput.log" to the mailbox) sys$qiow(write "define sys$output newsysout" to the mailbox) John Briggs