home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / cs2pmm_m.zip / JCLEPYER.CMD < prev    next >
OS/2 REXX Batch file  |  1996-03-28  |  1KB  |  28 lines

  1. /******************************* REXX *********************************/
  2. /*  This is a simple external REXX function that determines whether   */
  3. /*  or not a passed year is a leap year or not.  If invoked without   */
  4. /*  any operands, the determination is made on the current year.      */
  5. /*  The function returns a "1" if it is a leap year, "0" if not.      */
  6. /**********************************************************************/
  7. Parse Arg year, .
  8. If year = '' Then
  9.    year = Left(Date('S'), 4)
  10. jul_year = Right(year, 2)
  11. jul_cent = Left(year, 2)
  12.  
  13. /**********************************************************************/
  14. /*  Leap years are calculated as follows:  If the year is 0, and the  */
  15. /*  century is divisible by 4, then it is a leap year (century        */
  16. /*  divisible by 400).  Otherwise, if the year is divisible by 4, it  */
  17. /*  is a leap year.  If the year is divisible by 100 and NOT          */
  18. /*  divisible by 400, it is NOT a leap year.                          */
  19. /**********************************************************************/
  20. If ((jul_year = '00') & ,
  21.    (jul_cent // 4 = 0)) | ,
  22.    ((jul_year \= '00') & ,
  23.    (jul_year // 4 = 0)) Then
  24.    sw = 1
  25. Else
  26.    sw = 0
  27. Return sw
  28.