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

compare 2 files & matched recs write into 3rd file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pamela Pradhan

New User


Joined: 18 Dec 2007
Posts: 2
Location: Pune

PostPosted: Fri Feb 15, 2008 2:22 pm
Reply with quote

Hi
I can't quite work out how to do the following -

File1 : key position (1-13)

2546289077943
2546289079584
2541828046435
0000013080956

File2 : key position (14-26)

34 ..|2546289077943...|0 ..|STL ..| ..|..Tucker Jammie &
34 ..|2546289079584...|0 ..|STL ..| ..|..Bynum Tanya.....
34 ..|2541828046435...|0 ..|STL ..|AA..|..Dairy Queen.....
34 ..|2541828046435...|0 ..|STL ..|01..|..Carquest Auto Pa
34 ..|2541828046435...|0 ..|STL ..|04..|..Carquest Paint S
34 ..|2541828046435...|1000 ..|LINE..|05..|..1202 E Hwy 190..
56 ..|0000013080956...|0 ..|STL ..|58..|..RHA Health Servi
34 ..|2541828046435...|2000 ..|LINE..|06..|..................
34 ..|2546289083510...|0 ..|STL ..| ..|..Henry Ricardo...
34 ..|2546289084589...|0 ..|STL ..| ..|..McCarroll C.....
34 ..|2541828060360...|0 ..|STL ..|06..|..Stampede Hockey.
34 ..|2541828060360...|2500 ..|LINE..|07..|..Bus Ofc 100 W Ce
34 ..|2541828060360...|0 ..|STL ..|0A..|..New Millineum In

required file3:

34 ..|2546289077943...|0 ..|STL ..| ..|..Tucker Jammie &
34 ..|2546289079584...|0 ..|STL ..| ..|..Bynum Tanya.....
34 ..|2541828046435...|0 ..|STL ..|AA..|..Dairy Queen.....
34 ..|2541828046435...|0 ..|STL ..|01..|..Carquest Auto Pa
34 ..|2541828046435...|0 ..|STL ..|04..|..Carquest Paint S
34 ..|2541828046435...|1000 ..|LINE..|05..|..1202 E Hwy 190..
56 ..|0000013080956...|0 ..|STL ..|58..|..RHA Health Servi
34 ..|2541828046435...|2000 ..|LINE..|06..|..................

I want to use the presence of a key in file 1 (position 1 for 13) to lift out the records in file 2 with the same key in the different position (14-26) to a file 3.
I want to fetch all the matching records to file 3.

Any help is much appreciated.

Pam
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: Sat Feb 16, 2008 12:21 am
Reply with quote

Pam,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=... input file1 (keys in 1-13)
//IN2 DD DSN=... input file2 (FB/1200) - keys in 14-26
//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/1200)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(14,13,CH) -
  WITHALL WITH(1,1201) WITH(1203,8) USING(CTL3)
SORT FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC BUILD=(14:1,13,1201:C'BB',1203:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(1201:C'VV',1203:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,INCLUDE=(1201,2,CH,EQ,C'VB')
/*
//CTL4CNTL DD *
  SORT FIELDS=(1203,8,ZD,A)
  OUTREC BUILD=(1,1200)
/*
Back to top
View user's profile Send private message
Pamela Pradhan

New User


Joined: 18 Dec 2007
Posts: 2
Location: Pune

PostPosted: Mon Feb 18, 2008 12:32 pm
Reply with quote

Frank,

Thanks a lots icon_smile.gif
Its working fine..
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top