× 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: RPG400
  • From: "Ed Komeshak" <ed@xxxxxxxxxxxxxxxxxxx>
  • Date: Mon, 22 Jan 2001 00:38:39 -0500
  • Importance: Normal

the easiest way i've found to test for leap year is to take the year *
10000, add 0229, and use the TEST(D) opcode to determine if it is a valid
date.

as far as finding out how many days in each month, set a date type field to
feb 1 of that year ((year * 10000) + 0201).  use the SUBDUR opcode to
subtract one day, then use the EXTRACT opcode to extract the day portion of
the date field which will give you the number of days in jan.  loop thru
that same logic 11 more times, once for each month.

> -----Original Message-----
> From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
> Behalf Of booth@martinvt.com
> Sent: Sunday, January 21, 2001 4:14 PM
> To: RPG400-L@midrange.com
> Subject: Re: RPG400
>
>
> My initial thought might be a simple test to find the day of the week for
> January 1, YYYY (where YYYY is your target year) as a number from 1 thru
> 7. Then begin a loop that adds 1 day to the date and puts the
> info into an
> array of (12 months times 35 elements).  In the loop, watch for change in
> month, or day =1, and move to the next group of 35 elements.  That should
> be simple to maintain and run pretty fast.
>
> _______________________
> Booth Martin
> Booth@MartinVT.com
> http://www.MartinVT.com
> _______________________
>
>
>
>
> "areavill" <areavill@bluecarrots.com>
> Sent by: owner-rpg400-l@midrange.com
> 01/21/2001 11:22 AM
> Please respond to RPG400-L
>
>
>         To:     <RPG400-L@midrange.com>
>         cc:
>         Subject:        RPG400
> Dear Sir,
>
> I am trying to write what to you is probably a simple program in rpg400
> and I wonder if you could give me any pointers.
>
> The program accepts ayear from the user between 1900 and year 2000, for
> example 1959 and it must decide whether or not it is a leap year and then
> produce a calendar with the correct number of days in each month with the
> correct corresponding day example 21.1.01 would be next to Sunday etc.
>
> I would be grateful for any pointers.
>
> Thanks
> Andrew
>
>
> +---
> | 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
> +---
>

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

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.