× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here is an example that should work all the way back to V2R3 ...

         /* returns YYYYMMDDHHMMS date-time-stamp */
            PGM  PARM(&DATTIM)
            DCL  VAR(&DATTIM) TYPE(*CHAR) LEN(14)

            DCL  VAR(&DATE) TYPE(*CHAR) LEN(6) /* system date */
            DCL  VAR(&TIME) TYPE(*CHAR) LEN(6) /* system time */
            DCL  VAR(&CEN) TYPE(*CHAR) LEN(2)  /* century part */
            DCL  VAR(&RESULT) TYPE(*CHAR) LEN(64)
            DCL  VAR(&RESLEN) TYPE(*CHAR) LEN(4) VALUE(X'00000040')
            DCL  VAR(&NBRVAL) TYPE(*CHAR) LEN(4) VALUE(X'00000002')
            DCL  VAR(&VALUES) TYPE(*CHAR) LEN(20) +
                   VALUE('QDATE     QTIME     ')
            DCL  VAR(&ERRCOD) TYPE(*CHAR) LEN(96) VALUE(X'00000060')

         /* get date and time from OS/400 system values... */
            CALL       PGM(QSYS/QWCRSVAL) PARM(&RESULT &RESLEN +
                         &NBRVAL &VALUES &ERRCOD)

         /* extract results from API... */
            CHGVAR  VAR(&TIME) VALUE(%SST(&RESULT 29 6))
            CHGVAR  VAR(&DATE) VALUE(%SST(&RESULT 58 6))

         /* use century indicator to determine 4-digit year... */
            IF (%SST(&RESULT 57 1) = '1') +
               CHGVAR  VAR(&CEN) VALUE('20')
            ELSE +
               CHGVAR  VAR(&CEN) VALUE('19')

         /* put into canonical dateTimeStamp form... */
            CHGVAR     VAR(&DATTIM) VALUE(&CEN || &DATE || &TIME)

         /* exit normally ... */
            RETURN
            ENDPGM



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.