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
 
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 query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am

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