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
 

 

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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts what is meaning of the number in dcl Martylin PL/I & Assembler 2 Thu Mar 09, 2017 7:18 am
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


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