home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / varia / fiasco_1.2 / arexx / age.rexx next >
OS/2 REXX Batch file  |  1977-12-31  |  1KB  |  42 lines

  1. /* age.rexx
  2.  * ARexx script for calculating of the age using
  3.  * "Day of birth" and current date
  4.  * Copyright © 1995 Nils Bandener
  5.  * $VER: age.rexx 3.2 (9.12.95)
  6.  */
  7.  
  8. Options Results
  9. Address FIASCO
  10.  
  11. F_GetFieldCont "DayOfBirth"         /* Insert here the field ID
  12.                                      * of the field, which contains
  13.                                      * the day of birth
  14.                                      */
  15.  
  16. Date = Result
  17.  
  18. Parse Var Date GDay "." GMonth "." GYear    /* ARexx makes parsing
  19.                                              * of the string
  20.                                              * very easy
  21.                                              */
  22.  
  23. Parse Value Date(European) With ADay "/" AMonth "/" AYear   /* The dateformat of
  24.                                                              * ARexx is a bit diffrent
  25.                                                              */
  26.  
  27. if length(GYear) <= 2 then GYear = GYear + 1900 /* Years with two digits are
  28.                                                  * supposed to be in
  29.                                                  * the 20th century
  30.                                                  */
  31. if length(AYear) <= 2 then AYear = AYear + 1900
  32.  
  33.  
  34. DYear = AYear - GYear
  35.  
  36. if GMonth > AMonth then DYear = DYear - 1
  37. else if GMonth = AMonth & GDay > ADay then DYear = DYear - 1
  38.  
  39. F_SetFieldCont "Age"  DYear         /* Insert here the correct field ID, too
  40.                                      */
  41.  
  42.