|
Hi All I encountered a strange situation when I ran the following program for testing the logic. I do not know whether I understood it wrong or that is how 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 +---
As an Amazon Associate we earn from qualifying purchases.
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.