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 two files with different number of records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Join two files with different number of records
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    Post subject:
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    Post subject: Reply to: Join two files with different number of records
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    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am

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