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



I'm on my way out the door and don't have time to look for a code snippet,
but you should check out move operations in the manual.  You can move
character or numeric dates into a date field directly if you specify the
date format. You can convert a MMDDYY numeric date into an ISO date in one
line of code. (You have to accept IBM's windowing on the 2 digit years.)  

> -----Original Message-----
> From: Jim Langston [mailto:jlangston@conexfreight.com]
> Sent: Friday, November 19, 1999 3:17 PM
> To: RPG400-L@midrange.com
> Subject: Dates
> 
> 
> I have a file with dates stored in a numeric MMDDYY format.  I convert
> them to dates using the following:
> 
> D                             DS
> D RealDate                1  10D        DATFMT(*ISO)
> D  RealDateCC         1    2S 0
> D  RealDateYY         3    4S 0
> D  RealDateMM        6   7S 0
> D  RealDateDD          9 10S 0
> D YMDDate             11 16S 0
> D   YMDDateYY      11 12S 0
> D MDYDate             13 18S 0
> D   MDYDateYY      17 18S 0
> D DateMM                13 14S 0
> D DateDD                  15 16S 0
> 
> C          Eval  MDYDate = FEDEta
> C          Exsr  MDYDateToDate
> 
> the Sub MDYDateToDate just does a bunch of moving around of values,
> comparing
> MDYDateYY to 99, if it's 99 it sets RealDateCC to 19, 
> otherwise sets to
> 20, then
> it moves the YY MM and DD fields to the Date field, then I have a date
> fields.
> 
> Is there an easier way?  There MUST be!
> 
> Also, later on I attempted to do a comparison,
> 
> C              If      RealDate < '1999-11-01'
> 
> but received an error, incompatable types.  so I then copied the
> RealDate to
> a date varialbe, and did the whole rigamarole in converting 110199 to
> RealDate,
> then could do the comparison between dates.
> 
> Again, there MUST be an easier way!
> 
> How do you hard code a date so that RPG recognizes it as a date?
> 
> Any help would be appreciated,
> 
> Regards,
> 
> Jim Langston
> 
+---
| 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.