Calculating age and years of service

Jose Lerebours fp at fpgroups.com
Mon Oct 20 13:10:25 PDT 2008


fp at mccabes.us wrote:
> Quoting Jose Lerebours <fp at fpgroups.com>:
> 
>> Check this out:
>>
>>   1  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>> @keym  þ If:        Then: dim info(3)(6,.0)   2  -------   -   -   - 
>>    -   -   -   -   -   -   -   -   -   -   -
>>        þ If:        Then: ya(8,mdy/)="01/17/72"; yb(8,mdy/)=@td;  
>> gosub LOOPAGE   3  -------   -   -   -   -   -   -   -   -   -   -   
>>  -   -   -   -
>>        þ If:        Then: info("1")=int(info("2")/"12") ;  
>> info("3")=yc-yb   4  -------   -   -   -   -   -   -   -   -   -   - 
>>    -   -   -   -
>>        þ If:        Then: info("2")=(frac(info("2")/"12"))*"12"   5  
>>  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>        þ If:        Then: yx="Y: "&info("1")&"\nM: "&info("2")&"\nD: 
>>  "   6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>        þ If:        Then: yx=yx&info("3"); show ""; msgbox yx   7   
>> -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>        þ If:        Then: end   8  -------   -   -   -   -   -   -   
>>  -   -   -   -   -   -   -   -
>> LOOPAGEþ If:        Then: yd(4,.0)=eom(dom(ya)); yd=eom(ya)+yd;  
>> yc(8,mdy/)=ya+yd   9  -------   -   -   -   -   -   -   -   -   -    
>> -   -   -   -   -
>>        þ If: ya eq yc        Then: yc=eom(yc+"1")  10  -------   -   
>>  -   -   -   -   -   -   -   -   -   -   -   -   -
>>        þ If: yc gt yb        Then: return  11  -------   -   -   -   
>>  -   -   -   -   -   -   -   -   -   -   -
>>        þ If:        Then: info("2")=info("2")+"1"; ya=yc; goto  
>> LOOPAGE Please note that I have not tested this beyond what is shown 
>>  and you should test/modify code prior to put it into production.   
>> This is just an attempt to help you get started.
>>
> 
> Thanks Jose.  I'll give it a try, probably tomorrow.
> 
> Dan
> 

Please note that you may need to play with your PFCMARK (I think this is 
   it) for this routine to work with X-Dates low mid-1900s ... 1950, 
1951, 1952, etc.

I ran a number of test 1968 and up and it worked on every try.

Will love to know if you find a problem with the snippet ...

Regards,


Jose Lerebours
954-559-7186
http://www.fpgroups.com



More information about the Filepro-list mailing list