IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help adding century to YYMMDD date


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
leedtech

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Fri Apr 29, 2011 7:53 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Apr 29, 2011 9:05 pm
Reply with quote

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
View user's profile Send private message
leedtech

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Fri Apr 29, 2011 10:03 pm
Reply with quote

Frank,

That is the desired result.

Lee
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Apr 30, 2011 1:17 am
Reply with quote

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
View user's profile Send private message
leedtech

New User


Joined: 14 Dec 2006
Posts: 6
Location: Ohio

PostPosted: Wed May 04, 2011 7:54 pm
Reply with quote

Frank,

Sorry for delayed response.

I just wanted to thank you for your help.

Lee
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Adding QMF and SPUFI to the ISPF menu DB2 20
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top