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

Combining files with DFSORT


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

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Wed Mar 12, 2008 9:40 pm
Reply with quote

I have 2 files to be combined.

File 1 has the following information:
Cust-no loaninfo
There could be more than 1 record for each customer

File 2 has the following information:
Cust-no street-no city
In this file a customer has only 1 record.
*** Note: Few customers in File 1 may not have records in File 2.

After merging, every record in file 1 should have information from file 2, if available.

e.g.

File 1:
Cust-no1 loaninfo1
Cust-no1 loaninfo2
Cust-no2 loaninfo1
Cust-no3 loaninfo1
Cust-no3 loaninfo2
Cust-no3 loaninfo3
Cust-no3 loaninfo4


File 2:
Cust-no1 street-no1 city1
Cust-no3 street-no3 city3


After merging:
Cust-no1 loaninfo1 street-no1 city1
Cust-no1 loaninfo2 street-no1 city1
Cust-no2 loaninfo1
Cust-no3 loaninfo1 street-no3 city3
Cust-no3 loaninfo2 street-no3 city3
Cust-no3 loaninfo3 street-no3 city3
Cust-no3 loaninfo4 street-no3 city3

Thanks & Regards,
OP
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 12, 2008 10:28 pm
Reply with quote

You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD *
Cust-no1  loaninfo1
Cust-no1  loaninfo2
Cust-no2  loaninfo1
Cust-no3  loaninfo1
Cust-no3  loaninfo2
Cust-no3  loaninfo3
Cust-no3  loaninfo4
/*
//IN2 DD *
Cust-no1  street-no1  city1
Cust-no3  street-no3  city3
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,8,CH) KEEPNODUPS -
  WITHALL WITH(1,19)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,8,22:11,17)
/*
//CTL2CNTL DD *
  INREC OVERLAY=(38:X)
/*
Back to top
View user's profile Send private message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Thu Mar 13, 2008 12:31 am
Reply with quote

Hi Frank,

Thanks a lot.
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 Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top