Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
jackare

New User

Joined: 27 Aug 2008
Posts: 33
Location: Brazil

Posted: Thu Nov 29, 2018 7:56 am    Post subject: Previous record x current record

Hello!
I have a dsn SORTIN like:

 Code: 001 100 002 005 003 125 004 500 007 250 008 010 010 001 100 020 128 120 129 012

Expected Output:

 Code: 001 105 003 625 007 260 010 001 100 020 128 132

Explanation:
Layout
1,3 = ID
5,3 = Price

If ID of current record is equal ID of previous record plus 1 then sum two prices .
Sample:
SUM prices, sets: ( 1 , 2) = 105 and ( 3 , 5 ) = 625!

Arun Raj

Moderator

Joined: 17 Oct 2006
Posts: 2482
Location: @my desk

 Posted: Thu Nov 29, 2018 8:15 pm    Post subject: jackare, I dont have Syncsort, but something like this should work for you. - Set up groups of 2 records, Use WHEN=GROUP,RECORDS=2 - PUSH the ID of the 1st record onto the 2nd record. - For each 2nd record in the group, Calculate the difference between the IDs and OVERLAY the ID at pos-1 with that from the 1st (PUSHed value), only when the difference between IDs is 1. - Summarize the results in an OUTFIL (SECTIONS, TRAILER3..) Good luck.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics current batch plan jzhardy DB2 3 Sun Sep 13, 2020 11:04 am Abend deletes last record written julietspringsteen ABENDS & Debugging 10 Fri Aug 21, 2020 7:45 pm Trying to add current date in place o... shub2204 DFSORT/ICETOOL 8 Wed Aug 12, 2020 4:14 pm Problem getting record length of a re... amitc23 COBOL Programming 2 Thu Jul 02, 2020 10:52 pm How to filter out certain records bas... manugeorge2004 JCL & VSAM 5 Wed Jun 17, 2020 10:05 pm

 © 2003-2020 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us