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
 

 

Syncsort - Subtraction using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort - Subtraction using SORT
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    Post subject:
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

Site Director


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

PostPosted: Fri Sep 09, 2011 7:56 pm    Post subject:
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 Moderator


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

PostPosted: Fri Sep 09, 2011 10:49 pm    Post subject:
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    Post subject:
Reply with quote

Thanks Ed Goodman!!!!

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

Site Director


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

PostPosted: Sun Sep 11, 2011 9:13 am    Post subject: Reply to: Syncsort - Subtraction using SORT
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    Post subject:
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

Site Director


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

PostPosted: Sun Sep 11, 2011 11:54 pm    Post subject: Reply to: Syncsort - Subtraction using SORT
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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