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

Date Conversion from YYYYDDD to YYYYMMDD format


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

New User


Joined: 23 Sep 2006
Posts: 24
Location: India

PostPosted: Sat Jan 16, 2016 5:17 pm
Reply with quote

Is there any way in DFSORT to convert Dates. In my case I receive an Input file with the dates yyyyddd format and I would need to convert it to yyyymmdd format. The input file is received in the text format.

Input File:
Code:

DATA1 2015001
DATA2 2015002
DATA3 2015032
DATA4 2015040


I would need to convert this to as

Code:

DATA1 20150101
DATA2 20150102
DATA3 20150201
DATA4 20150209



Thanks,
Dinesh
Back to top
View user's profile Send private message
karthick1990

New User


Joined: 12 Jun 2014
Posts: 4
Location: India

PostPosted: Sun Jan 17, 2016 11:46 am
Reply with quote

Yes.

I have option to test for syncsort only, here is the equivalent in syncsort.

Code:

//STEP01   EXEC PGM=SORT                       
//SYSOUT   DD  SYSOUT=*                       
//SORTIN   DD  *                               
DATA1 2015001                                 
DATA2 2015002                                 
DATA3 2015032                                 
DATA4 2015040                                 
//SORTOUT  DD  SYSOUT=*                       
//SYSIN DD *                                   
 OPTION COPY                                   
 INREC BUILD=(1,6,9,5,Y2T,DTNS=(4MD))         
/*                                             


karthick sundarasamy
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jan 18, 2016 3:41 am
Reply with quote

mrdinesh

The DFSORT manuals cover date data-types and date functions. If you just ask, instead of trying to find out for yourself, and asking if unsure, you'll never learn how to find anything out.

karthick1990

Two-digit years haven't been used since last century. Why do that, when you have a four-digit year?
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Jan 18, 2016 4:41 am
Reply with quote

karthick1990

Just to add to Mr. Woodger's comment. Part of the Y2K business from 20 odd years ago was the use of two digit dates. One would have thought that no analyst in their right mind would authorize the use of a 2 digit date except, perhaps, for display purposes. But I see this creeping back into our trade now.

Now I see the year 2100 as being worse than 2000 if us analysts persist in being lazy. 2000, at least, was a leap year. 2100 is not a leap year in the Gregorian calendar, so we will have that issue to deal with in addition to the same date comparison issue that bedeviled us in 2000. Now I grant few people reading this forum will have to deal with 2100 issues 80 some years from now, but if us analysts don't get smart NOW our children, grandchildren and great grandchildren are just going to repeat the Y2K problem all over again.

Part of what brings this to mind is, as I'm writing this, I'm working on a program that takes, in its input, 2 digit years. The data area containing the 2 digit year was designed around 1970, but that's a poor excuse. I can make the program Y2K compatible, but because of the crappy input, I cannot make the program Y2K compliant, much less Y21K capable.
Back to top
View user's profile Send private message
karthick1990

New User


Joined: 12 Jun 2014
Posts: 4
Location: India

PostPosted: Mon Jan 18, 2016 11:29 am
Reply with quote

Bill Woodger/Steve-myers,

Seeing the OP's data sample allowing date process here to go on with CENTWIN option to calculate century
is not Good in all the case. yep, with 4 digit year processing things would be better for centuries.
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Mon Jan 18, 2016 1:48 pm
Reply with quote

Just want to share my experience, in my site previously, I saw the same. Something like this.
Code:
IF YY < 50
   CC = 20
ELSE
  CC = 19

I told my supervisor that time that it will have impact in the future. What she tells me is if we're still alive by that time.
Back to top
View user's profile Send private message
mrdinesh

New User


Joined: 23 Sep 2006
Posts: 24
Location: India

PostPosted: Tue Jan 19, 2016 12:05 pm
Reply with quote

Thanks Bill. I was able to convert the Julian date to the desired format.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue Jan 19, 2016 2:56 pm
Reply with quote

Bill Woodger
Quote:
Two-digit years haven't been used since last century. Why do that, when you have a four-digit year?


SMF is still using that format, accompanied with a century indicator.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 19, 2016 3:56 pm
Reply with quote

And DFSORT has date formats for SMF dates (and time formats for SMF times).

If you want to consider a two-digit year with a century indicator the same as a two-digit year, fair enough. I was just being humorous. There are two-digit years out there, but there's no need to treat a four-digit year as a two-digit year was the point I was getting at.
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
Search our Forums:

Back to Top