×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Rather than using TIME just call the Convert Date and Time Format API
(QWCCVTDT) asking for the current date in YYYYMMDD format.  Here's some
RPG code to demonstrate this:

     IMISC        DS
     I                                    B   1   40EC
     C                     Z-ADD0         EC
     C                     CALL 'QWCCVTDT'
     C                     PARM '*CURRENT'INFMT  10
     C                     PARM           INVAL   1
     C                     PARM '*YYMD'   OUTFMT 10
     C                     PARM           OUTVAL 17
     C                     PARM           EC
     C                     MOVELOUTVAL    YYMD    8
     C                     MOVE '1'       *INLR
     C                     RETRN

For details on the API see the Miscellaneous category of system APIs.

Bruce

>
>Non-negotiable fact for this question:  RPG-III only (I already know about my
>options in RPG-IV, so, please, no preaching to the choir <g>)
>
>I need to store the current date (not job date!) in a field written out to a
>file.  Our dates are stored in YYYYMMDD numeric format (also non-negotiable,
>so don't go there!).  The TIME op code produces the date in positions 7-14 in
>a 14-digit field.  The RPG Reference states that "The date format depends on
>the date format job attribute QDATFMT".  This is a system value assigned to
>the job that can be changed via CHGJOB.  Given our QDATFMT value of *MDY here
>in the states, I know I can manipulate the mmddyyyy date in a data structure
>to get the desired yyyymmdd format.  But our overseas branches may have a
>different QDATFMT value.  I would have thought that this value could be found
>in the program status data structure, but a search in the RPG Reference turned
>up nothing.
>


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| 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-2026 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.