| Calculating age or longevity | |
|
Here's a quick and easy way to get an "age" in a CALCULATE:
$
DEFINE LNK$LIBRARY DMS:APT You'll need to change the references to #.AGE (field where the "age" is stored) and #.BIRTHDATE (field where the date to compare against today's date is stored).
Or, try this one...
* DATE FORMAT "!MN0!D0!Y4"
* EQUATE <STARTDATE$> <<@Date for calculating <...DATE> @>> * IF <STARTDATE$> EQ <> * EQUATE <STARTDATE$> <...DATE> * ENDIF $ RUN DMS:POINTER STUDENT ALL YES
$ DEFINE LNK$LIBRARY
DMS:APT
$ RUN DMS:CALCULATE STUDENT/PROGRAMMER YES NO GOTO FILES_OPEN IF FILES.OPENED% EXTERNAL LONG FUNCTION & ASW_DATE(STRING,STRING,STRING,LONG,LONG) FILES.OPENED% = -1% FILES_OPEN: AGE% = ASW_DATE(NUM1$(#.BIRTHDATE),NUM1$(STARTDATE$),,,128%) #.AGE = VAL(LEFT(NUM1$(AGE%), 2%)) YES
|