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


     
 
MAINFRAME - TIP OF THE DAY : programming pearls - The fastest algorithm can frequently be replaced by one that is almost as fast and much easier to understand.

Google
 
Web mainframegurukul.com

Welcome to the mainframegurukul forums.

You are currently viewing our mainframe forums as a guest which gives you limited access to view most discussions, articles. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support at admin@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

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

Frank Yaeger
Moderator


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

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
mainframeman
Member


Joined: 09 Dec 2006
Posts: 4

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
Frank Yaeger
Moderator


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

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
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

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Graphic Designer / Sr. Graphic Designer Company Creative Ca 0 websol18 157 Sat Jun 05, 2010 1:00 pm
websol18 View latest post
No new posts job from spool area 4 safia_shaheen 7694 Thu Aug 30, 2007 5:54 pm
sudhakar.kataru View latest post
No new posts CICs 5 vidhya 6266 Fri Nov 17, 2006 12:13 pm
hari.paramasivam View latest post
No new posts Mainframe Openings For A CMM LEVEL 5 COMPANY 0 Doss 2343 Tue Sep 12, 2006 2:55 pm
Doss View latest post
No new posts Opps with a Chennai based company. 0 arrbee 1941 Fri Apr 07, 2006 9:15 am
arrbee View latest post
 



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

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