[Info-vax] DIR/DATE_FORMAT=DELTA ?

Pierre pierre.bru at gmail.com
Mon Jan 9 20:22:57 EST 2012


> The output of the DIRECTORY command is basically the result of a
> F$SEARCH loop.
>
> Asking for times in delta format probably means that this output
> would get parsed afterwards for some kind of processing.
>
> This is a bad habit and should not be done unless unavoidable. Over
> the years, many lexical functions have been added to DCL in order
> to avoid output parsing in most situations. Parsing output files in
> DCL brings man back to Unix programming levels, a thing of the past ;-)
>
> In this case, I would say - forget the DIRECTORY command, do your
> own F$SEARCH loop, use F$FILE_ATTRIBUTES and F$CVTIME to produce
> your list if you need so. And if the list was only needed to be
> processed afterwards, forget about it completely and embed the
> processing directly within the F$SEARCH loop itself.

you are absolutely right, the output will be passed to some afterward
processing : what I do is a super-poor-man, super-lazy monitoring of
some files which should be at most 2 days old. this is done by having
a batch that runs every day around midnight and which main action is:

$ PIPE DIR/DAT/SIZE=UNIT=BYTE somewhere:somefiles | MAIL SYS$PIPE /
SUBJ="MONITORING" "user at host.domain"

but being lazy, I dislike doing the math in my head each and every
day, for each and every line of the mail.
of course, I can (will?) rewrite this one-liner with a DCL loop, a
bunch of calls to F$FILE, F$FAO, F$PARSE, F$UNIQUE, F$TIME, F
$DELTA, ...,  write the result to a temporary file that I will mail
and not forget to delete afterward, but DIR/DAT=(CREATED,FORMAT=DELTA)
would have been handy.

FWIW
Pierre.



More information about the Info-vax mailing list