Thanks Birgitta...I had the variables right, but didn't have the Date
function around the timestamp stuff. I'm on V5R4.

- Michael

On Tue, Dec 23, 2008 at 8:02 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx> wrote:
MyDate must be a real date and FirstFriday must be either defined as 1A or
as N.
If you are not yet on release 6.1 you need to put the scalar function Date
around the Next_Day-Expression.
Next_Day returns a timestamp

Exec SQL
Set :FirstFriday = Case When :MyDate = Date(Next_Day(Last_Day(:MyDate - 1
Month), 'Friday'))
Then '1' Else '0' End;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"


-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Michael Ryan
Gesendet: Tuesday, 23. December 2008 13:24
An: RPG programming on the IBM i / System i
Betreff: Re: Identify the 1st Friday of the Month

Hi Birgitta -

I just gave this a try, and I'm getting a compile error saying the
operands can't be compared. What type are FirstFriday and MyDate?
Also, are Next_day and Last_Day stored procedures or functions or
what?

Thanks...

On Tue, Dec 23, 2008 at 6:59 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:
Hi,

I'd use embedded SQL:

Exec SQL
Set :FirstFriday = Case When :MyDate = Next_Day(Last_Day(:MyDate - 1
Month), 'Friday')
Then '1' Else '0' End;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
Im
Auftrag von ewart.desouza@xxxxxxxxxxx
Gesendet: Tuesday, 23. December 2008 11:58
An: RPG programming on the AS400 / iSeries
Betreff: Identify the 1st Friday of the Month

Hello All,

Anyone have a code snippet to identify if a date is the 1st Friday of the
month ?

Thanks & best regards
Ewart
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.