Count & Compare record totals in two files - Set RC



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Count & Compare record totals in two files - Set RC

Postby Kevin Jenkins » Thu May 05, 2011 2:35 pm

I have two sequential input files (IN01 & IN02) which are both RECFM=FB, LRECL=80.

I want to test if the count of records in file IN02 is greater than that in file IN01. If this is true I want to set RC=0, otherwise I want to set RC=4. Please can you suggest a DFSORT solution to this.

Thanks & Regards, Kevin
Kevin Jenkins
 
Posts: 16
Joined: Fri Dec 04, 2009 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count & Compare record totals - Set RC

Postby Kevin Jenkins » Thu May 05, 2011 2:54 pm

Apologies, forgot to include - maintenance level is ICE201I G RECORD TYPE ... November, 2009 DFSORT
Kevin Jenkins
 
Posts: 16
Joined: Fri Dec 04, 2009 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count & Compare record totals in two files - Set RC

Postby skolusu » Thu May 05, 2011 9:14 pm

kevin Jenkins,

Use the following DFSORT JCL which will give you the desired results. The RC is set to 0 if the file 2 has atleast 1 record more than file 1. An RC of 4 is set when file 2 has equal or less number of records in file 1

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//INA      DD *                                     
F1-R1                                               
F1-R2                                               
F1-R3                                               
//INB      DD *                                     
F2-R1                                               
F2-R2                                               
F2-R3                                               
F2-R4                                               
F2-R5                                               
F2-R6                                               
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  OPTION COPY                                       
  JOINKEYS F1=INA,FIELDS=(1,1,A)                     
  JOINKEYS F2=INB,FIELDS=(1,1,A)                     
  REFORMAT FIELDS=(F1:2,8,F2:2,8)                   
  OUTFIL NULLOFL=RC4,INCLUDE=(9,8,ZD,GT,1,8,ZD)     
//*                                                 
//JNF1CNTL DD *                                     
  INREC BUILD=(X,7C'0',C'1')                         
  SUM FIELDS=(2,8,ZD)                               
//*                                                 
//JNF2CNTL DD *                                     
  INREC BUILD=(X,7C'0',C'1')                         
  SUM FIELDS=(2,8,ZD)                               
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Count & Compare record totals in two files - Set RC

Postby Kevin Jenkins » Fri May 06, 2011 1:15 am

Many thanks Skolusu. I've tested the solution and it delivers exactly what I was hoping for.

Regards, Kevin
Kevin Jenkins
 
Posts: 16
Joined: Fri Dec 04, 2009 4:46 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post