Need your help ....compare 2 files using ICETOOL and SPLICE

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

chanakya
Member
Posts: 21
Joined: Thu Aug 18, 2011 7:34 pm

Post by chanakya » Thu Sep 15, 2011 5:51 pm

Hi Frank,

I have one question regarding COUNT.

I have two files having same data as follows.
File1 – Day1
File2 – Day2

I compared these 2 files and created below files
Insert file .....data present in file2 and not in file1
Delete file .....data present in file1 and not in file2
Update file .....data present in both the files and one or more field should not match.
Noupdate file..... data present in both the files and should match.

Then I have created count files for each of them.
File1 having 15 record……. So count is 15.
File2 having 18 record……. So count is 18.
Insert having 5 record……. So count is 5.
Delete having 2 record……. So count is 2.
Noupdate having 13 record……. So count is 13.

Now I want to verify
1) Sum of insert and noupdate file count equal to the current day file’s count.
5 + 13 =18
2) Sum of Noupdate and delete file count should be equal to the previous day file’s count.
2 + 13 =15

Could you please suggest any hint?

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Sep 15, 2011 10:03 pm

Create a symbol for each sum you want. Use ICETOOL's COUNT operator with an INCLUDE for the file count vs the symbol. Set the COUNT return code based on whether the output file is empty (file count EQ symbol) or not empty (file count NE symbol).

Something like this:

Create a symbol for Sum1 and Sum2

Sum1,Insert_count+Noupdate_count ->

Sum1,+nnnnnnnn
...

Code: Select all

//TOOLIN DD *
COUNT FROM(IN1) EMPTY USING(CTL1)
//CTL1CNTL DD *
   INCLUDE COND=(p,m,ZD,EQ,Sum1)
/*
That's the idea. I'll leave the details to you.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

chanakya
Member
Posts: 21
Joined: Thu Aug 18, 2011 7:34 pm

Post by chanakya » Fri Sep 30, 2011 7:39 pm

Frank Yaeger wrote:Ok, this should get you started:

Code: Select all

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file1 (FB/n)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
COPY FROM(T1) TO(SYM) USING(CTL2)
//CTL1CNTL DD *
  OPTION STOPAFT=1
  OUTFIL FTOV
//CTL2CNTL DD *
* SET UP LRECL AS 5,5,ZD
  INREC BUILD=(1,4,5:1,2,BI,SUB,+4,TO=ZD,LENGTH=5)
* USE LRECL IN 5,5,ZD TO CREATE NEEDED SYMBOLS
  OUTFIL FNAMES=SYM,VTOF,
    BUILD=(C'RFFLD,1,',
      5,5,80:X,/,
      C'INC1,',(5,5,ZD,MUL,+2),ADD,+1,TO=ZD,LENGTH=5,
      C',1,CH')
//S2 EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//IN1  DD DSN=...  input file1 (FB/n)
//IN2  DD DSN=...  input file2 (FB/n)
//OUT1 DD DSN=...  output file1
//SYSIN    DD    *
* USE CREATED SYMBOLS IN DFSORT STATEMENTS
  JOINKEYS F1=IN1,FIELDS=(19,12,A)
  JOINKEYS F2=IN2,FIELDS=(19,12,A)
  REFORMAT FIELDS=(F1:RFFLD,F2:RFFLD,?)
  OUTFIL FNAMES=OUT1,INCLUDE=(INC1,EQ,C'2')
  OPTION COPY
/*
                                  

Apparently, the JOINKEYS must set INC1 to '2', '1', 'B' so we know if it is an insert, delete, or update. Can you explain how it is working?
Last edited by chanakya on Fri Sep 30, 2011 8:13 pm, edited 2 times in total.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Oct 04, 2011 1:17 am

Apparently, the JOINKEYS must set INC1 to '2', '1', 'B' so we know if it is an insert, delete, or update. Can you explain how it is working?
? in the REFORMAT statement tells DFSORT to place an indicator there. The indicator is a 'B' for matched records, a '1' for record in file1 only or a '2' for record in file2 only.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others