• Subject: Re: Build Timestamp?
  • From: "Kahn, David" <KAHN@xxxxxxxxxxxxxxxxxx>
  • Date: Sun, 28 Sep 1997 12:51:00 +0600

David Gibbs (david@midrange.com) wrote:

>Ick... I forgot to mention... I'm using ILE RPG.

OK then, David. I'm still feeling my way a bit in RPG/IV, but how about

dDateIso          S               D   datfmt(*iso)
dTodIso           S               T   timfmt(*iso)
dTstp             S               Z

dTimeDS           DS
d  Tod                    1     14  0
d    TodNum               1      6  0
d    DateNum              7     14  0

c                   time                    Tod
c                   move      DateNum       DateIso
c                   move      TodNum        TodIso
c                   move      DateIso       tstp
c                   move      TodIso        tstp

That should do the trick. Now, as to the juggling fields thing I was
talking about before, the Grand Wazir has just realised that he didn't
get it quite right. The format of the date returned by TIME is not
dependent on system values as such: it's the _job's_ date format that
counts. If you know your DATFMT is *YMD the above code will work. If you
don't know that for sure, you will have to retrieve the date format and
juggle accordingly, but this should be more elegant than in OPM. You
could define other date fields in addition to DateIso, each in a
different format, and use the one that fits the retrieved format.

I still prefer the TIME opcode over the user date. Remember that UDATE
does not change over midnight so it will not necessarily contain the
current date. You could get the correct date values for century, year,
month and day separately by retrieving the system values, but you still
have to watch out for the possibility of the date changing between
retrieves of the date and the time.


Dave Kahn - TCO, Tengiz, Kazakstan

e-mail:  kahn@tengizchevroil.com    (until September 30th)
         dkahn@cix.compulink.co.uk  (from  October 1st)
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.