Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to compare 2 files and write record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jan 18, 2007 6:05 pm    Post subject: Need to compare 2 files and write record
Reply with quote

Hi,

I have two files
Say FILEA and FILEB

FILEA
-------
0123456789
--------------
123 AAA
456 BBB
789 CCC

FILEB
------
0123456789
--------------
123 BBA
456 BBB
789 CCC
122 XYZ

I need to have anotehr data set which should match the first 3 bytes of record like
FILEC
------
0123456789
--------------
123 BBA
122 XYZ

That is, if the first 3 bytes matches then it should take the record from secound file (FILEB) also and write into FILEC, if not matches also it should write into FILEC
Back to top
View user's profile Send private message

kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jan 18, 2007 7:02 pm    Post subject: Re: Need to compare 2 files and write record
Reply with quote

Hi,
I am done with the solution but with 4 steps. it solved the purpose but can we do it in single step?

The solution goes like this:
Code:

//S1 EXEC PGM=ICETOOL                               
//TOOLMSG DD SYSOUT=*                               
//DFSMSG DD SYSOUT=*                                 
//CON DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.IN2       
//    DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.IN       
//OUT DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.OUT       
//TOOLIN DD *                                       
SELECT FROM(CON) TO(OUT) ON(1,09,CH) FIRSTDUP       
/*                                                   
//S2 EXEC PGM=ICETOOL                               
//TOOLMSG DD SYSOUT=*                               
//DFSMSG DD SYSOUT=*                                 
//CON DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.OUT       
//    DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.IN         
//OUT DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.OUT2       
//TOOLIN DD *                                         
SELECT FROM(CON) TO(OUT) ON(1,80,CH) NODUPS           
/*                                                     
//S2 EXEC PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                 
//DFSMSG DD SYSOUT=*                                   
//CON DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.OUT2       
//OUT DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.OUT3       
//TOOLIN DD *                                         
SELECT FROM(CON) TO(OUT) ON(1,09,CH) FIRSTDUP         
/*                                                     
//S2 EXEC PGM=ICETOOL                                 
//TOOLMSG DD SYSOUT=*                                 
//DFSMSG DD SYSOUT=*                                   
//CON DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.IN2         
//    DD DISP=SHR,DSN=USZ9997.USZ9997.SORT.IN         
//OUT DD DISP=(MOD,PASS),DSN=USZ9997.USZ9997.SORT.OUT3   
//TOOLIN DD *                                           
SELECT FROM(CON) TO(OUT) ON(1,09,CH) NODUPS             
/*                                                       
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jan 18, 2007 9:57 pm    Post subject:
Reply with quote

If I understand what you want to do (and I'm not sure I do), then this DFSORT/ICETOOL job will do it. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=... input fileA (FB/80)
//IN2 DD DSN=... input fileB (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(T2) ON(1,9,CH) NODUPS
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1',82:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2',82:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  INCLUDE COND=(81,1,CH,EQ,C'2')
  SORT FIELDS=(82,8,ZD,A)
  OUTREC BUILD=(1,80)
/*
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed Jan 24, 2007 12:26 pm    Post subject:
Reply with quote

Frank,

I tried ur code and for some reason I was getting error and not accepting OVERLAY. I think my site is using SYNCSORT with ICETOOL.. SYNCTOOL release 1.4D.

//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(T2) ON(1,9,CH) NODUPS
SORT FROM(T2) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
OUTREC FIELDS=(1,80,81:C'1',82:8X)
/*
//CTL2CNTL DD *
OUTREC FIELDS=(1,80,81:C'2',82:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
INCLUDE COND=(81,1,CH,EQ,C'2')
SORT FIELDS=(82,8,ZD,A)
OUTREC FIELDS=(1,80)
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us