MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the difference records from 2 files using sort?
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Thu Jan 09, 2003 10:28 am    Post subject: How to get the difference records from 2 files using sort? Reply with quote

I have two files:

MAINFILE : Which contains say 1000 records
SUBSET: Which contains 700 records out of 1000 records of main file

Now I want to put the remaining 300 hundred records which are there in MAINFILE but not in SUBSET , in a new different file (DIFFILE)

All files are similar FB sequential files of lrecl 133.

How can I do this using SYNCSORT or DFSORT.

Please help.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jan 09, 2003 10:39 am    Post subject: Reply with quote

Naveen,


Does any of the files contain duplicates??

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Fri Jan 10, 2003 12:33 am    Post subject: Reply with quote

No
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jan 10, 2003 1:17 am    Post subject: Reply with quote

Naveeen,

The following DFSORT/ICETOOL JCL will give you the desired results.If you have syncsort at your shop then change the pgm name to synctool.We concatenate both the files together and using select operator with NODUPS parm we will get the desired results.

Code:

//STEP100 EXEC PGM=ICETOOL   
//*             
//TOOLMSG DD SYSOUT=*                     
//DFSMSG  DD SYSOUT=*                     
//INPUT   DD DSN=YOUR MAINFILE,
//           DISP=SHR
//        DD DSN=YOUR SUBSET FILE,
//           DISP=SHR
//DIFFILE DD DSN=YOUR OUTPUT DSN,
//           DISP=(NEW,CATLG,DELETE),
//           UNIT=SYSDA,
//           SPACE=(CYL,(X,Y),RLSE)
//TOOLIN  DD *                             
  SELECT FROM(INPUT) TO(DIFFILE) ON(1,133,CH) NODUPS
/*     


If you get an error that the ON condition exceeds the max length of the field, then change the statement to the following
Code:

  SELECT FROM(INPUT) TO(DIFFILE) ON(1,80,CH) ON(81,53,CH) NODUPS


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Fri Jan 10, 2003 4:39 am    Post subject: Reply with quote

In my shop , ICETOOLs are not available. Can this be done using Syncsort or ICEMAN or any other thing. (ICEMAN works on my shop)
Back to top
View user's profile Send private message Send e-mail
Mike Tebb
Beginner


Joined: 02 Dec 2002
Posts: 20
Topics: 0
Location: Yorkshire, England

PostPosted: Fri Jan 10, 2003 5:19 am    Post subject: Reply with quote

As Kolusu mentioned you can substitute ICETOOL with SYNCTOOL if you are in a SYNCSORT shop.
_________________
Cheers - Mike
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jan 10, 2003 12:12 pm    Post subject: Reply with quote

Naveen,

Some clarification of terminology for your future use to avoid confusion:

--
ICETOOL is part of DFSORT. ICEMAN and SORT can be used as the entry point (PGM=ICEMAN) for DFSORT or Syncsort, so saying ICEMAN works does not really say anything about which sort product you have. In your case, since you have Syncsort, ICEMAN is used as the entry for Syncsort.
--

Note that DFSORT's ICETOOL allows CH ON fields up to 1500 bytes so you can use ON(1,133,CH). SYNCTOOL only allows CH ON fields up to 80 bytes.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Sat Jan 11, 2003 1:37 am    Post subject: Reply with quote

Frank , I am now much more confused with the terminology after reading your post . Do you mean to say DFSORT and SYNCSORT are entirely different products.

Can you please explain me , what exactly are following things and relation between them:

1. Syncsort
2. Dfsort
3. ICETOOL
4. ICEMAN
5 .SORT


In my shop , most of the times I use , EXEC PGM = SORT for sorting.
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Sat Jan 11, 2003 10:21 am    Post subject: Reply with quote

Naveen,

Yes, DFSORT and Syncsort are entirely different products.

1. Syncsort is the sort product from Syncsort, Inc.

2. DFSORT is the sort product from IBM.

3. ICETOOL is a fully documented multipurpose utility that is part of and shipped with DFSORT. PGM=ICETOOL will execute DFSORT's ICETOOL.

4. ICEMAN is an entry point for DFSORT and Syncsort. PGM=ICEMAN will execute DFSORT or Syncsort, depending on how they are installed at a particular shop.

Actually, "ICE" is the three character prefix assigned to DFSORT by IBM, so all of the DFSORT modules and messages start with "ICE". But Syncsort also ships ICEMAN as an alias for their product. Syncsort's messages start with "WER".

5. SORT is an entry point for DFSORT and Syncsort. PGM=SORT will execute DFSORT or Syncsort, depending on how they are installed at a particular shop.

6. ICEGENER is a "replacement" for IEBGENER that is part of and shipped with DFSORT. PGM=ICEGENER will execute DFSORT's ICEGENER. ICEGENER can also be installed as an automatic replacement for IEBGENER so that PGM=IEBGENER will execute ICEGENER.

I hope this helps clarify things.

Note that you can find a great deal of information about DFSORT at the DFSORT website:

http://www.storage.ibm.com/software/sort/mvs/srtmprd.html

In addition, all of the DFSORT books are online and can be accessed from:

http://www.storage.ibm.com/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
naveen
Beginner


Joined: 03 Dec 2002
Posts: 90
Topics: 31

PostPosted: Mon Jan 13, 2003 12:02 am    Post subject: Reply with quote

Frank,

Thanks a lot for Information.
Back to top
View user's profile Send private message Send e-mail
Sqlcode
Intermediate


Joined: 15 Dec 2006
Posts: 157
Topics: 38

PostPosted: Tue Jan 02, 2007 8:55 am    Post subject: Reply with quote

Try this one.

Code:
//STEP3    EXEC PGM=SORT                     
//SORTLIB  DD DSN=SYS1.SORTLIB,DISP=SHR                       
//SYSIN    DD *                                               
 SORT FIELDS=COPY
 SUM FIELDS=(NONE),XSUM                                       
//SORTWK01 DD UNIT=SYSDA,SPACE=(6120,(100,150),,,ROUND)       
//SORTWK02 DD UNIT=SYSDA,SPACE=(6120,(100,150),,,ROUND)       
//SORTWK03 DD UNIT=SYSDA,SPACE=(6120,(100,150),,,ROUND)       
//SORTIN   DD DSN=INPUT.DATASET,   
//            DISP=SHR                                         
//SORTOUT  DD  DSN=OUTPUT.DATASET.DUP,
//            DISP=(NEW,CATLG),                               
//            SPACE=(CYL,(210,105),RLSE)                       
//*           DCB=(LRECL=320,RECFM=FB,BLKSIZE=32640)           
//SORTXSUM DD DSN=OUTPUT.DATASET.NODUP, 
//            DISP=(NEW,CATLG),                               
//            SPACE=(CYL,(210,105),RLSE)                       


Let me know if it worked or not.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jan 02, 2007 9:23 am    Post subject: Reply with quote

Rajen,

Your solution with sortxsum will NOT work as the poster wanted all the records which are not matched in the main set. XSUM feature is used to get the Duplicate records into a seperate dataset.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vak255
Intermediate


Joined: 10 Sep 2004
Posts: 384
Topics: 79

PostPosted: Mon Jun 11, 2007 10:17 am    Post subject: Reply with quote

Kolusu,

I have a similar requirement but here I want to get the record that is there on both the files. I browsed the manual and tried with equal but getting

Quote:

SYT002I "TOOLIN" INTERFACE BEING USED

SELECT FROM(INPUT) TO(DIFFILE) ON(1,13,CH) EQUAL
SYT068E INVALID "EQUAL" OPERAND


Input file1:
0061030000590
0091095002121
0520010017568
0520010043088
0520010044902
0520010075372


Input file2:
0091095002121
0520010017568
0520010079714

desired output:
0091095002121
0520010017568
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jun 11, 2007 10:30 am    Post subject: Reply with quote

vak255,

You are using a PARM EQUAL on SELECT statment but you need to mention a value with EQUAL

Ex: EQUAL(2) this will select the records where ON value occurs 2 times. But then your output will have 4 records if you use that. You just need 1 record. so try this . Your desired output will be in the SORTXSUM DD.

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *           
0061030000590             
0091095002121             
0520010017568             
0520010043088             
0520010044902             
0520010075372             
0091095002121             
0520010017568             
0520010079714             
//SORTOUT  DD DUMMY       
//SORTXSUM DD SYSOUT=*     
//SYSIN    DD *           
 SORT FIELDS=(01,13,CH,A) 
 SUM FIELDS=NONE,XSUM     
/*                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Jun 11, 2007 10:32 am    Post subject: Reply with quote

vak255,

Quote:

I browsed the manual and tried with equal but getting


If you go through the manual again, you would find that the EQUAL operator requires a argument to be passed to it.

The actual syntax is EQUAL(v)

Code:

EQUAL(v) Limits the records selected to those with ON values that occur v times (value count = v). You can use this operand to keep just those records with field values that occur v times. v must be specified as n or +n where n can be 0 to 99.


Thanks,
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group