This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
You'll have to format most anything for this specific requirement.  I just
so happened to need the very same process for Emails.  I ended up using a
service program to retrieve a couple of system values, QUTCOFFSET &
QDAYOFWEEK.

- Xlated the day of the week into mixed case.
- Used a Timestamp field for date time info w/ an array for abbreviated
month name.
- Appended all together for your desired result.

Here's some code snippets:
Date Format Code
d UtRtvSysv       PR          2102
d  p_SysVal                     10

d Mos             S              3A   Dim(12) Perrcd(1) CTDATA
d FmtDate         S             30A
d WHrsGMT         S              6A
d SysValTbl       DS
d  SysValue                     10
d  SysValType                    1
d  SysValSts                     1
d  SysValLen                    10i 0
d  SysValChrDta               2080a
d   SysValBinDta                10i 0 Overlay(SysValChrDta)

d RtnSysVals      ds
d  NbrRtnVals                   10i 0 Inz(1)
d  OffSysVals                   10i 0
d  SysValsRtn                 2094

d                 DS
d TimeStamp                       Z   Inz(*Sys)
d  QYear                         4    OVERLAY(TimeStamp)
d  QMonth                        2  0 OVERLAY(TimeStamp : 6)
d  QDay                          2    OVERLAY(TimeStamp : 9)
d  QHour                         2    OVERLAY(TimeStamp : 12)
d  QMinute                       2    OVERLAY(TimeStamp : 15)
d  QSecond                       2    OVERLAY(TimeStamp : 18)
d  QMilli                        3    OVERLAY(TimeStamp : 21)

c                   Eval      SysValue = 'QUTCOFFSET'
c                   Eval      RtnSysVals = UtRtvSysv ( SysValue )
c                   Eval      SysValTbl = %Subst(SysValsRtn : (OffSysVals
c                                       - (%Size(OffSysVals) + 3)))
c                   EvalR     WHrsGMT = %Subst(SysValChrDta: 1 : SysValLen)
c                   Eval      SysValue = 'QDAYOFWEEK'
c                   Eval      RtnSysVals = UtRtvSysv ( SysValue )
c                   Eval      SysValTbl = %Subst(SysValsRtn : (OffSysVals
c                                       - (%Size(OffSysVals) + 3)))
c                   Eval      PDoW = SysValChrDta
c                   Time                    TimeStamp
c                   Eval      WDow = %Subst(PDoW : 2)
c     Up:Lo         XLATE     WDow:2        WDow

c                   Eval      FmtDate = WDow + ', ' + QDay + ' '
c                                     + Mos(Qmonth) + ' ' + QYear + ' '
c                                     + QHour + ':' + QMinute + ':'
c                                     + QSecond + ' ' WHrsGMT

** CTDATA MOS
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

====================
Retrieve System Value Service Program
d UtRtvSysv       PR          2102
d  p_SysVal                     10

P UtRtvSysv       B                   Export
d UtRtvSysv       PI          2102
d  p_SysVal                     10

d QWCRSVAL        PR                  ExtPgm('QWCRSVAL')
d  p_Rcvr                             Like(RtnSysVals)
d  p_RcvrLngth                        Like(RcvrLngth)
d  p_NbrToRtv                         Like(NbrToRtv)
d  p_SysVal                     10
d  p_Error                            Like(Qusec)

d RcvrLngth       s             10i 0 Inz(%Size(RtnSysVals))
d NbrToRtv        s             10i 0 Inz(1)

d RtnSysVals      ds
d  NbrRtnVals                   10i 0 Inz(1)
d  OffSysVals                   10i 0 Inz(%Size(p_SysVal))
d  SysValsRtn                 2094

 /Copy Qsysinc/Qrpglesrc,Qusec
d  QusErrmsgDta                240

c                   Reset                   Qusec
c                   CallP     QWCRSVAL(RtnSysVals :
c                                      RcvrLngth  :
c                                      NbrToRtv   :
c                                      p_SysVal   :
c                                      Qusec)
c                   Return    RtnSysVals
P                 E

====================

Sorry not much for error handling,... HTH.


Regards,
Jon A. Erickson
Sr. Programmer Analyst
800.COM Inc.
1516 NW Thurman St
Portland, OR  97209-2517

Direct: 503.944.3613
Fax: 503.943.9313
Web: http://www.800.com


-----Original Message-----
From: Walden H. Leverich [mailto:WaldenL@TechSoftInc.com]
Sent: Wednesday, December 12, 2001 10:32 AM
To: 'midrange-l@midrange.com'
Subject: Retrieving and formatting current time in RPGLE


All,

I have a need to retrieve the current time (seconds, not milliseconds) and
format it thus:

Wed, 12 Dev 2001 13:21:01 -0500

That is the format for date-time as described in RFC2822. I can retrieve the
current date/time using the unix APIs, but I'd still have to format the
bloody thing. I'm hoping I'm either 1) missing an api, or 2) someone has
written a generic date/time formatting routing they'd care to share.

-Walden


------------
Walden H Leverich III
President
Tech Software
(516)627-3800 x11
WaldenL@TechSoftInc.com
http://www.TechSoftInc.com

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


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-2022 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.