Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Method to append the matching record from file2 to file1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Method to append the matching record from file2 to file1
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    Post subject: Reply to: Method to append the matching record from file2 to
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    Post subject: Reply to: Method to append the matching record from file2 to
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    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 update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us