Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help adding century to YYMMDD date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Help adding century to YYMMDD date
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 Moderator


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

PostPosted: Fri Apr 29, 2011 9:05 pm    Post subject:
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    Post subject: Reply to: Help adding century to YYMMDD date
Reply with quote

Frank,

That is the desired result.

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

DFSORT Moderator


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

PostPosted: Sat Apr 30, 2011 1:17 am    Post subject:
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    Post subject: Reply to: Help adding century to YYMMDD date
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us