View previous topic :: View next topic
|
Author |
Message |
mrdinesh
New User
Joined: 23 Sep 2006 Posts: 24 Location: India
|
|
|
|
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 |
|
|
karthick1990
New User
Joined: 12 Jun 2014 Posts: 4 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
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 |
|
|
karthick1990
New User
Joined: 12 Jun 2014 Posts: 4 Location: India
|
|
|
|
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 |
|
|
boyti ko
New User
Joined: 03 Nov 2014 Posts: 78 Location: Malaysia
|
|
|
|
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 |
|
|
mrdinesh
New User
Joined: 23 Sep 2006 Posts: 24 Location: India
|
|
|
|
Thanks Bill. I was able to convert the Julian date to the desired format. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|