× 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: Day of the week
  • From: Scott Mildenberger <Smildenber@xxxxxxxxxxxx>
  • Date: Thu, 9 Dec 1999 10:56:19 -0700

Here's one that accepts a 8,0 YYYYMMDD as input.  You can modify to your
standard date format.  date_t and the constants are defined in the copy
member for the service program that this is part of.

     *********************************************************************
      ***  Returns the day of the week of the date, if no date parameter is
      ***    passed then it returns the day of the week of the current day.
      ***    Constants are defined for the return value: SUN, MON, TUE, WED,
      ***    THU, FRI, SAT.
      *********************************************************************

     p day_of_week     b                   export
     d day_of_week     pi             9
     d   date                              like(date_t) options(*nopass)
     d                                     const


     d BASE_DATE       c                   D'1992-12-05'

     d diff            s              6  0
     d in_date         s               d
     d remainder       s                   like(diff)
     d result          s                   like(diff)
     d temp_date       s                   like(date_t)


     c                   if        %parms > 0
     c     *iso          move      date          in_date
     c                   else
     c                   eval      temp_date = today
     c     *iso          move      temp_date     in_date
     c                   endif

     c     in_date       subdur    BASE_DATE     diff:*days

     c     diff          div       7             result
     c                   mvr                     remainder

     c                   select
     c                   when      remainder = 0
     c                   return    SAT
     c                   when      remainder = 1
     c                   return    SUN
     c                   when      remainder = 2
     c                   return    MON
     c                   when      remainder = 3
     c                   return    TUE
     c                   when      remainder = 4
     c                   return    WED
     c                   when      remainder = 5
     c                   return    THU
     c                   when      remainder = 6
     c                   return    FRI
     c                   endsl


      ***  Error subroutine

     c     *pssr         begsr
     c                   return    *blanks
     c                   endsr

     p day_of_week     e

> -----Original Message-----
> From: Klein Ron [SMTP:ron.klein@brctsg.com]
> Sent: Thursday, December 09, 1999 9:36 AM
> To:   'MIDRANGE-L (E-mail)
> Subject:      Day of the week
> 
> Hi all,
> 
> Since we have a discusion going about the days of the month, how about a
> easy routine to find the day of the week?  Any one have a solution?
> 
> TIA
> Ron
> 
+---
| 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 ...


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.