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


  • Subject: Re: Date Conversion Problem
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 22 Aug 1999 13:09:43 -0500

Hi Venkat...

What format is date1 in?   It CAN'T be *CYMD, since *CYMD is a
7-digit date, and date1 is an 8-digit variable.

*CYMD would be CYYMMDD for example, 0980822 would be Aug 22, 1998
And 1001031  would be Oct 31, 2000.

Assuming that date1 is in YYYYMMDD format, you want to use *ISO
not *CYMD.  The same examples in *ISO format would be 19980822
and 20001031

Hope that helps...


"Venkat Sreenivasan" <vsreeniv@RCCL.COM> wrote:
>
>
> Hi All
>
> I encountered a strange situation when I ran the following program f
>  testing
> the logic.  I do not know whether I understood it wrong or that is h
>  the IBM
> date routine works.  Need help.
>
> Source Code:
>
> 12       d date             s               d   datfmt(*USA)
> 13       d date0           s               d   datfmt(*USA)
> 14       d date1           s              8  0 inz(18980101)
> 15       d date2           s              8  0 inz
> 16       d cdate           s             10    inz
>
> 22       c     *CYMD         move      date1         date
> 23       c                   subdur    30:*d         date
> 24       c     *CYMD         move      date          date2
> 25       c                   eval      cdate = %CHAR(date)
> 26
> 27       c     *CYMD         move      date1         date0
> 28       c                   subdur    31:*d         date0
> 29       c                   If        date  > date0
> 30       c                   eval      cdate = %CHAR(Date0)
> 31       c                   endif
> 32
> 33       c                   eval      *INLR = *ON
> 34       c                   RETURN
>
> 1.   In the above code when I checked the value of DATE after
>  executing line 22
> it reads like: 01/01/2798 which is wrong.
> 2.   After performing a date arithmetic in line 23 the value of DATE
>  looks like
> 12/02/2797 (difference of 30 days from the         previous step).
> 3.   After the line 24 execution the value of DATE2 reads like:
>  18971202
> which is correct.
> 4.   After the execution of line 25 the value CDATE read like:
>  12/02/2797
> which wrong.
>
> I would like to know is there anything wrong with the method I've
>  adopted.
> DATE1 is the date that stored in our files and DATE2 is the newly
>  calculated
> date which will be updated to another field.   Your help is verymuch
> appreciated.
>
> Thanks to all
>
> Venkat Sreenivasan
> Metamor Worldwide.
>
>
> +---
> | 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
> +---
>
+---
| 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-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.