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



Alan Novick wrote:
> 
> Hello:
> 
> Anyone know how I can (in an RPG program) determine the day of week for
> a given date?  I know I can retrieve the system value for the current
> date, but I want to be able to determine the day of week for dates other
> than today.

This is from last week but it works very well:

G$DW at the bottom of the routine will contain the day of the week....

It requires no special releases,languages,API's, etc....

 GTOJR1     
Transfer Program
  0001 C           *ENTRY    PLIST
       C                     PARM           G$MM    20
       C                     PARM           G$DD    20
       C                     PARM           G$YYYY  40
       C                     PARM           G$JD    50
       C*
  0002 C                     Z-ADD0         G$JD
  0003 C           G$MM      SUB  3         G$MMWK  20
  0004 C                     Z-ADDG$MMWK    GMWKSV  20
  0005 C           G$MMWK    IFLT 0                           LVL-01
  0006 C                     ADD  12        G$MMWK
  0007 C                     END                              END-01
  0008 C           GMWKSV    IFNE 0                           LVL-01
  0009 C           G$MMWK    MULT 30.6      G$JD      H
  0010 C                     END                              END-01
  0011 C                     ADD  G$DD      G$JD    50
  0012 C           G$YYYY    SUB  1900      G$YYWK  30
  0013 C           G$YYWK    IFNE 0                           LVL-01
  0014 C           GMWKSV    IFLT 0                           LVL-02
  0015 C                     SUB  1         G$YYWK
  0016 C                     END                              END-02
  0017 C                     END                              END-01
  0018 C           G$YYWK    MULT 365.25    G$JYD   70
  0019 C                     ADD  G$JYD     G$JD
  0020 C           G$JD      DIV  7         G$WK7   70
  0021 C                     MVR            G$DW    10
       C                     RETRN
+---
| 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.