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 

Count of records from 2 files and difference between them

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


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Feb 08, 2007 2:17 pm    Post subject: Count of records from 2 files and difference between them Reply with quote

I have two input datasets A and B with records, what i want is display the count of both the records in two datasets A and B in sysout as well the difference of records in two datasets and B dataset will always have more records than A.
Input as below:
A
Code:

1
2
3

B
Code:

4
5
6
7
8

I want the output as below:
Code:

RECORDS IN A:   3
RECORDS IN B:   5
DIFF        :   2
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 08, 2007 4:37 pm    Post subject: Reply with quote

yadav2005,

Try this job

Code:

//STEP0100 EXEC PGM=ICETOOL                     
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG   DD SYSOUT=*                           
//IN1      DD *
1
2
3                               
//IN2      DD *
4
5
6
7
8                                 
//T1       DD DSN=&T1,DISP=(MOD,CATLG,CATLG),SPACE=(TRK,(1,1),RLSE)
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  COPY FROM(IN1) USING(CTL1)                                       
  COPY FROM(IN2) USING(CTL2)                                       
  COPY FROM(T1)  USING(CTL3)                                       
//CTL1CNTL DD *                                                   
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,                             
  TRAILER1=(C'RECORDS IN FILE A : ',                               
            C'-',COUNT,80:X)                                       
/*                                                                 
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=T1,REMOVECC,NODETAIL,                             
  TRAILER1=(C'RECORDS IN FILE B : ',                               
            C'+',COUNT,80:X)                                       
/*                                                                 
//CTL3CNTL DD *                                 
  OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,           
  HEADER1=(01,20,22,8,80:X),                     
  TRAILER1=(01,20,22,8,/,                       
            C'DIFFERENCE        : ',             
            TOT=(21,9,SFF,EDIT=(IIIIIIIT)),80:X)
/*


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
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Feb 08, 2007 5:09 pm    Post subject: Reply with quote

yadav2005,

Here is an alternate way of doing it. But you need to add 1 line header(HDR) before each file. This job is based on the trick mentioned here

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

Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD *           
HDR                       
1                         
2                         
3                         
HDR                       
4                         
5                         
6                         
7                         
8                         
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:SEQNUM,8,ZD)),           
        IFTHEN=(WHEN=(1,3,CH,NE,C'HDR'),                       
                OVERLAY=(29:SEQNUM,8,ZD,                       
                         21:21,8,ZD,SUB,29,8,ZD,M11,LENGTH=8)),
        IFTHEN=(WHEN=NONE,                                     
                OVERLAY=(21:SEQNUM,8,ZD))                     
                                                               
  OUTREC IFTHEN=(WHEN=(21,8,ZD,EQ,1),                         
        OVERLAY=(01:C'RECORDS IN FILE A :',                   
                 21:C'-1')),                                   
         IFTHEN=(WHEN=(21,8,ZD,EQ,2),                         
        OVERLAY=(01:C'RECORDS IN FILE B :',                   
                 21:C'+1'))                                   
                                                               

  OUTFIL OMIT=(29,08,CH,EQ,C' '),                       
  REMOVECC,NODETAIL,                                     
  SECTIONS=(01,20,                                       
  TRAILER3=(01,20,TOT=(21,2,SFF,EDIT=(IIIIIIIT)),80:X)),
  TRAILER1=(C'DIFFERENCE        : ',                     
            TOT=(21,2,SFF,EDIT=(IIIIIIIT)),80:X)         
/*                                                       


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


Joined: 30 Aug 2006
Posts: 32
Topics: 15
Location: Chennai

PostPosted: Thu Mar 01, 2007 5:19 am    Post subject: Syncsort Reply with quote

Kolusu,

What does REMOVECC and NODETAIL in syncsort do?


Catherine
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Mar 01, 2007 6:55 am    Post subject: Reply with quote

catherine,

Search before posting . check these links

http://www.mvsforums.com/helpboards/viewtopic.php?p=29521#29521

http://www.mvsforums.com/helpboards/viewtopic.php?p=36045#36045

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