Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

compare two files and write duplicate records to file no dup

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
mainframeman
Member


Joined: 09 Dec 2006
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Dec 19, 2006 9:33 pm    Post subject: compare two files and write duplicate records to file no dup Reply with quote

I want to be able to compare two files(file A and file B) and write the unique (non-matching) records from file A to an output file (file C) and duplicate records to another file (file D). File D needs to be in a report format. There also has be be another file (File E) that is a exact copy of File B. I know that ICETOOL can do something like this but not sure of the syntax


input:

File A:

AAA1111
BBB2222
CCC333
DDD444

File B:

AAA111
BBB222
EEE555
FFF666
GGG777


OUTPUT FILES:


FILE C:

CCC333
DDD444


File D: Report file (133 bytes long)

I need a header that will print at the top of every page

layout like this: this will be 133 bytes long

company: xxxx page: xxx
Application: xxx date: xx/xx/xx
JOB: xxxx
REPORT: Dropped records due to customer code mismatch


AAA111 (detail records)
BBB222


File E:

AAA111
BBB222
EEE555
FFF666
GGG777
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Dec 19, 2006 10:33 pm    Post subject: Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your "key" was in positions 1-6, and your input files have RECFM=FB and LRECL=80. You can change the job appropriately if those assumptions are incorrect.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=...  input fileA (FB/80)
//FILEB DD DSN=...  input fileB (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=...  output fileC (FB/80)
//FILED DD DSN=...  output fileD (FBA/133)
//FILEE DD DSN=...  output fileE (FB/80)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(FILEC) ON(1,6,CH) NODUPS -
  DISCARD(FILED) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'A')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'B')
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=FILEE,BUILD=(1,80)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILEC,INCLUDE=(81,1,CH,EQ,C'A'),
    BUILD=(1,80)
  OUTFIL FNAMES=FILED,INCLUDE=(81,1,CH,EQ,C'A'),
    HEADER2=(8:'company: xxxx',76:'page:  ',PAGE=(M11,LENGTH=3),/,
     8:'Application: xxxx',78:'date:  ',DATE,/,
     8:'JOB:   xxxx',/,
     8:'REPORT:  Dropped records due to customer code mismatch',
     X,/,X),
    BUILD=(1,80,132:X)
/*

_________________
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
mainframeman
Member


Joined: 09 Dec 2006
Posts: 4

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Tue Dec 19, 2006 11:17 pm    Post subject: icetool quesitons Reply with quote

Frank,

My input files are:

File A: RECFM=FB and LRECL=150
File B: RECFM=FB and LRECL=13

The key field is 13 bytes long. This is what I will use to match records from the two files


output file:

File C: RECFM=FB and LRECL=150
File D: RECFM=FB and LRECL=150 - Report
File E: RECFM=FB and LRECL=13



Is it possbile to sort these two input files(File A and File B) using ICETOOL and then do the processing?
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed Dec 20, 2006 1:53 am    Post subject: Reply with quote

We just need to change the DFSORT/ICETOOL job a little to handle files with those attributes and the 13-byte key as follows:

Code:

//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEA DD DSN=...  input fileA (FB/150)
//FILEB DD DSN=...  input fileB (FB/13)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//FILEC DD DSN=...  output fileC (FB/150)
//FILED DD DSN=...  output fileD (FB/150)
//FILEE DD DSN=...  output fileE (FB/13)
//TOOLIN DD *
COPY FROM(FILEA) TO(T1) USING(CTL1)
COPY FROM(FILEB) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(FILEC) ON(1,13,CH) NODUPS -
  DISCARD(FILED) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(151:C'A')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(151:C'B')
  OUTFIL FNAMES=T1
  OUTFIL FNAMES=FILEE,BUILD=(1,13)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=FILEC,INCLUDE=(151,1,CH,EQ,C'A'),
    BUILD=(1,150)
  OUTFIL FNAMES=FILED,REMOVECC,INCLUDE=(151,1,CH,EQ,C'A'),
    HEADER2=(8:'company: xxxx',76:'page:  ',PAGE=(M11,LENGTH=3),/,
     8:'Application: xxxx',78:'date:  ',DATE,/,
     8:'JOB:   xxxx',/,
     8:'REPORT:  Dropped records due to customer code mismatch',
     X,/,X),
    BUILD=(1,150)
/*

_________________
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 11:02 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & 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


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-1458.html