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

Join two files with different number of records


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

New User


Joined: 21 Feb 2006
Posts: 24

PostPosted: Mon Sep 27, 2010 2:28 pm
Reply with quote

Hello,

I´ve got two files, File A (lrecl=80,recfm=fb) and that contains:
COLS> ----+----1----+
****** ***************
000001 002 CCCCC
000002 000 KKKKK
000003 004 GGGGG
and file B (lrecl=80,recfm=fb) contains:
COLS> ----+----1
****** **********
000001 2010-09-24
****** **********
and the output I want to find is:
COLS> ----+----1----+----2----+----3
****** **********************
000001 2010-09-24 002 CCCCC
000002 2010-09-24 000 KKKKK
000003 2010-09-24 004 GGGGG

How can I do this?. Thanks very much.

Iratxe
Back to top
View user's profile Send private message
prahalad

New User


Joined: 14 Sep 2010
Posts: 18
Location: Pune

PostPosted: Mon Sep 27, 2010 4:54 pm
Reply with quote

It seems your file B has a record which contains a date field. You want to append that date in each record in file A. For doing this you can use the following code:
Code:

//STPU080   EXEC PGM=SORT           
//SORTJNF1  DD *                   
002 CCCCC                           
000 KKKKK                           
004 GGGGG                           
//SORTJNF2  DD *                   
2010-09-24                         
//JNF1CNTL  DD *                   
  INREC OVERLAY=(81:C'1')           
//JNF2CNTL  DD *                   
   INREC OVERLAY=(81:C'1')           
//SORTOUT   DD SYSOUT=*             
//SYSIN     DD *                   
  JOINKEYS FILES=F1,FIELDS=(81,1,A),SORTED
  JOINKEYS FILES=F2,FIELDS=(81,1,A),SORTED 
  JOIN UNPAIRED,F1                   
  REFORMAT FIELDS=(F2:1,11,F1:1,80)   
  SORT FIELDS=COPY                   
//SYSOUT   DD SYSOUT=*               
Back to top
View user's profile Send private message
Iratxe

New User


Joined: 21 Feb 2006
Posts: 24

PostPosted: Mon Sep 27, 2010 5:39 pm
Reply with quote

Thanks very much. It's perfect.

Iratxe
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 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
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top