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

Fetch columns upon matching keys in files with duplicates.


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

New User


Joined: 08 Jul 2006
Posts: 28
Location: Singapore

PostPosted: Thu May 20, 2010 10:07 pm
Reply with quote

Hi All,

I have a requirement where i need to find out all the

FileA: ( VB file, 255 bytes ,column in Char format)
Code:
112191
119112
119911
121538
121587

FileB: ( VSAM file, 255, Column A , S9(6) comp-3, and column B - S9(11) Comp-3 , so both are in PD formats)

Code:
Column A  Column B
0112191 11121910030
0112191 11121910057
0112191 11121910066
0112191 11121910075
0112191 11121914312
0112196 11121960001
0119112 11191122300
0119112 11191122301
0119112 11191124317


My output should look like: Whenever Coumn A from fileA matches with that of fileB fetch all data from FileB.

Code:
0112191 11121910030
0112191 11121910057
0112191 11121910066
0112191 11121910075
0112191 11121914312
0119112 11191122300
0119112 11191122301
0119112 11191124317


I had tried with this,..but there is no output and the belwow shows the data frm TEMP file.

Code:
//FILEA    DD  DSN=VSAM FILEA,DISP=SHR
//FILEB    DD  DSN=VB FILEB,DISP=SHR
//TEMP     DD  DSN=&&TEMP,UNIT=SYSDA,DISP=(MOD,PASS),
//             SPACE=(TRK,(15,5),RLSE)
//OUTFILE  DD  DSN=OUTPUTFILE VB,DISP=SHR
//TOOLIN   DD  *
COPY FROM(FILEB) TO(TEMP) USING(CTL2)
COPY FROM(FILEA) TO(TEMP) USING(CTL1) VSAMTYPE(V)
SPLICE FROM(TEMP) TO(OUTFILE) ON(8,6,CH)  -
      WITHALL  WITH(5,1) WITH(7,30) USING(CTL3)
//CTL1CNTL DD *
           INREC BUILD=(1,4,5:C'VV',10,4,PD,ZD,X,14,6,PD,ZD)
//CTL2CNTL DD *
           INREC BUILD=(1,4,5:C'BB',7:5)
//CTL3CNTL DD *
           OPTION COPY
           OUTFIL FNAMES=OUTFILE,INCLUDE=(5,2,CH,EQ,C'VV'),
                  BUILD=(1,4,5:7)


Data in TEMP file shows like this:

BB 112191 11121910030
BB 119112 11191122301
BB 119911 11199112311
BB 121538 11215380008
BB 121587 11215872302
BB 121590 11215904327
BB 122231 11222312300
BB 126665 11266650017
BB 126793 11267930013
BB 127096 11270960107
BB 127383 11273832300
BB 129132 11291322304
BB 131008 11310080019
VV0112191 11121910030
VV0112191 11121910057
VV0112191 11121910066
VV0112191 11121910075
VV0112191 11121914312
VV0112196 11121960001
VV0119112 11191122300
VV0119112 11191122301
VV0119112 11191124317

Please let me know if any more info is required.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 20, 2010 10:40 pm
Reply with quote

malayajena,

If your intention is to extract only FILEB duplicate records then you can eliminate the dups from fileA and then splice to extract the duplicates.

use the following control cards


Code:

//FILEA    DD DSN=Your char match field file,DISP=SHR
//FILEB    DD DSN=your pd match field file,DISP=SHR
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE) 
//OUTFILE  DD SYSOUT=* 
//TOOLIN   DD  *                                                       
 SORT FROM(FILEA) TO(TEMP) USING(CTL1) VSAMTYPE(V)                             
 COPY FROM(FILEB) TO(TEMP) USING(CTL2)                                 
 SPLICE FROM(TEMP) TO(OUTFILE) ON(7,6,CH)  -                           
      WITHALL  WITH(5,1) WITH(7,30) USING(CTL3)                       
//CTL1CNTL DD *                                                       
  INREC BUILD=(1,4,5:C'BB',7:5,6,C'FILEA',263:X)                       
  SORT FIELDS=(7,6,CH,A)                                               
  SUM FIELDS=NONE                                                     
//CTL2CNTL DD *                                                       
  INREC BUILD=(1,4,5:C'VV',10,4,PD,ZD,LENGTH=6,5)                     
//CTL3CNTL DD *                                                       
  OUTFIL FNAMES=OUTFILE,BUILD=(1,4,13),INCLUDE=(5,2,CH,EQ,C'VB')       
//*
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top