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 

Comparing files using SYNCSORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
patnekar
Beginner


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Thu Nov 06, 2003 11:44 am    Post subject: Comparing files using SYNCSORT Reply with quote

Hi,
I have 2 files say A and B

Both have LERCL=80 and RECFM=FB. I have to strip matching records from FILE-B based on records in FILE-A.

Code:

File-A
------
AAAA
BBBB
CCCC

File-B
------
AAAA    1111
AAAA    2222
BBBB    2122
BBBB    2212
EEEE    1212
FFFF    3323
FFFF    4423
DDDD    1212

My output should be
------ ------ ------
AAAA    1111
AAAA    2222
BBBB    2122
BBBB    2212





I have explored these 2 links

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


But my shop does not have easytrieve and DFSORT ( preventing the use of SPLICE). I have SYNCSORT and INSYNC at my shop.

Since file-B has duplicates, I am finding it difficult to strip the matching records.

It would be great if anyone can help me out with this, using either SYNCSORT or INSYNC.

Thanks,
Puru
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Nov 06, 2003 12:14 pm    Post subject: Reply with quote

Puru,

What is the maximum records in FILE-A? Also what is the length of the key ?

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


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Thu Nov 06, 2003 12:17 pm    Post subject: Reply with quote

Kolusu,
I have around 100,000 records in FILE-A. FILE-B has around a million records.
The length of the sort key(for the above example) is 4. In practice this will be 13 bytes in char format.

Thanks,
Puru
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Nov 06, 2003 12:25 pm    Post subject: Reply with quote

Puru,

100,000 records are too much for generating the include/omit cards. I can't think of any way to do it using syncsort built-in features. I Don't know INSYNC, so I cannot speak about that.

I guess you are better off coding a cobol program. You can use the logic in this topic

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

Hope this helps...

cheers

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


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Thu Nov 06, 2003 12:32 pm    Post subject: Reply with quote

Kolusu,
Thank you. I think I'll go in for the COBOL pgm itself.

Thanks,
Puru
Back to top
View user's profile Send private message Yahoo Messenger
patnekar
Beginner


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Thu Nov 06, 2003 6:15 pm    Post subject: Reply with quote

Kolusu,
Incase FILE-A has around 100 records and FILE-B has a million records and the sort length is still 13 bytes, how do I generate INCLUDE/OMIT cards??

Thanks

Puru
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Nov 07, 2003 9:06 am    Post subject: Reply with quote

Puru,
The following JCL will give you the desired results. I assumed that the key in both the files starts in position 1 for a length of 13. The first copy will generate the include condition keys.The second copy will extract the keys in the include condition from file-b.

Code:

//STEP0100 EXEC PGM=SYNCTOOL                                   
//TOOLMSG   DD SYSOUT=*                                         
//DFSMSG    DD SYSOUT=*                                         
//IN1       DD DSN=YOUR INPUT FILE-A,
//             DISP=SHR
//IN2       DD DSN=YOUR INPUT FILE-B,
//             DISP=SHR
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//OUT       DD DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *                                               
   COPY FROM(IN1) USING(CTL1)                                   
   COPY FROM(IN2) TO(OUT) USING(CTL2)                           
//CTL1CNTL DD *                                       
   OUTFIL FNAMES=T1,                                   
   OUTREC=(C' 1,13,CH,EQ,C''',1,13,C''',OR,',80:X)     
//CTL2CNTL DD *                                       
   INCLUDE COND=(1,13,CH,EQ,C'TRUE COND    ',OR,       
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1           
//         DD *                                       
                 1,13,CH,EQ,C'FALSE COND   ')         
//*                                                   


Hope this helps...

cheers

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


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Fri Nov 07, 2003 9:46 am    Post subject: Reply with quote

Kolusu,
Thanks a ton. Alternatively I used INSYNC to generate a sort card, and then used that sort card to strip FILE-B

This is what I used

Code:


//STEP01   EXEC PGM=INSYNC                             
//#PRINT   DD SYSOUT=*                               
//#LOG     DD SYSOUT=*                               
//#INDD    DD DSN=MY.INPUT.FILE-A,DISP=SHR
//#OUTDD   DD DSN=&&TEMP1,DISP=(,PASS)               
//#PARM    DD *                                       
FUNCTION=FIELDMAP                                     
MOVE=(2,21,C,C"        1,13,CH,EQ,C'")                 
MOVE=(23,13,C,1,13,C)                                 
MOVE=(36,6,C,C"',OR,")                                 
/*                                                     
//STEP02   EXEC PGM=SORT                               
//SYSPRINT DD SYSOUT=*                                 
//SYSUDUMP DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=MY.HEADER.FILE,DISP=SHR 
//         DD DSN=&&TEMP1,DISP=SHR                     
//         DD DSN=MY.TRL.FILE,DISP=SHR
//SORTOUT  DD DSN=&&TEMP2,DISP=(,PASS)                 
//SYSIN    DD *                                       
 SORT FIELDS=COPY,EQUALS                               
/*                                                     
//STEP03   EXEC PGM=SORT                               
//SYSPRINT DD SYSOUT=*                                 
//SYSUDUMP DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD DSN=MY.INPUT.FILE-B,DISP=SHR
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD DSN=&&TEMP2,DISP=SHR                     
/*                                                     


Code:


MY.HEADER.FILE, contains the following

  SORT FIELDS=COPY
  INCLUDE COND=(1,13,CH,EQ,C'HEADERDUMMY11',OR,

MY.TLR.FILE, contains the following

  INCLUDE COND=(1,13,CH,EQ,C'TRAILERDUMMY1')



However I was unable to understand the second sort card in your JCL. Could you please explain the same?? Or atleast direct me to any link which will shed more light??

Code:


//CTL2CNTL DD *                                       
   INCLUDE COND=(1,13,CH,EQ,C'TRUE COND    ',OR,       
//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1           
//         DD *                                       
                 1,13,CH,EQ,C'FALSE COND   ')         
//*                                                   



Thanks,

Puru
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Nov 07, 2003 10:11 am    Post subject: Reply with quote

Puru,

Did you job actually run without any syntax error? you cannot have 2 include cond parms in your JCL. Your trailer file should only have

Code:

      1,13,CH,EQ,C'TRAILERDUMMY1')


Quote:

However I was unable to understand the second sort card in your JCL. Could you please explain the same?? Or atleast direct me to any link which will shed more light??


I am doing the same thing as you are doing.

Code:

 INCLUDE COND=(1,13,CH,EQ,C'TRUE COND    ',OR,   


That is equivalent to your Header file record. I just used a true and false condition.you put this in a file and I just coded in instream.

And I am concating the generated include cond from the first copy operation.

Code:

//         DD DSN=&T1,DISP=OLD,VOL=REF=*.T1       


And finally I am closing the include cond with a false cond which is similar to your trailer file.

Code:

                 1,13,CH,EQ,C'FALSE COND   ')


Basically the CTL2CNTL at the time of execuetion will be as follows
Code:

 INCLUDE COND=(1,13,CH,EQ,C'TRUE COND    ',OR,       
               1,13,CH,EQ,C'AAAAAAAAAAAAA',OR,                     
               1,13,CH,EQ,C'BBBBBBBBBBBBB',OR,                     
               1,13,CH,EQ,C'CCCCCCCCCCCCC',OR,
               .....                         
               1,13,CH,EQ,C'FALSE COND   ')         


Hope this helps...

cheers

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


Joined: 27 Jan 2003
Posts: 41
Topics: 16

PostPosted: Fri Nov 07, 2003 11:00 am    Post subject: Reply with quote

Kolusu,
I fell again to copy/paste Sad. Actualy the TLR contains only

1,13,CH,EQ,C'TRAILERDUMMY1')

Thanks for your time and detailed explanation.

Thanks,
Puru
Back to top
View user's profile Send private message Yahoo Messenger
Mukunda
Beginner


Joined: 11 Dec 2002
Posts: 46
Topics: 15

PostPosted: Sat Nov 08, 2003 9:18 pm    Post subject: Reply with quote

Kolusu
This is absolute genius Exclamation You are wonderful Very Happy
Back to top
View user's profile Send private message
lal
Beginner


Joined: 21 Oct 2003
Posts: 70
Topics: 25

PostPosted: Fri Jul 23, 2004 1:40 am    Post subject: Comparing files using SYNCSORT Reply with quote

Hi Kolusu,
I tried to use your JCL..but

//STEP0100 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=YOUR INPUT FILE-A,
// DISP=SHR
//IN2 DD DSN=YOUR INPUT FILE-B,
// DISP=SHR
//T1 DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD DSN=YOUR OUTPUT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,
OUTREC=(C' 1,13,CH,EQ,C''',1,13,C''',OR,',80:X)
//CTL2CNTL DD *
INCLUDE COND=(1,13,CH,EQ,C'TRUE COND ',OR,
// DD DSN=&T1,DISP=OLD,VOL=REF=*.T1
// DD *
1,13,CH,EQ,C'FALSE COND ')
//*

But I am getting an error like

WER428I CALLER-PROVIDED IDENTIFIER IS "0002"
WER002A EXCESS CARDS

The problem is the FILEA is having large number of records like 20000. So is there any way of solving this.
Please let me know..

Thanks,
Lal
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: Fri Jul 23, 2004 5:33 am    Post subject: Reply with quote

Lal,

If you have 20,000 include conditions, you CANNOT use synctool. Go with easytrieve or Cobol solution

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 -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
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