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

How to select records from two files


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

New User


Joined: 06 May 2007
Posts: 16
Location: pune

PostPosted: Mon Dec 10, 2007 12:52 pm
Reply with quote

Hi

my requirement is as follows

1. There are two Input files

File1 - with one of the fields as F1
File2 - with fields F1(same as in file1) and F2

2. One output file should be generated with all the records from
File1 where field F1 of File1 = field F1 of File2

please tell me the solution
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Mon Dec 10, 2007 12:59 pm
Reply with quote

adarsh,

This was discussed earlier. Search DFSORT fourm.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Mon Dec 10, 2007 5:07 pm
Reply with quote

Hi,

You want to do it using DFSORT/ICETOOL only or even without using DFSORT/ICETOOL?

We can write a simple COBOL program to execute your requirement.

Regards,
KSK
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: Mon Dec 10, 2007 9:59 pm
Reply with quote

adarsh.bhalke,

Please show an example of the records in each input file (relevant fields only) and what you expect for output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
adarsh.bhalke

New User


Joined: 06 May 2007
Posts: 16
Location: pune

PostPosted: Thu Dec 13, 2007 12:15 pm
Reply with quote

my requirement is like this

File1 one contains

F1 000001 010408SAP4WITA 19991201
F1 000002 010408SAP4WITA 19991201

and file 2 contains

F1 112333 010408SAP4WITA 19991201

Here if first two bytes of file 1 matches with that of file2 then i want all curressponding records of file 1 in output file


I.e.

the output should be as follows

F1 000001 010408SAP4WITA 19991201
F1 000002 010408SAP4WITA 19991201
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Dec 13, 2007 1:31 pm
Reply with quote

Code:
//*******************************************************             
//STEP001  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN1      DD *                                                       
F1 000001 010408SAP4WITA 19991201                                     
F1 000002 010408SAP4WITA 19991201                                     
/*                                                                   
F1 112333 010408SAP4WITA 19991201                                     
//IN2      DD *                                                       
/*                                                                   
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//BOTH     DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                 
 COPY FROM(IN2)  TO(TMP1) USING(CP02)                                 
 SELECT FROM(TMP1) TO(BOTH) ON(1,2,CH) ALLDUPS USING(CP03)           
/*                                                                   
//CP01CNTL DD   *                                                     
  OUTREC OVERLAY=(80:C'1')                                           
/*                                                                   
//CP02CNTL DD   *                                                     
  OUTREC OVERLAY=(80:C'2')                                   
/*                                                           
//CP03CNTL DD   *                                           
  OUTFIL FNAMES=BOTH,INCLUDE=(80,1,ZD,EQ,1),OVERLAY=(80:C' ')
/*                                                           


BOTH
Code:
F1 000001 010408SAP4WITA 19991201
F1 000002 010408SAP4WITA 19991201
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 and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top