View previous topic :: View next topic
|
Author |
Message |
Ramesh_165
New User
Joined: 27 Nov 2010 Posts: 7 Location: Chennai
|
|
|
|
I want to subtract 3 years from the date mentioned in SORTIN.
SORTIN: '2011-08-01'))
Expected output in SORTOUT: OVERLAY=(36:C'2008-08-01'))
SYSIN: SORT FIELDS=COPY
OUTREC FIELDS=(11:C'OVERLAY=(36:C''', -
25:2,4,ZD,SUB,+3,TO=ZD,LENGTH=4, -
29:6,9,38:43X)
The above is the sortcard i'm using and i'm facing a problem in getting the above expected output.
The output i'm gettng is OVERLAY=(36:C'200H-08-01')) --> 8 is replaced with "H".
Other way of SYSIN also i have tried, after changing the sortin as '20110801' to just get '20080801'. But i'm getting syntax error at Y4T and looks like my SORT version insalled in my shop is old (2007), but the date logic in sort is introduced from the year 2010.
[SORT FIELDS=COPY
OUTREC FIELDS=(2,8,Y4T,SUBYEARS,+3)]
Ramesh |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
I think you're getting the number back as a positive signed decimal. So I'd bet the last byte is x'C8'.
Instead of using "length=4", try "EDIT=(TTTT)"
Depending on your version of SORT, you can also try "TO=ZDF" instead of "TO=ZD" (try that first actually) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Also, this computation (subtracting 3 from the year) will not work for every case (i.e. leap year). . . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ramesh,
With DFSORT, the output would be:
Code: |
OVERLAY=(36:C'2008-08-01'))
|
So I can only conclude that you're using Syncsort, not DFSORT.
This is the DFSORT Forum for DFSORT questions. Please ask Syncsort questions in the JCL Forum. |
|
Back to top |
|
|
Ramesh_165
New User
Joined: 27 Nov 2010 Posts: 7 Location: Chennai
|
|
|
|
Thanks Ed Goodman!!!!
TO=ZDF worked for me!! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Ans i suppose that having the date wrong once in a while is ok. . .
d |
|
Back to top |
|
|
Ramesh_165
New User
Joined: 27 Nov 2010 Posts: 7 Location: Chennai
|
|
|
|
Hi Dick,
The subtraction is to get the latest three years report and it is used in a Monthly Job. And as per my requirement date will always be 01 (from day 1 of any month) irrespective of month and year. So i believed that there will not be any impact. Please tell me if you see any issues in the subtraction method as per my requirement.
Thank you very much for your care!!!
Ramesh |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Ramesh,
You're welcome
As long as the date is always day 01, i don't see an issue.
d |
|
Back to top |
|
|
|