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 file with duplicates as well as with unique records

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

New User


Joined: 22 Nov 2007
Posts: 77
Location: noida

PostPosted: Tue Dec 11, 2007 9:02 pm    Post subject: SYNCSORT file with duplicates as well as with unique records
Reply with quote

I have a input file(physical sequential) with records as mentioned below:

DDA8000000000000978300012111120
DDA8000000000000978300013111120
DDA4000000000000978500001120000
DDA4000000000000978500001320000
DDA8000000000000978623456789123
REA4500000000000978700123456789
REA8000000000000978800170000000

I want to sort the above file on position 5 for length 15. The output file should contain the unique records as well as the last record of duplicate ones.The output file should look like:

DDA8000000000000978300013111120
DDA4000000000000978500001320000
DDA8000000000000978623456789123
REA4500000000000978700123456789
REA8000000000000978800170000000

Sort card i used was SORT FIELDS=(5,15,ZD,A),SUM FIELDS=NONE but i didn't got the expected result.

Can i do it thru sort utility in one step.
Back to top
View user's profile Send private message

abhay pratap singh

New User


Joined: 22 Nov 2007
Posts: 77
Location: noida

PostPosted: Tue Dec 11, 2007 9:18 pm    Post subject: Re: SYNCSORT file with duplicates as well as with unique rec
Reply with quote

abhay pratap singh wrote:

I want to sort the above file on position 5 for length 15.
Sort card i used was SORT FIELDS=(5,15,ZD,A),SUM FIELDS=NONE



Please correct it to
I want to sort the above file on position 6 for length 15.
Sort card i used was SORT FIELDS=(6,15,ZD,A),SUM FIELDS=NONE
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Wed Dec 12, 2007 1:03 am    Post subject: Reply to: SYNCSORT file with duplicates as well as with uniq
Reply with quote

Quote:
Can i do it thru sort utility in one step.
Yes.

Try this:
Code:

//STEP1   EXEC  PGM=SORT                   
//SYSOUT    DD  SYSOUT=*                   
//SORTOUT   DD  SYSOUT=*                   
//SORTIN    DD  *                           
DDA8000000000000978300012111120             
DDA8000000000000978300013111120             
DDA4000000000000978500001120000             
DDA4000000000000978500001320000             
DDA8000000000000978623456789123             
REA4500000000000978700123456789             
REA8000000000000978800170000000             
//SYSIN     DD  *                           
   INREC FIELDS=(1,31,32:SEQNUM,8,ZD)       
   SORT FIELDS=(6,15,ZD,A,32,8,CH,A),EQUALS
   OUTFIL REMOVECC,NODETAIL,               
   SECTIONS=(6,15,TRAILER3=(1,31))         
/*
Back to top
View user's profile Send private message
abhay pratap singh

New User


Joined: 22 Nov 2007
Posts: 77
Location: noida

PostPosted: Wed Dec 12, 2007 10:59 am    Post subject: Re: Reply to: SYNCSORT file with duplicates as well as with
Reply with quote

Alissa,

I think you have assumed th input file as fixed(RECFM=FB) and LRECL=80 but the file is having RECFM=VB and LRECL=2004.

Will the solution provided by you will work for VB file.
Back to top
View user's profile Send private message
ameenansari

New User


Joined: 18 Sep 2006
Posts: 11
Location: chennai

PostPosted: Wed Dec 12, 2007 1:17 pm    Post subject: Reply to: SYNCSORT file with duplicates as well as with uniq
Reply with quote

Hi Parathap,

This will work

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD DSN=INSC.DEC12,DISP=SHR //* I/P VB FILE
//SYSIN DD *
SORT FIELDS=(9,16,ZD,A)
SUM FIELDS=NONE
/*

Thanks
Ameen
Back to top
View user's profile Send private message
abhay pratap singh

New User


Joined: 22 Nov 2007
Posts: 77
Location: noida

PostPosted: Wed Dec 12, 2007 4:24 pm    Post subject: Re: Reply to: SYNCSORT file with duplicates as well as with
Reply with quote

ameenansari wrote:
Hi Parathap,

This will work
//SYSIN DD *
SORT FIELDS=(9,16,ZD,A)
SUM FIELDS=NONE
/*


Ameen,

SUM FIELDS=NONE will give first record of the duplicate records and my requirement is to get last record of the duplicates.I have mentioned this in my problem.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 12, 2007 4:56 pm    Post subject:
Reply with quote

Code:
//***********************************************
//GETMATCH EXEC PGM=SYNCTOOL                     
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG   DD SYSOUT=*                           
//IN       DD *                                 
----+----1----+----2----+----3----+----4----+----
DDA8000000000000978300012111120                 
DDA8000000000000978300013111120                 
DDA4000000000000978500001120000                 
DDA4000000000000978500001320000                 
DDA8000000000000978623456789123                 
REA4500000000000978700123456789                 
REA8000000000000978800170000000                 
/*                                               
//OUT      DD SYSOUT=*                           
//TOOLIN   DD *                                 
         SELECT FROM(IN) TO(OUT) ON(6,15,CH) LAST
/*     

OUT:
Code:
DDA8000000000000978300013111120
DDA4000000000000978500001320000
DDA8000000000000978623456789123
REA4500000000000978700123456789
REA8000000000000978800170000000
Back to top
View user's profile Send private message
ameenansari

New User


Joined: 18 Sep 2006
Posts: 11
Location: chennai

PostPosted: Wed Dec 12, 2007 5:29 pm    Post subject:
Reply with quote

Pratap,

I/P:-(INSC.DEC12)-VB OF2004 RECLENGTH

DDA8000000000000978300012111120
DDA8000000000000978300013111120
DDA4000000000000978500001120000
DDA4000000000000978500001320000
DDA8000000000000978623456789123
REA4500000000000978700123456789
REA8000000000000978800170000000


SORT JCL:

//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD DSN=INSC.DEC12,DISP=SHR
//SYSIN DD *
SORT FIELDS=(10,15,ZD,A)
SUM FIELDS=NONE
/*



SORTOUT:-

DDA8000000000000978300012111120
DDA4000000000000978500001120000
DDA8000000000000978623456789123
REA4500000000000978700123456789
REA8000000000000978800170000000

I got your output with this simple sort. Is this your requirement?. Wat is the use for getting last record of duplicates.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Dec 13, 2007 10:00 am    Post subject:
Reply with quote

Quote:
I got your output with this simple sort. Is this your requirement?. Wat is the use for getting last record of duplicates.


As far as the Input given by abhay is considered, it doesn't make any difference...because in the input given, he has the same value in all the columns for the duplicate records..

But the difference comes when there are different values in fields which are outside the SORT fields.. i.e. other than the (6,15) columns..

For example, consider this i/p
DDB8000000000000978300012111120
DDA8000000000000978300013111120

In this case, If we use the sort card given by u, it will return the first record. But if u use the SYNCTOOL with LAST option, it will return the last record of the duplicate..(Duplicate is determined only on the values for which u r doing the sort)..
There lies the difference!!!

I beleive i am not wrong here..Otherwise please correct me... icon_smile.gif
Back to top
View user's profile Send private message
ameenansari

New User


Joined: 18 Sep 2006
Posts: 11
Location: chennai

PostPosted: Thu Dec 13, 2007 1:08 pm    Post subject:
Reply with quote

Ya. i got it. thanks raak
Back to top
View user's profile Send private message
abhay pratap singh

New User


Joined: 22 Nov 2007
Posts: 77
Location: noida

PostPosted: Thu Dec 13, 2007 1:40 pm    Post subject:
Reply with quote

Thanks to all for responding, solution provided by krisprem ithru icetool is working.
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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