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 

File compare

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


Joined: 14 Sep 2005
Posts: 18
Topics: 8

PostPosted: Mon Nov 14, 2005 2:18 am    Post subject: File compare Reply with quote

Could you please help me if this file comparison can be done using SYNCSORT?

My requirement is
File 1

Record length 120
Code:

Field-1 X(1)
Field-2 X(9)
Field-4 S9(10)V999 COMP-3
Field-5 S9(10)V999 COMP-3
Field-6 X (96)

F1       F2         F4             F5        F6
X    abc123451       1              5        Spaces
Y    abc123452       2              6        Spaces
X    abc123453       3              7        Spaces 
Y    abc123454       4              8        Spaces 


File-2
Code:

Record length 40
Field-1 X(09)
Field-2 X(09)
Field-3 X(22)

F1           F2      F3
abc123451 bbc123451 Spaces
abc123452 bbc123451 Spaces
abc123459 bbc123451 Spaces


Final Output file should be

Output
Record length 120
Code:

F1      F2         F4               F5      F6
X     bbc123451     3               11      SPACES
X     abc123453     3               7       SPACES
Y     abc123454     4               8       SPACES


If the File1 Field2 matches with File2 Field1 then the File2 Field 2 should be replaced in File1 Field 2. After replacing the results should be summed (Field 4 & Field 5).Both the keys fields are unique. I don
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 Nov 14, 2005 7:28 am    Post subject: Reply with quote

Quote:

After replacing the results should be summed (Field 4 & Field 5).


Suresh05,

hmm I don'see the summing part. How did you get 3 and 11 for f4 and f5 fields in the output for the key abc123451?

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


Joined: 14 Sep 2005
Posts: 18
Topics: 8

PostPosted: Mon Nov 14, 2005 7:38 am    Post subject: Reply with quote

Kolsu,

Following records in File1 F2 matches with File2 F1
abc123451
abc123452

so File1 F2 has been replaced by File2 F2 (which is bbc123451).

So after replacing I want to remove the duplicate records in File2 F2(bbc123451) and sum File 2 F4 & F5. So it becomes 3 and 5 .
Back to top
View user's profile Send private message
suresh05
Beginner


Joined: 14 Sep 2005
Posts: 18
Topics: 8

PostPosted: Mon Nov 14, 2005 7:40 am    Post subject: Reply with quote

Sorry after summing File 2 F4 & F5 is 3 and 11
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 Nov 14, 2005 8:38 am    Post subject: Reply with quote

suresh05,

Try this JCL.

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG   DD SYSOUT=*                                   
//DFSMSG    DD SYSOUT=*                                   
//IN1       DD DSN=YOUR INPUT FILE1,                             
//             DISP=SHR                                   
//IN2       DD DSN=YOUR INPUT FILE2,                             
//             DISP=SHR                                   
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T2        DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T3        DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//T4        DD DSN=&T4,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//CON1      DD DSN=&T1,DISP=OLD,VOL=REF=*.T1               
//          DD DSN=&T2,DISP=OLD,VOL=REF=*.T2               
//CON2      DD DSN=&T3,DISP=OLD,VOL=REF=*.T3               
//          DD DSN=&T4,DISP=OLD,VOL=REF=*.T4               
//OUT       DD DSN=YOUR FINAL OUTPUT,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *                                             
  COPY FROM(IN1)  USING(CTL1)                               
  COPY FROM(IN2)  USING(CTL2)                               
  SORT FROM(CON1) USING(CTL3)                               
  SORT FROM(CON2) USING(CTL4)                               
//CTL1CNTL  DD *                                             
  OUTFIL FNAMES=T1,                                         
  OUTREC=(1,120,10Z)                                         
//CTL2CNTL  DD *                                             
  OUTFIL FNAMES=T2,                                         
  OUTREC=(Z,1,9,120:X,10,9,Z)                               
//CTL3CNTL  DD *                                             
  SORT FIELDS=(2,9,CH,A)                                     
  SUM FIELDS=(121,8,BI,129,2,BI)                             
  OUTFIL FNAMES=T3,INCLUDE=(121,8,BI,NE,0,AND,1,1,BI,NE,0), 
  OUTREC=(1,1,121,9,11,110)                                 
  OUTFIL FNAMES=T4,INCLUDE=(121,8,BI,EQ,0),                 
  OUTREC=(1,120)                                             
//CTL4CNTL  DD *                           
  SORT FIELDS=(2,9,CH,A)                   
  SUM FIELDS=(11,7,PD,18,7,PD)             
  OUTFIL FNAMES=OUT                       
/*


Thanks

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


Joined: 14 Sep 2005
Posts: 18
Topics: 8

PostPosted: Mon Nov 14, 2005 10:35 am    Post subject: Reply with quote

Thanks a lot for your help Kolsu. It worked
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