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

Method to append the matching record from file2 to file1


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

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Fri Nov 06, 2009 11:02 am
Reply with quote

I have two files f1 and f2. The fields of these files are as:

File1:
Enrollee number provider number media type
1111
1111
1111
2222
2222
3333
4444

Record length = 20
1-4 Enrollee number
5-13 provider numbers
14-20 media type


File2:
Enrollee number Receive date
1111 11/05/2009
3333 11/06/2009

Record length = 14
1-4 - Enrollee number
5-14 - Receive date


I want to compare both file and where we find the matched enrollee number I want to add the receive date in my file1 as:

In above example 1111 and 3333 is matching value so my final file3 should be like:


File 3: Total record length = 30

Enrollee number provider number media type Receive date
1111 11/05/2009
1111
1111
2222
2222
3333 11/06/2009
4444

How i can achieve it?
Back to top
View user's profile Send private message
Permander Malik

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Fri Nov 06, 2009 11:06 am
Reply with quote

The Receive Date 11/05/2009 and 11/06/2009 should come at column 21 - 30 of file3.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Nov 06, 2009 9:58 pm
Reply with quote

Permander Malik,

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//FB20     DD DSN=Your input FB 20 byte file,DISP=SHR
//FB14     DD DSN=Your input FB 14 byte file,DISP=SHR             
//TEMP     DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)   
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  COPY FROM(FB14) USING(CTL1)                                     
  COPY FROM(FB20) USING(CTL2)                                     
  SORT FROM(TEMP) USING(CTL3)                                     
//CTL1CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,OVERLAY=(21:C'1')                             
//CTL2CNTL DD *                                                   
  OUTFIL FNAMES=TEMP,OVERLAY=(21:C'2')                             
//CTL3CNTL DD *                                                   
  SORT FIELDS=(1,4,CH,A),EQUALS                                   
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(23:SEQNUM,8,ZD,RESTART=(1,4))),
  IFTHEN=(WHEN=GROUP,BEGIN=(23,8,ZD,EQ,1),PUSH=(22:21,1,31:5,10), 
  RECORDS=2)                                                       
  OUTFIL FNAMES=OUT,IFOUTLEN=30,INCLUDE=(21,1,ZD,EQ,2),           
  IFTHEN=(WHEN=(21,2,CH,EQ,C'2 '),BUILD=(1,20,10X)),               
  IFTHEN=(WHEN=(21,2,CH,EQ,C'21'),BUILD=(1,20,31,10)),             
  IFTHEN=(WHEN=(21,2,CH,EQ,C'22'),BUILD=(1,20,10X))               
//*
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 How to split large record length file... DFSORT/ICETOOL 8
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
Search our Forums:

Back to Top