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 blocks of data

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


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Wed Apr 22, 2009 2:32 pm    Post subject: Compare blocks of data Reply with quote

Hi All,

I need to compare blocks of records based on the rules given below.

Example

Record lenght : 80 bytes :
Dept NUM start pos : 22

Rule :

- Compare the 1st 3 character from both the files. If they match.
- Compare the Dept num. ( which is always in the AB100 card). If it matches.
- compare all other fields in the AB*** records. If they dont match , mark such records and output them



Code:


FILE 1 :
ABC00   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX20090126                       
ABC01   200901300000000000YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
ABC02   00000000000                 00000000001596908                   
AB100   XXXXXX111111<9 DIGITNUM>XXXXXXXXXXX20090126                       
AB101   2009013040000000000435250000000000435250000000000000000000000002
AB102                         000000000000000                           

File 2 :
ABC00   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX20090126                       
ABC01   200901300000000000YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
ABC02   00000000000                 00000000001596908                   
AB100   XXXXXX111111<9 DIGITNUM>XXXXXXXXXXX20090126                       
AB101   2009013040000000000435250000000000435250000000000000000000000002
AB102                         000000000000000





Thanks,
Martin
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: Wed Apr 22, 2009 2:44 pm    Post subject: Reply with quote

Martin,

1. What is the expected output from the above?
2. What do you mean by Blocks of data? isnt it comparing record by record?. If the first 3 bytes are the key , how do you map which record is to be compared from second file?

Like ABC00 should be compared with ABC00 or it should be compared with all of the ABC records from file2?

4.How do you distinguish the start and end of each group?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Wed Apr 22, 2009 2:58 pm    Post subject: Reply with quote

Hi Kolusu ,

Answers :

1 . Output will contain the entire block of records. ( both from file 1 and file 2)
2. I need to compare all the AB*** records only when 1st 3 digits and the dept num match.
3. Yes... corresponding ABC00 should be compared.
4. Start is ABC00 record and end id AB102 record


Thanks,
Martin
Back to top
View user's profile Send private message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Thu Apr 23, 2009 7:14 pm    Post subject: Reply with quote

Hi Kolusu,

Could you please let me know if this can be achieved using SORT?
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: Fri Apr 24, 2009 1:00 pm    Post subject: Reply with quote

Martin wrote:
Hi Kolusu,

Could you please let me know if this can be achieved using SORT?


well I think it can be done , but I just don't have that much time to solve it
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Apr 24, 2009 6:32 pm    Post subject: Reply with quote

Martin,

The following DFSORT JCL will give you the desired results

Brief explanation of the job.

1. STEP0100 & STEP0200 both will tag the DEPT NUM which is present on the AB100 to at the end of every record for each block in each file

2. Now concatenate these 2 files together and sort on the deptnum as key and the whole 80 bytes . By doing so we will merge if the records are the same from both the files.

3. The last pass is checking if there is no match in any one of the records within a group, if differences are found we will write out the records. Pos 81-82 will F1 denoting it is File1 record and F2 deonotes File2 record



Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=your 80 byte file1,
//            DISP=SHR
//SORTOUT  DD DSN=&&I1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)           
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'ABC00'),               
  END=(1,5,CH,EQ,C'AB102'),PUSH=(81:ID=8,SEQ=1)),                     
  IFTHEN=(WHEN=(1,5,CH,EQ,C'AB100'),OVERLAY=(90:22,9))               
  SORT FIELDS=(81,8,CH,A,90,9,CH,D)                                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'AB100'),PUSH=(90:90,9))
  OUTFIL BUILD=(1,80,90,9,89,1,C'1')                                 
//*                                                                   
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=your 80 byte file2,
//            DISP=SHR
//SORTOUT  DD DSN=&&I2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)             
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'ABC00'),                 
  END=(1,5,CH,EQ,C'AB102'),PUSH=(81:ID=8,SEQ=1)),                     
  IFTHEN=(WHEN=(1,5,CH,EQ,C'AB100'),OVERLAY=(90:22,9))                 
  SORT FIELDS=(81,8,CH,A,90,9,CH,D)                                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'AB100'),PUSH=(90:90,9))
  OUTFIL BUILD=(1,80,90,9,89,1,C'2')                                   
//*     
//STEP0300 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&&I1,DISP=SHR                                   
//         DD DSN=&&I2,DISP=SHR                                   
//SORTOUT  DD DSN=&&I3,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)       
//SYSIN    DD *                                                   
  OPTION EQUALS                                                   
  SORT FIELDS=(81,10,CH,A,1,80,CH,A)                             
  SUM FIELDS=(91,1,ZD)                                           
  OUTFIL REMOVECC,BUILD=(1,91,X),                                 
  SECTIONS=(81,9,                                                 
  TRAILER3=(80X,81,9,C'00',MIN=(91,1,ZD,ZD,LENGTH=1)))           
//*                                                               
//STEP0400 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=&&I3,DISP=SHR                                   
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  OPTION EQUALS                                                   
  SORT FIELDS=(81,10,CH,A)                                       
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(90,1,ZD,EQ,0),PUSH=(92:92,1)) 
  OUTFIL IFOUTLEN=82,                                             
  OMIT=(90,2,ZD,EQ,0,OR,91,2,ZD,EQ,33),                           
  IFTHEN=(WHEN=(91,1,ZD,EQ,1),BUILD=(1,80,C'F1')),               
  IFTHEN=(WHEN=(91,1,ZD,EQ,2),BUILD=(1,80,C'F2')),               
  IFTHEN=(WHEN=(91,1,ZD,EQ,3),BUILD=(1,80,C'F1',/,1,80,C'F2'))   
/*

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


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Sat Apr 25, 2009 12:24 pm    Post subject: Reply with quote

Thanks a lot Kolusu !! Very Happy
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
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