From: MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 9-JUL-1992 04:58:22.20 To: info-vax@cdclu1.genrad.com CC: DONGRAY@cdclu1.genrad.com Subj: Re: Utility for chronological directory in DCL? > I am looking for a DCL utility that would produce a file > directory in chronological order, something akin to the "ls -lt" command > in Unix. I have tried the SORT command already but I run into trouble > trying to sort the month field. Why the heck didn't they put the month > names in alphabetical order anyways...???!!! > > Any help will be greatly appreciated. Thank you, in advance. [...] > khan@us17501.mdc.com The DIRECTORY command is actually one of the one that are well-behaved when it comes to date/time formats. If you've executed SYS$STARTUP:LIB$DT_STARTUP.COM then there is a logical names table called LNM$DT_FORMAT_TABLE containing the predefined date/time formats. The one used is specified by the logical LIB$DT_FORMAT. It has default value LIB$DATE_FORMAT_001,LIB$TIME_FORMAT_001. These pair of logicals translate to "!DB-!MAAU-!Y4" and !H04:!M0:!S0.!C2". If you look at the definitions, you'll find that LIB$DATE_FORMAT_036 is "!Y4/!MN0/!D0" and LIB$DATE_FORMAT_037 is "!Y4-!MN0-!D0". Using either of these, you can get the DIR command to produce an output that is easy to sort. $ dir/dat login.com Directory U$E:[DONGRAY] LOGIN.COM;20 28-MAY-1992 18:26:43.49 Total of 1 file. $ def lib$dt_format lib$date_format_037,lib$time_format_001 $ dir/dat login.com Directory U$E:[DONGRAY] LOGIN.COM;20 1992-05-28 18:26:43.49 Total of 1 file. Alternatively, this can be used just to give a prettier output. $ def lib$dt_format lib$date_format_006,lib$time_format_011 $ dir/dat login.com Directory U$E:[DONGRAY] LOGIN.COM;20 28 MAY 92 06:26 PM Total of 1 file. Or, with enough privilege, you can go totally over the top ... $ def/tab=lnm$dt_format_table/exec lib$date_format_501 "!WC !DD !MAC !Y4" $ def/tab=lnm$dt_format_table/exec lib$time_format_501 - "!MM minutes and !SS seconds past !HH2 !MIL" $ def lib$dt_format lib$date_format_501,lib$time_format_501 $ dir/dat login.com Directory U$E:[DONGRAY] LOGIN.COM;20 Thursday 28 May 1992 26 minutes and 43 seconds past 6 pm Total of 1 file. Perhaps this is getting silly ... :-). -------------------------------------------------------------------------------- Name : Derek Dongray, Systems Manager, GenRad Ltd. Phone : 061 486 1511 ext 166 PSS : 234261600119::Dongray UKnet : Derek.Dongray@GenRad.co.uk InterNet : Dongray@cdclu1.GenRad.com CompuServe : 70374,2745 Address : Monmouth House, Monmouth Road, Cheadle Hulme, Cheshire, SK8 7AY, UK.