[Info-vax] OpenVMS - DCL - Data entry filtering

David Froble davef at tsoft-inc.com
Fri Mar 27 20:44:48 EDT 2015


Stephen Hoffman wrote:
> On 2015-03-27 21:59:11 +0000, David Froble said:
> 
>> So, you want a unique filename.  This should work in most cases ....
>>
>> $ ! Get date in YYYY-MM-DD format
>> $
>> $ T = f$cvtime(f$time())
>> $
>> $ ! Now convert to YYYYMMDD format
>> $
>> $ YY = f$extract(0,4,T)
>> $ MM = f$extract(5,2,T)
>> $ DD = f$extract(8,2,T)
>> $ HH = f$extract(11,2,T)
>> $ NN = f$extract(14,2,T)
>> $ SS = f$extract(17,2,T)
>> $ XX = f$extract(20,2,T)
>> $
>> $ D = YY + MM + DD + HH + NN + SS + XX
>> $
>> $ write sys$output D
> 
> 
> Shorter version that fetches a unique filename:
> 
> $ d = f$unique()
> 
> Or a longer version, that more closely matches the output of David's DCL:
> 
> $ d = f$edit(f$cvtime(),"COLLAPSE") - "-" - "-" - ":" - ":" - "."
> 
> FWIW, time-based uniqueness tends to fall over within clusters, and 
> around DST change-over.  It's usually a Bad Idea.  Use a UUID/GUID if 
> you have access to one, or use your own index.
> 
> 

Well, the time stamp doesn't have to be without some other stuff ..

Order_Log_YYYYMMDDHHNNSSXX.Log  Helps a bit.  I use it more for a time 
stamp than for uniqueness.

Didn't know about f$unique(), will have to try it.



More information about the Info-vax mailing list