View previous topic :: View next topic
Author
Message
leedtech New User Joined: 14 Dec 2006Posts: 6 Location: Ohio
I am trying to add a century to a date in YYMMDD format. I want the century to be determined by using the current year as the window (i.e. current year or less will be filled with 20 as century, otherwise 19).
I was able to use Y2PAST=100 to get the century to populate, however current year fills with 19 instead of 20.
Code:
OPTION COPY,Y2PAST=100
INREC BUILD=(1,6,Y2T,TOGREG=Y4T)
I tried to change Y2PAST=100 to Y2PAST=101 thinking this would work, but it now gives me OPERAND DEFINER ERROR.
Is there any modification I could use to do this with Y2PAST?
If I were to need to go the IFTHEN route, can the YY part of DATE1 be isolated?
Thank you,
Lee
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Quote:
current year or less will be filled with 20 as century, otherwise 19)
Do you mean you want the following?
Code:
99mmdd -> 1999mmdd
...
13mmdd -> 1913mmdd
12mmdd -> 1912mmdd > current year
11mmdd -> 2011mmdd = current year
10mmdd -> 2010mmdd < current year
09mmdd -> 2009mmdd
...
00mmdd -> 2000mmdd
If not, show what you do want.
Back to top
leedtech New User Joined: 14 Dec 2006Posts: 6 Location: Ohio
Frank,
That is the desired result.
Lee
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You could use Y2PAST=1912, but then you'd have to add 1 each year.
Or you could use Y2PAST=100 with the following DFSORT control statements which will fix the current year:
Code:
OPTION COPY,Y2PAST=100
INREC IFOUTLEN=8,
IFTHEN=(WHEN=INIT,
BUILD=(1,6,Y2T,TOGREG=Y4T,9:DATE2)),
IFTHEN=(WHEN=INIT,OVERLAY=(15:9,4,ZD,SUB,+100,EDIT=(TTTT))),
IFTHEN=(WHEN=(1,4,ZD,EQ,15,4,ZD),OVERLAY=(1:9,4))
Back to top
leedtech New User Joined: 14 Dec 2006Posts: 6 Location: Ohio
Frank,
Sorry for delayed response.
I just wanted to thank you for your help.
Lee
Back to top
Please enable JavaScript!