My reqmt is to compare the record count of two files in a step and if they match then I want to proceed to next step. Can any one throw some light on how to do this ?
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Nov 04, 2004 3:56 pm Post subject:
Here's one way to do it with DFSORT/ICETOOL. The ICETOOL step sets RC=0 if the counts match or RC=12 if they don't match.
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1
//IN2 DD DSN=... input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CTL3CNTL DD DSN=&&C1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN1->T1: Create a record with the count for input file1:
* nnnnnnnn
COPY FROM(IN1) USING(CTL1)
* IN1->CTL3CNTL: Create an INCLUDE statement as follows:
* INCLUDE COND=(1,8,ZD,EQ,mmmmmmmm)
* where mmmmmmmm is the count for input file2
COPY FROM(IN2) USING(CTL2)
* Use the INCLUDE statement to output one record if
* nnnnnnnn=mmmmmmmm, or 0 records otherwise.
* If output record was produced (nnnnnnnn=mmmmmmmm), set RC=0.
* Otherwise, set RC=12.
COUNT FROM(T1) USING(CTL3) EMPTY
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
OUTREC=(8X),TRAILER1=(COUNT=(M11,LENGTH=8))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=CTL3CNTL,REMOVECC,NODETAIL,
OUTREC=(80X),
TRAILER1=(' INCLUDE COND=(1,8,ZD,EQ,',COUNT=(M11,LENGTH=8),
')')
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Nov 04, 2004 6:02 pm Post subject:
Superk,
You could do all of that in one ICETOOL step rather than three DFSORT steps.
And you don't need DISCARD(GARBAGE) since you aren't using the GARBAGE output.
Note that your method does three COPY operations (COPY, COPY, COUNT) and one SORT operation (SELECT), whereas my method does three COPY operations (COPY, COPY, COUNT) without a SORT operation. It's always best to avoid sorting if you can for optimum efficiency. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Nov 04, 2004 6:03 pm Post subject:
YSMVS,
Sorry, but I don't answer questions about Syncsort. Maybe somebody else can help you with that. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Thu Nov 04, 2004 8:38 pm Post subject:
Ysmvs,
The following JCl will give you the desired results. A brief explanation of the job.
The first step gets the count from the 1st file
The second step gets the count from the 2nd file
The next step we concate the above created count files and sort on the count field and using sum fields we eliminate the dupes.
using startrec on outfil we always will write out the second record.
Now if the both records are matched , there will only be one record since we are using sum fields=none. So writing the output from second record will end in an empty file. It is where we use the NULLOUT parm where we can set the return code to 0,4,or 16. Here I am setting the return code to 4 in this case.
If the records do not match then we have 1 record in the output and the return code will automatically be zero.
Now using cond on the following steps we either skip or run the other steps.
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