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

Syncsort Sorting & Eliminating Old Records


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Sep 16, 2011 12:48 pm
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
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

Senior Member


Joined: 08 May 2006
Posts: 1205
Location: Dublin, Ireland

PostPosted: Fri Sep 16, 2011 7:22 pm
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
Reply with quote

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

Global Moderator


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

PostPosted: Fri Sep 16, 2011 7:28 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Fri Sep 16, 2011 7:59 pm
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

Moderator Emeritus


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

PostPosted: Fri Sep 16, 2011 8:28 pm
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

Global Moderator


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

PostPosted: Fri Sep 16, 2011 9:13 pm
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

Superior Member


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

PostPosted: Fri Sep 16, 2011 9:54 pm
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

Moderator Emeritus


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

PostPosted: Fri Sep 16, 2011 10:55 pm
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
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
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

Superior Member


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

PostPosted: Mon Sep 19, 2011 12:58 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Syncsort help SYNCSORT 3
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SYNCSORT-DB2 interface SYNCSORT 0
No new posts Sorting Date Field DFSORT/ICETOOL 4
Search our Forums:

Back to Top