Operating System - OpenVMS
1748093 Members
6094 Online
108758 Solutions
New Discussion юеВ

Re: UNIX procedure equivalent in OVMS?

 
SOLVED
Go to solution
Andrew Yip
Advisor

Re: UNIX procedure equivalent in OVMS?

Thanks! Your ideas work well!

Jpe,

Your method works faster than having to use the f$search and IF-THEN-ELSE statements.

By the way, how do i append my next output when applying the define method?

E.g:

DEFINE SYS$OUTPUT test.log
show time
DEASSIGN SYS$OUTPUT
Uwe Zessin
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

That's not possible, I think, but:

$ define sys$output time.tmp
$ show time
$ deassign sys$output
$ append time.tmp test.log
%APPEND-W-INCOMPAT, USER_1:[ZESSIN]TIME.TMP;1 (input) and USER_1:[ZESSIN]TEST.LOG;1 (output) have incompatible attributes
$ delete time.tmp;
$ type test.log
abc
___5-DEC-2005 07:55:59
$


Another idea:

$ open /append t_log test.log
$ write t_log " "+f$cvtime(f$time(),"absolute")
$ close t_log
$ type test.log
abc
___5-DEC-2005 07:55:59
__5-DEC-2005 07:59:51.50
$

(I have replaced the leading spaces in the file output with underscores "_" to better illustrate the difference, because ITRC eats spaces :-(
.
Joseph Huber_1
Honored Contributor

Re: UNIX procedure equivalent in OVMS?


Your method works faster than having to use the f$search and IF-THEN-ELSE statements.


Although it has nothing to do with the original question,
but this statement sounds unjustified.

Writing the output of a command to a file, then reading it is clumpsy as long as there is an equivalent function built into DCL like in this case DIRECTORY/OUTPUT vs. f$search.

And why creating a file,invoking an image, opening and reading a file should be faster than DCL-internal directory search is beyond my imagination.

Could You explain how You measured it being faster ?

Directory output to a file is IMHO only needed, if some /EXCLUDE or other criteria can't be achieved easily inside DCL, or if the file list has to be sorted somehow.
http://www.mpp.mpg.de/~huber
Karl Rohwedder
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Joseph,

I've just compared a simple F$SEARCH loop finding 200 files with a DIR /OUT and reading its output: the DIR solution is faster:

- is uses less CPU and elapsed time and BufIO
- is needs more hard faults and DirIO

Normally I would prefer the DCL F$SEARCH solution, because you are not dependant on the format of the DIR output.

regards Kalle
Jan van den Ende
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Kalle,


- is uses less CPU and elapsed time and BufIO
- is needs more hard faults and DirIO


Remove Elapsed Time from these lines, and it means, that the amouts of Elapsed Time are configuration-dependant. Much CPU power and Memory favors the DIR solution, good Caching and fast disk IO favors the F$SEARCH.

-- although whenever possible a personally favor lexical function solutions over output-parsing!

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Joseph Huber_1
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Interesting !
I made tests with my slowest and fastest CPUs, and it seems that only for short (few hundreds) number of files DIRECT/output wins. In all other cases f$search loops are faster, and gain with the number of files.
Seems that f$search has a bigger 'pedestal' at initialization.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: UNIX procedure equivalent in OVMS?


And one additional note on the differences:

DIRECTORY lists ALIAS files/directories,
f$search does not return aliases !

So it may well make a difference wether the list of files is for processing or e.g. for delete/remove.
http://www.mpp.mpg.de/~huber
Uwe Zessin
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Can't speak for VAX, but on OpenVMS Alpha V7.3-2 it lists aliases - no matter if the primary entry is in the same or a different directory.
.
Joseph Huber_1
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Maybe I was a bit unclear:
if You explicitely do f$search("[.dir]*.*"), then yes, it returns files wether being aliases of some files in other directories.
But say You have [.a] and [.b] being an alias directory of [.a], then f$search [...]*.* returns the files only once, not the files in [.b].
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: UNIX procedure equivalent in OVMS?

Sorry , forget my previous statement.
Uwe is right, I had by chance exactly as many files to purge as I had aliases resulting in the same difference of number of files between
f$search() and DIRECTORY.

So not the alias behaviour is different, but

f$search("*.*") is not the same as
directory *.*

the directory command defaults to version ";*" if not explicitely version 0 (";" or ";0") is specified, while f$search("*.*") returns only the highest version.
http://www.mpp.mpg.de/~huber