MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
yadav2005 Intermediate Joined: 10 Jan 2005 Posts: 348 Topics: 144
Posted: Thu Feb 08, 2007 2:17 pm Post subject: Count of records from 2 files and difference between them
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
B
I want the output as below:
Code:
RECORDS IN A: 3
RECORDS IN B: 5
DIFF : 2
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Thu Feb 08, 2007 4:37 pm Post subject:
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Thu Feb 08, 2007 5:09 pm Post subject:
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
Catherine Beginner Joined: 30 Aug 2006 Posts: 32 Topics: 15 Location: Chennai
Posted: Thu Mar 01, 2007 5:19 am Post subject: Syncsort
Kolusu,
What does REMOVECC and NODETAIL in syncsort do?
Catherine
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Back to top
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