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
 
JOIN 2 FILES using Key and write record from 1st file

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

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Wed Feb 11, 2009 6:17 pm    Post subject: JOIN 2 FILES using Key and write record from 1st file
Reply with quote

Join 2 files with Key is in differnt Places if key matches write records from first file.


Input file 1(Record lenth 80)
1234XXXXXXX...
2345XXXXXXX...


INput File 2(record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX4546....


The required output file

1234XXXXXXX...
2345XXXXXXX...
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 Feb 11, 2009 10:07 pm    Post subject:
Reply with quote

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 (FB/80)
//IN2 DD DSN=...  input file2 (FB/40)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/80)
//TOOLIN DD *
COPY FROM(IN1) TO(T1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(1,4,CH) FIRSTDUP
/*
//CTL1CNTL DD *
  INREC BUILD=(1:5,4,80:X)
/*
Back to top
View user's profile Send private message
subramanianup
Warnings : 1

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Wed Feb 11, 2009 10:11 pm    Post subject:
Reply with quote

Hi Frank,
One more questions if 1st File is like follows
Input file 1(Record lenth 80)
1234XXXXXXX...
1234XXXXXXX...
1234XXXXXXX...
2345XXXXXXX...


INput File 2(record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX4546....


The required output file

1234XXXXXXX...
2345XXXXXXX...

Could you please help me how to achieve this?
Back to top
View user's profile Send private message
subramanianup
Warnings : 1

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Wed Feb 11, 2009 10:15 pm    Post subject:
Reply with quote

Hi Frank The File 1 looks like as follows
Input file 1(Record lenth 80)
1234XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...

Please omit my above update
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 Feb 11, 2009 11:16 pm    Post subject:
Reply with quote

Please start over and show a complete example of the records in each input file and what you expect for output, covering all cases. Indicate if either or both input files has duplicates within it (it appears from your example that input file1 has dups, but input file2 doesn't - is that correct?).
Back to top
View user's profile Send private message
subramanianup
Warnings : 1

New User


Joined: 18 May 2005
Posts: 46
Location: Bangalore, INDIA

PostPosted: Thu Feb 12, 2009 9:49 am    Post subject:
Reply with quote

Sorry Frank I haven't Covered all the Cases. both the Input file containing Duplicates....If matches found from file 1 with File 2 we need to write only one record from first file. My Input file format and expected file format as follows,

Input file 1(Record length 80)
1234XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...
2345XXXXXXX...

Input file 2(Record length 40)
XXXX5464....
XXXX1234....
XXXX2345....
XXXX2345....
XXXX2345....
XXXX2345....
XXXX4546....
XXXX4546....
XXXX5568....

Output File
1234XXXXXXX...
2345XXXXXXX...
Back to top
View user's profile Send private message
Sushil Kurian

New User


Joined: 09 Feb 2009
Posts: 1
Location: India

PostPosted: Thu Feb 12, 2009 3:00 pm    Post subject:
Reply with quote

Hope this helps.

Code:

//STEP01   EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//SYSOUT   DD SYSOUT=*                                         
//IN1      DD DSN=input file1 (FB/80)               
//IN2      DD DSN=input file2 (FB/40)               
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//OUT      DD DSN=output file (FB/80)                         
//TOOLIN   DD *                                                       
COPY FROM(IN1) TO(TMP1) USING(CTL1)                                 
COPY FROM(IN2) TO(TMP1) USING(CTL2)                                 
SPLICE FROM(TMP1) TO(OUT) ON(1,4,CH) WITH(81,1) USING(CTL3)
/*                                                                   
//CTL1CNTL DD *                                                       
  INREC OVERLAY=(81:C'11')                                           
/*                                                                   
//CTL2CNTL DD *                                                       
  INREC BUILD=(1:5,4,81:C'22')                               
/*                                                                   
//CTL3CNTL DD *                                                       
  OUTFIL FNAMES=OUT,INCLUDE=(81,2,CH,EQ,C'21'),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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm

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