Page 1 of 1

Future date calculation

PostPosted: Mon Dec 29, 2014 10:37 pm
by Aki88
Hello,

I am trying to generate an extract, a part of the process requires calculation of future date using the number of months, which are taken from another position in the same record itself.

An example input record is as below (this record is for illustration only, the actual record layout positions, data differ from this):

2014059ASHFOASHFOUH36KSDGFSDGFSB
2013268ASGFIDGSAIFG48SDKFAGDSFGF
2015348AHDSOFHSODHA59ASIUFHISHFU
2010289SBKDFHAKSFHU10DSAHFKDSHFD


Here starting 7 bytes are date in Y4T format, 2 bytes from 20th position are the number of months to be used for calculation of future date.
The way I'd attempted this was doing it in two steps, first converting Julian to Greg Y4T format, then trying to use 'DATE2+m' form to calculate the future date.
The point where I am stuck is - how to pass the number of months, from my record as shown above, to 'm' for calculation of the date.
When I pass the position in place of 'm', as (20,2,ZD), the job goes for a toss as it expects 'm' to be a numeric value.

If I have it figured the right way then 'DATE2+m', won't be of much help here and I might have to use some other workaround to get this done.

A thought please.

Thanks.

Re: Future date calculation

PostPosted: Tue Dec 30, 2014 12:08 am
by BillyBoyo
There is an ADDMONS function.

Re: Future date calculation

PostPosted: Tue Dec 30, 2014 12:24 am
by Aki88
Thanks a ton Billy, it works like a charm. :D

Cheers; a very happy Christmas + holiday season + advance wishes for the new year...