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 

Compare 2 Files using sort
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
sateesh_gontla
Beginner


Joined: 23 Jan 2004
Posts: 40
Topics: 16
Location: Bangalore

PostPosted: Tue Nov 01, 2005 2:51 pm    Post subject: Compare 2 Files using sort Reply with quote

Hi

We have 2 files with length 80 bytes each and we need to compare the first 10 bytes of each record in the file and and write the entire record into output if they are equal(first 10 bytes).

Please advise on this ......

Regards,
Sateesh
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Nov 01, 2005 2:56 pm    Post subject: Reply with quote

sateesh_gontla,

please search before posting. check these links

http://www.mvsforums.com/helpboards/viewtopic.php?t=11&highlight=match

http://www.mvsforums.com/helpboards/viewtopic.php?t=4690&highlight=joinkeys

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
sateesh_gontla
Beginner


Joined: 23 Jan 2004
Posts: 40
Topics: 16
Location: Bangalore

PostPosted: Tue Nov 01, 2005 3:05 pm    Post subject: Reply with quote

Hi Kolusu,

Sorry ....Our question was not clear.

We have

File 1

12345 xxxxxxxxxxxxxxxxxxxxxxxxxx
23456 xxxxxxxxxxxxxxxxxxxxxxxxxx

File 2

12345 yyyyyyyyyyyyyyyyyyyyyyyyyy
99999 xxxxxxxxxxxxxxxxxxxxxxxxxx


Output we need like this :

Out file :

12345 xxxxxxxxxxxxxxxxxxxxxxxxxxx
12345 yyyyyyyyyyyyyyyyyyyyyyyyyy


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


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

PostPosted: Tue Nov 01, 2005 3:11 pm    Post subject: Reply with quote

sateesh_gontla,

Just concatenate the 2 files to IN dd name in the jcl shown in this topic.

http://www.mvsforums.com/helpboards/viewtopic.php?t=9&highlight=alldups

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
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Nov 01, 2005 4:42 pm    Post subject: Compare two files using sort Reply with quote

Kolusu,

I have a requirement in which i want to compare two input files both of same format and length of only the first 5 bytes ,if they are equal i want to write those particluar records into a separate file without duplicates.


Code:

TECH022.DATA.ICE1
********************************* Top of Data **********************************
12345 RAM                                                                       
33333 SENTHIL                                                                   
78888 VENU                                                                     
******************************** Bottom of Data ********************************

TECH022.DATA.ICE2
********************************* Top of Data **********************************
12345 RAM                                                                       
21156 MAHESH                                                                   
33333 SENTHIL                                                                   
78900 PRAKASH                                                                   
******************************** Bottom of Data ********************************


So i tried your JCL like below but i am not getting the desired output which i am expecting ,moreover i am getting records in duplicate.

Code:

//TECH022R JOB (TEST),'SORTJCLK',CLASS=A,MSGLEVEL=(1,),
//             MSGCLASS=W,NOTIFY=&SYSUID                   
//STEP0001 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD DSN=TECH022.DATA.ICE1,DISP=SHR               
//         DD DSN=TECH022.DATA.ICE2,DISP=SHR               
//OUT      DD DSN=TECH022.DATA.ICEOUT,DISP=SHR             
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) ALLDUPS               
/*                                                         
//




OUTPUT
---------

Code:

********************************* Top of Data **********************************
12345 RAM                                                                       
12345 RAM                                                                       
33333 SENTHIL                                                                   
33333 SENTHIL                                                                   
******************************** Bottom of Data ********************************




DESIRED OUTPUT
--------------------

Code:

********************************* Top of Data **********************************
12345 RAM                                                                       
33333 SENTHIL                                                                   
******************************** Bottom of Data ********************************



My understanding is that if we are using keyword ALLDUPS,the duplicate records are being printed in the output file.But if i am using keyword NODUPS i am getting the output below with non matching records,that means the records not matching are printed in the output file.Please guide me how do i get my desired output.

Code:

//TECH022R JOB (TEST),'SORTJCLK',CLASS=A,MSGLEVEL=(1,),
//             MSGCLASS=W,NOTIFY=&SYSUID                   
//STEP0001 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD DSN=TECH022.DATA.ICE1,DISP=SHR               
//         DD DSN=TECH022.DATA.ICE2,DISP=SHR               
//OUT      DD DSN=TECH022.DATA.ICEOUT,DISP=SHR             
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) NODUPS             
/*                                                         
//



OUTPUT
----------

Code:

********************************* Top of Data **********************************
21156 MAHESH                                                                   
78888 VENU                                                                     
78900 PRAKASH                                                                   
******************************** Bottom of Data ********************************


_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Tue Nov 01, 2005 5:01 pm    Post subject: Reply with quote

Code:

//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD *
12345 RAM
33333 SENTHIL
78888 VENU
//         DD *
12345 RAM
21156 MAHESH
33333 SENTHIL
78900 PRAKASH
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT      DD SYSOUT=*
//TOOLIN   DD *
  SELECT FROM(IN) TO(T1) ON(1,5,CH) ALLDUPS
  SELECT FROM(T1) TO(OUT) ON(1,5,CH) FIRST
/*
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Nov 01, 2005 5:11 pm    Post subject: Reply with quote

Ravi,

You don't need 2 passes to get the desired data.

shekhar123,

Try this jcl.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=YOUR INPUT FILE1,
//            DISP=SHR
//         DD DSN=YOUR INPUT FILE2,
//            DISP=SHR
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTIONS EQUALS
  INREC FIELDS=(1,80,C'00000001')
  SORT FIELDS=(1,5,CH,A)
  SUM FIELDS=(81,8,ZD)
  OUTFIL INCLUDE=(81,8,ZD,GT,1),
  OUTREC=(1,80)
/*


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
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Tue Nov 01, 2005 5:12 pm    Post subject: Reply with quote

The earlier was a Evil or Very Mad solution/post. Here is the correct version.
Code:
//STEP0001 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SAVEDD   DD SYSOUT=*
//IN       DD *
12345 RAM
33333 SENTHIL
78888 VENU
//         DD *
12345 RAM
21156 MAHESH
33333 SENTHIL
78900 PRAKASH
//OUT      DD SYSOUT=*
//TOOLIN   DD *
  SELECT FROM(IN) TO(OUT) ON(1,5,CH) FIRSTDUP
/*


shekar123 please use QW SELECT if you are having quick reference installed in your shop
Back to top
View user's profile Send private message
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Tue Nov 01, 2005 5:16 pm    Post subject: Reply with quote

Thank God!! Its not the same solution. I was thinking its a stupid solution but later came up with a better one.

Sad My # of posts is just 5 and am a Beginner
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: Tue Nov 01, 2005 5:31 pm    Post subject: Reply with quote

Shekar123 wrote
Quote:
My understanding is that if we are using keyword ALLDUPS,the duplicate records are being printed in the output file.But if i am using keyword NODUPS i am getting the output below with non matching records,that means the records not matching are printed in the output file.Please guide me how do i get my desired output.


You need to understand what each of the DFSORT/ICETOOL SELECT criteria keywords does in order to pick the right keyword. ALLDUPS selects all of the matched records. NODUPS selects each non-matched record. FIRSTDUP selects the first record of the matched records. FIRST selects the first record of the matched records and each non-matched record. And so on.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

BTW, Kolusu is not the only person on this board who can answer questions so you might not want to address your questions only to him. Admittedly, Kolusu usually responds faster than anybody else on this board and has a great deal of knowledge about a great deal of subjects. But some of the rest of us do occasionally get to answer a question here, and do have some specific knowledge. (FYI, I'm the DFSORT developer who "invented" DFSORT's ICETOOL and added every new function to it so I do know a bit about it). Wink
_________________
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
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Tue Nov 01, 2005 5:40 pm    Post subject: Reply with quote

Quote:

Admittedly, Kolusu usually responds faster than anybody else on this board and has a great deal of knowledge about a great deal of subjects. But some of the rest of us do occasionally get to answer a question here, and do have some specific knowledge

I second this. Sometimes I feel why am I soo slow in thinking abt the solution. Or soo Stupid... Rolling Eyes in giving solutions.

I think the best time you can respond to solutions is night (USA). ... By the way kolusu, when do you sleep ...
Back to top
View user's profile Send private message
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Tue Nov 01, 2005 6:01 pm    Post subject: Reply with quote

Kolusu.. (Asking him as hez the site moderator) Plz give me edit access for my posts.


>>>Think I have told you Frank, I love your signature and wish I could have something like that.. You are one of the persons who I know (thru this site) and has given solutions continously. I remember you just like my Math teacher.

(a+b)<sup>2</sup>= a <sup>2</sup>+ b <sup>2</sup> + 2 ab

The documentation of DFSORT is really good and its with lot of examples. We have SYNCSORT in our shop and I cannot make use of SPLICE operator. But felt that thru SORT utility we can avoid a lot of simple PL1/COBOL coding. Due to your helpful hints and solutions I now know a bit in using SORT utility.
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: Tue Nov 01, 2005 6:45 pm    Post subject: Reply with quote

Ravi wrote
Quote:
Frank, I love your signature and wish I could have something like that


Well, thanks for the kind words, but the only way you could have a signature like mine would be if you were on the DFSORT Team. Smile Did you perhaps mean my avatar (Professor Rat)? Kolusu was kind enough to help me set it up on this site. I really like it since it reminds me of my wonderful pet rats (Rose, Gracie, April and June).

As to how Kolusu answers so fast, I'm guessing that he monitors the site at least once every ten minutes. Laughing
_________________
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
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Nov 02, 2005 12:52 am    Post subject: Compare 2 Files using sort Reply with quote

Hi Frank Yaeger,

I really did not mean to address my query to Kolusu only(specific),actually if you see to what i have questioned,it is a continuation of Kolusu's replies to Sateesh_gontla.I just wanted to try out for my learning purpose.I have no intention in higlighting only one person in our forum and all our moderators are well experienced in the technologies and i have a gained a lot in improving my skills after i have joined this website.The answers to queries posted by members is answered in no time and this is the best site as of my knowledge.And for a beginer like me i cannot think of anything else / training to improve skills other than this website.

Frank,I was really surprised to see the links provided by and yourself being the part of DFSORT team .The content and the examples in the mini tutorial will defintely help me a lot and i have started reading through basic chapters.It is nice to have a experienced person like you as one of our moderator in specific area who can share wide experince with the members.

Well regarding Kolusu,i guess and i see that he answers to questions well early in the morning before 5:AM USA time as he gets up and i cannot say any more words for the work he does for our website.He for sure refreshes the helpboards screen surely once every ten minutes.Moderators please do keep up the good work you people are doing.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Nov 02, 2005 5:22 am    Post subject: Reply with quote

Quote:

Admittedly, Kolusu usually responds faster than anybody else on this board and has a great deal of knowledge about a great deal of subjects. But some of the rest of us do occasionally get to answer a question here, and do have some specific knowledge. (FYI, I'm the DFSORT developer who "invented" DFSORT's ICETOOL and added every new function to it so I do know a bit about it).


I try to correct users whenever I can. The worse is I also get credit for not answering the question as most of the new users think that I answered the question by default.

Quote:

As to how Kolusu answers so fast, I'm guessing that he monitors the site at least once every ten minutes.


I usually get a notification when a new post comes thru. So I just look at it right away If I am not busy. If a Solution does not require any testing then I right away answer it.

Quote:

Well regarding Kolusu,i guess and i see that he answers to questions well early in the morning before 5:AM USA time as he gets up and i cannot say any more words for the work he does for our website.


Well my typical day begins at 5 AM . I just answer questions before going to work and monitor the board from work.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
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