MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Finding Leap year

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
Rmravi
Beginner


Joined: 24 Jun 2004
Posts: 12
Topics: 5

PostPosted: Wed Sep 29, 2004 2:18 am    Post subject: Finding Leap year Reply with quote

How to find the leap year thru rexx is their any function available ?please help me in that

Ravi
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Wed Sep 29, 2004 5:47 am    Post subject: Reply with quote

rmravi,

try this

Code:

/* function checking for a leap year of an ISO date      */
isLeap: procedure
parse arg ISOdate

/* catch syntax error produced by wrong date value       */
signal on syntax
dummy = Date(, substr(ISOdate,1,4)'0229', 'Standard')
return 1           /* is valid date, --> leap year       */
syntax:
return 0           /* is invalid date, --> no leap year  */

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rmravi
Beginner


Joined: 24 Jun 2004
Posts: 12
Topics: 5

PostPosted: Wed Sep 29, 2004 6:51 am    Post subject: Reply with quote

Hi

I am new to rexx while running the peogram it saying the fllowing error could you pls guide me in that

LABEL syntax SPECIFIED BUT COMMAND NOT FOUND
Back to top
View user's profile Send private message
Rmravi
Beginner


Joined: 24 Jun 2004
Posts: 12
Topics: 5

PostPosted: Wed Sep 29, 2004 7:11 am    Post subject: Reply with quote

Sorry it is my mistake only Thanks Kolusu tahnks lot it is working fine
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Sep 29, 2004 7:17 am    Post subject: Reply with quote

kolusu, that certainly makes sense as an algorithm. I always did it by making sure that the year was evenly divisible by 400, or by 4 and 100. I'll be adding this one to my REXX algorithm list.
Back to top
View user's profile Send private message
danm
Intermediate


Joined: 29 Jun 2004
Posts: 170
Topics: 73

PostPosted: Thu Oct 28, 2004 4:03 pm    Post subject: Reply with quote

Try this:
Code:

/* REXX _____________________________________________
| If 2 days between 3/1 and 2/28, it is a leap year. |
|__________________________________________________*/
Do I = 1990 to 2010
  If 2 = date('B',I'0301','S') - date('B',I'0228','S') then,
    say I 'is leap year'
  Else say I 'is not a leap year'
End 
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group