1820661 Members
2427 Online
109626 Solutions
New Discussion юеВ

DIR / OUT.. append?

 
SOLVED
Go to solution
Martin Slimmer
Advisor

DIR / OUT.. append?

Hello -

I want to perform a DIR/OUT=filename.dat command to send the results to a specific file multiple times. However, rather than versioning the "out" file, I want to APPEND to it, so that my results from 2:00, 3:00, 4:00, etc. are all in the same file, same version -- so instead of filename.dat;1, filename.dat;2, filename.dat;3, I only have filename.dat;1, even though I have issued the DIR/OUT command three times.

Is there an easy syntax to do this?

Thanks,
~ Martin
6 REPLIES 6
Hein van den Heuvel
Honored Contributor

Re: DIR / OUT.. append?



I would recommend a process permanent file for this:

$ crea dir.out ! Make it a 'normal' file.
$ open/appen dir_out dir.out ! Use it
$ dir/out=dir_out *.c
$ dir/out=dir_out *.com
$ close dir_out ! Lose it
$ type dir_out ! Show it.

You can repeat this as often as you like:

$OPEN/APPEN x file
$action/out=x
$CLOS x

hth,
Hein van den Heuvel

Hein van den Heuvel
Honored Contributor
Solution

Re: DIR / OUT.. append?


Oops too quick. Meant to add that you can also readily interject the command output with DCL script text:

$ open/appen dir_out dir.out
$ write dir_out ""
$ write dir_out "--- Directory Output for ''F$time()' ---"
$ dir /out=dir_out ...
$ close dir_out


Hein.
Robert Gezelter
Honored Contributor

Re: DIR / OUT.. append?

Martin,

I agree with Hein.

Open a process permanent file (using the DCL OPEN command).

Use that filename as the value of the /OUTPUT qualifier.

When you are finished, use the CLOSE command to close the file.

- Bob Gezelter, http://www.rlgsc.com
Martin Slimmer
Advisor

Re: DIR / OUT.. append?

Thanks -- your two answers are what I was looking for!

~ Martin
John Gillings
Honored Contributor

Re: DIR / OUT.. append?

Martin,

If you want a "one liner" that avoids the OPEN and CLOSE, you can use the PIPE command:

$ DIR/OUT=filename.dat something
$ PIPE DIR something-else | APPEND SYS$PIPE: filename.dat

(somewhat odd that they implemented ">" I/O redirection in PIPE but not ">>", which would have done exactly what you wanted)
A crucible of informative mistakes
Jon Pinkley
Honored Contributor

Re: DIR / OUT.. append?

Because sys$output is a process permanent file, the following also causes the output from multiple runs of directory to be appended to the same file.

$ define sys$output filename.dat
$ dir z.*
$ dir a.*
$ deassign sys$output

When you aren't expecting the files to be appended, it can be confusing.

For your example, Hein's solution is better, since you may have a lot of other output going to sys$output that you do not want in the same file as the directory output.

Jon

it depends