[Info-vax] date comparison format from a program

VAXman- at SendSpamHere.ORG VAXman- at SendSpamHere.ORG
Mon May 20 15:48:25 EDT 2019


In article <gkg4mkFtnh7U1 at mid.individual.net>, =?UTF-8?Q?g=c3=a9rard_Calliet?= <gerard.calliet at pia-sofer.fr> writes:
>Le 20/05/2019 à 18:14, VAXman- at SendSpamHere.ORG a écrit :
>> In article <gkg09mFspdnU1 at mid.individual.net>, =?UTF-8?Q?g=c3=a9rard_Calliet?= <gerard.calliet at pia-sofer.fr> writes:
>>> Le 20/05/2019 à 16:53, VAXman- at SendSpamHere.ORG a écrit :
>>>> In article <gkfsr0Fs1fbU1 at mid.individual.net>, =?UTF-8?Q?g=c3=a9rard_Calliet?= <gerard.calliet at pia-sofer.fr> writes:
>>>>> Le 20/05/2019 à 16:19, VAXman- at SendSpamHere.ORG a écrit :
>>>>>> In article <gkfoamFr2t2U1 at mid.individual.net>, =?UTF-8?Q?g=c3=a9rard_Calliet?= <gerard.calliet at pia-sofer.fr> writes:
>>>>>>> Hello,
>>>>>>>
>>>>>>> Is there a way to do from a compiled program (in C, for example)
>>>>>>> something as simple as done by the lexical f$cvtime with "comparison"
>>>>>>> parameter in DCL to get date strings which can easyly sorted? Pure VMS
>>>>>>> realm whished.
>>>>>>>
>>>>>>> (I have to write program examples in C with VMS dates format and
>>>>>>> associated routines and compare with RtlC usages).
>>>>>>>
>>>>>>> Gérard Calliet
>>>>>>
>>>>>> SYS$NUMTIM
>>>>>>
>>>>> Thanks. Same question for f$integer, f$string (the simplest solution)
>>>>
>>>> You're looking for the DCL equivalent of expression evaluating and returning
>>>> an integer or string?
>>>>
>>> My question was why using a f$integer, f$string, f$cvtime is so simple
>>> in DCL and why I don't find at the same time something similar and
>>> simple from compiled programs.
>> 
>> Well, there is a great deal of code behind those lexical functions to make
>> them appear so simple.  If you'd supply a simple DCL snippet of that which
>> you want to achieve from a compiled language might help.
>> 
>A stupid snippet:
>
>
>$ time = f$time ()

$ASCTIM with argument <timadr> not specified will return the current time.


>$ comptime = f$cvtime (time)

$NUMTIM passing time as the 64bit VMS time.  CompTime in the <timbuf> array.



>$ sho symb comptime
>$ read/prompt="year " sys$command year
>$ sho symb year
>$ next_year = f$integer (year) + 1

Depends on how 'year" is specified.  If you read it in as an integer value,
you easily add 1 to it.  If you read it in as a string, OTS$CVT_TI_L will
convert to an integer.



>$ next_year_s = f$string (next_year)

I don't know why you would want to convert to a string.  However, use the
OTS$CVT_L_TI to convert if you need to.



>$ write sys$output "next year is : " + next_year_s

This is better accomplished with a little knowledge of $FAO(L). ;)

Yeah, there are C-RTLs which can do this with the bastardized timekeeping
in C (unixy) but those routines all (or mostly) go to the VMS time format
and evaluation routines and services anyway.

-- 
VAXman- A Bored Certified VMS Kernel Mode Hacker    VAXman(at)TMESIS(dot)ORG

I speak to machines with the voice of humanity.



More information about the Info-vax mailing list