Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Selecting common records from 2 files.

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

New User


Joined: 10 Nov 2006
Posts: 49
Location: Canada

PostPosted: Wed Apr 30, 2008 12:38 am    Post subject: Selecting common records from 2 files.
Reply with quote

Hi,

I have 2 files:
File 1:
P000001XXXX
P000002XXXX
P000001YYYY
P000002YYYY
P000003YYYY
P000001ZZZZ
P000002ZZZZ
P000001AAAA

File2:
XXXX
YYYY
AAAA

Output file should have:
P000001XXXX
P000002XXXX
P000001YYYY
P000002YYYY
P000003YYYY
P000001AAAA

i.e the output file should have those records from File1 for which last 4 bytes File1 are present in 1st 4 bytes of File2.

Please suggest how it can be using ICETOOL.

Thanks.
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: Wed Apr 30, 2008 1:58 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input files have RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. I also assumed that you wanted the output records in the same order as the input records as shown in your example - that requires an extra pass.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD *       input file1 (FB/80)
P000001XXXX
P000002XXXX
P000001YYYY
P000002YYYY
P000003YYYY
P000001ZZZZ
P000002ZZZZ
P000001AAAA
/*
//IN2 DD *       input file2 (FB/80)
XXXX
YYYY
AAAA
QQQQ
/*
//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(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(8,4,CH) -
  WITHALL WITH(1,81) WITH(89,8) USING(CTL3)
SORT FROM(T2) TO(OUT) USING(CTL4)
/*
//CTL1CNTL DD *
  INREC BUILD=(8:1,4,81:C'BB',89:8X)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'VV',89:SEQNUM,8,ZD)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=T2,INCLUDE=(81,2,CH,EQ,C'VB')
/*
//CTL4CNTL DD *
  SORT FIELDS=(89,8,ZD,A)
  OUTREC BUILD=(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 Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us