IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to compare 2 files and write record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Thu Jan 18, 2007 9:57 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top