Hi Everyone, I'm having an issue trying to convert a date field to a numeric field. Actually I'm taking a numeric field in MMDDCCYY, converting to a date CCYY-MM-DD, adding 120 days to the date and then trying to convert it back to a numeric field in MMDDCCYY format. Everything works fine except for the final conversion. I've found a couple of examples on the web on how to convert from date to numeric and I've tried them, but it's not working. Here's my code:
D Hlddat S D
Hlddat = %date(S3crap:*usa); S3crap = 06302016
Hlddat = Hlddat + %DAYS(120);
S3cexp = %dec(%char(Hlddat:*usa):8:0; Hlddat = '2016-10-28'
When this runs, the last statement gives an error message "A character representation of a numeric value is in error". But to me, the Hlddat value is correct. Is there something that I'm not seeing?
Thank you for any help you can provide.