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 Sorting & Eliminating Old Records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Ariharan S

New User


Joined: 20 Feb 2011
Posts: 6
Location: Chennai

PostPosted: Fri Sep 16, 2011 12:46 pm    Post subject: Syncsort Sorting & Eliminating Old Records
Reply with quote

A file is of below layout,
Name
Id Type
Effective Date
Id Val

I need to select only records whose effective date is recent for a partuclar Name+ID_Type combination

IF input is this,

ABC ID1 2001-08-25 XXXXX
ABC ID1 2005-04-30 YYYYYY
ABC ID2 1987-08-25 123456
ABC ID2 2011-09-21 123789
ABC ID2 2003-04-25 123456
ABC ID3 2005-04-30 FFFFFFF
DEF ID3 2005-04-30 FFF333

OUTPUT MUST BE,

ABC ID1 2005-04-30 YYYYYY
ABC ID2 2011-09-21 123789
ABC ID3 2005-04-30 FFFFFFF
DEF ID3 2005-04-30 FFF333
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 16, 2011 12:48 pm    Post subject: Reply to: Sorting & Eliminating Old Records
Reply with quote

Quote:
I need to use JCL sort to select only records whose effective date is recent
36_11_6.gif
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Fri Sep 16, 2011 7:05 pm    Post subject:
Reply with quote

Use this:

Since you have not mentioed the LRECL, I assumed it to be 39 and file format to be FB.

Code:

//SYSIN    DD *                                             
 SORT FIELDS=(1,7,CH,A,8,10,CH,D)                           
 OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,7),PUSH=(40:SEQ=2)) 
 OUTFIL INCLUDE=(40,2,CH,EQ,C'01'),BUILD=(1,39)             
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 990
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Sep 16, 2011 7:22 pm    Post subject:
Reply with quote

THINKSRINIII wrote:
Use this:

Since you have not mentioed the LRECL, I assumed it to be 39 and file format to be FB.

Code:

//SYSIN    DD *                                             
 SORT FIELDS=(1,7,CH,A,8,10,CH,D)                           
 OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,7),PUSH=(40:SEQ=2)) 
 OUTFIL INCLUDE=(40,2,CH,EQ,C'01'),BUILD=(1,39)             


It MUST be Psychic day !!

How did you manage to know what exactly "recent" means to the TS ??

Garry.
Back to top
View user's profile Send private message
Ariharan S

New User


Joined: 20 Feb 2011
Posts: 6
Location: Chennai

PostPosted: Fri Sep 16, 2011 7:22 pm    Post subject: Reply to: Sorting & Eliminating Old Records
Reply with quote

Will this work with Syncsort
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Sep 16, 2011 7:28 pm    Post subject: Re: Reply to: Sorting & Eliminating Old Records
Reply with quote

Ariharan S wrote:
Will this work with Syncsort


No, it won't.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 16, 2011 7:59 pm    Post subject: Reply to: Syncsort Sorting & Eliminating Old Records
Reply with quote

Quote:
Will this work with Syncsort

faster to try than ask on a forum
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 16, 2011 8:28 pm    Post subject:
Reply with quote

Hello,

The syntax provided will not work with Syncsort. Syncsort does however support WHEN=GROUP.

Sugtgest you read about BEGIN instead of KEYBEGIN (i've never done this, but this is in the manual).
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Sep 16, 2011 9:13 pm    Post subject: Reply to: Syncsort Sorting & Eliminating Old Records
Reply with quote

This will work with Syncsort:

Code:

//STEP0001 EXEC PGM=SYNCSORT                                       
//SORTIN   DD   *                                                   
ABC ID1 2001-08-25 XXXXX                                           
ABC ID1 2005-04-30 YYYYYY                                           
ABC ID2 1987-08-25 123456                                           
ABC ID2 2011-09-21 123789                                           
ABC ID2 2003-04-25 123456                                           
ABC ID3 2005-04-30 FFFFFFF                                         
DEF ID3 2005-04-30 FFF333                                           
/*                                                                 
//SORTOUT  DD   SYSOUT=*                                           
//SYSOUT   DD   SYSOUT=*                                           
//SYSIN    DD   *                                                   
  SORT FIELDS=(1,7,CH,A,9,10,CH,D)                                 
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,7))) 
  OUTFIL INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)                       
/*                                                                                       
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Sep 16, 2011 9:54 pm    Post subject:
Reply with quote

I'm with Enrico and Garry, what is "recent"? icon_sad.gif
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 16, 2011 10:55 pm    Post subject: Reply to: Syncsort Sorting & Eliminating Old Records
Reply with quote

Hello,

The topic subject: Syncsort Sorting & Eliminating Old Records

Quote:
I'm with Enrico and Garry, what is "recent"?


I guess recent is "not old" - whatever "old" means icon_wink.gif

Been one of those days. . .

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

New User


Joined: 20 Feb 2011
Posts: 6
Location: Chennai

PostPosted: Mon Sep 19, 2011 11:10 am    Post subject: Re: Syncsort Sorting & Eliminating Old Records
Reply with quote

Ariharan S wrote:
A file is of below layout,
Name
Id Type
Effective Date
Id Val

I need to select only records whose effective date is recent for a partuclar Name+ID_Type combination


Recent means,
latest Effective Date (Eg: if 1980-01-01 & 2010-01-01 are there, then 2010-01-01 shud be selected)
Back to top
View user's profile Send private message
Ariharan S

New User


Joined: 20 Feb 2011
Posts: 6
Location: Chennai

PostPosted: Mon Sep 19, 2011 11:29 am    Post subject: Re: Reply to: Syncsort Sorting & Eliminating Old Records
Reply with quote

superk wrote:
This will work with Syncsort:

Code:

//STEP0001 EXEC PGM=SYNCSORT                                       
//SORTIN   DD   *                                                   
ABC ID1 2001-08-25 XXXXX                                           
ABC ID1 2005-04-30 YYYYYY                                           
ABC ID2 1987-08-25 123456                                           
ABC ID2 2011-09-21 123789                                           
ABC ID2 2003-04-25 123456                                           
ABC ID3 2005-04-30 FFFFFFF                                         
DEF ID3 2005-04-30 FFF333                                           
/*                                                                 
//SORTOUT  DD   SYSOUT=*                                           
//SYSOUT   DD   SYSOUT=*                                           
//SYSIN    DD   *                                                   
  SORT FIELDS=(1,7,CH,A,9,10,CH,D)                                 
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,7))) 
  OUTFIL INCLUDE=(81,8,ZD,EQ,1),BUILD=(1,80)                       
/*                                                                                       


Thanks a lot superk!
It works!!!

Can anyone refer any materials related to SYNCSORT, which can be used by beginners for learning?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Sep 19, 2011 12:58 pm    Post subject: Re: Reply to: Syncsort Sorting & Eliminating Old Records
Reply with quote

Ariharan S wrote:
Can anyone refer any materials related to SYNCSORT, which can be used by beginners for learning?
Documenation on products from SyncSort is covered under Copyright Act and can not be linked via a forum.

If you want to have a copy of SyncSort Documentation, please contact Alissa Margulies on this board or send a note to SyncSort representative at your shop or write an e-mail to zos_tech@syncsort.com and follow the instructions.

Good Luck! icon_smile.gif
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Updating the counters after eliminati... PANDU1 DFSORT/ICETOOL 12 Mon Nov 21, 2016 9:47 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


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