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

Syncsort - Subtraction using SORT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ramesh_165

New User


Joined: 27 Nov 2010
Posts: 7
Location: Chennai

PostPosted: Fri Sep 09, 2011 6:24 pm
Reply with quote

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

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Sep 09, 2011 7:47 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Sep 09, 2011 7:56 pm
Reply with quote

Hello,

Also, this computation (subtracting 3 from the year) will not work for every case (i.e. leap year). . .
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 Sep 09, 2011 10:49 pm
Reply with quote

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

New User


Joined: 27 Nov 2010
Posts: 7
Location: Chennai

PostPosted: Sat Sep 10, 2011 10:54 pm
Reply with quote

Thanks Ed Goodman!!!!

TO=ZDF worked for me!!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 11, 2011 9:13 am
Reply with quote

Hello,

Ans i suppose that having the date wrong once in a while is ok. . .

icon_sad.gif

d
Back to top
View user's profile Send private message
Ramesh_165

New User


Joined: 27 Nov 2010
Posts: 7
Location: Chennai

PostPosted: Sun Sep 11, 2011 7:51 pm
Reply with quote

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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 11, 2011 11:54 pm
Reply with quote

Hi Ramesh,

You're welcome icon_smile.gif

As long as the date is always day 01, i don't see an issue.

d
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top