× 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: Problems with CEE date APIs
  • From: "Alan Moulsdale" <alan.moulsdale@xxxxxxxxxx>
  • Date: Tue, 4 Jul 2000 14:42:07 +0100
  • Importance: Normal

Hello,

I am trying to write a program to calculate the last Friday of the month.

I decided to use the CEE date APIs in a ILE RPG program.

My problem is that the CEEDAYS API will only work if I place a DSPLY
directly after it! This is obviously not desirable.

I have found this to be the case at both V3R2 and V4R4.

Can anybody see what I am doing wrong?

Many thanks

Alan

Source code follows:

     Hdatedit(*ymd)

     Ddate             s               d   datfmt(*iso)

     DDayNumber        s              9b 0 inz
     DLilDate          s              9b 0 inz
     DDateFmt          s             35a   inz('YYYY-MM-DD')
     DDateCvt          s             35a
     Dfc               s             35a

     D                 ds
     Dwrkdate                          d   datfmt(*iso)
     D dd                             2a   overlay(wrkdate:9)
     D wrkdate2                      10a   overlay(wrkdate:1)

     /*---------------------------------------------------------------------
     /* Calculation Specifications
     /*---------------------------------------------------------------------
      * get current date
     C                   move      *date         wrkdate

      * go to first day of next month
     C                   eval      dd = '01'
     C                   adddur    1:*m          wrkdate

      * go to last day of this month
     C                   subdur    1:*d          wrkdate

      * get day of week
     C                   callb(d)  'CEEDAYS'
     C                   parm      wrkdate2      DateCvt
     C                   parm                    DateFmt
     C                   parm                    LilDate
     C                   parm                    fc

     C     '>>>Help<<<'  dsply

     C                   callb(d)  'CEEDYWK'
     C                   parm                    LilDate
     C                   parm                    daynumber

      * get last Friday of month
     C                   if        daynumber < 6
     C                   eval      daynumber = daynumber + 7
     C                   endif
     C                   if        daynumber > 6
     C                   eval      daynumber = daynumber - 6
     C                   subdur    daynumber:*d  wrkdate
     C                   endif

      * return date

     C     'Last Fri is' dsply                   wrkdate2

     C                   eval      *inlr = *on

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

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.