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

Combining Records Based on a Key Field


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

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Mar 26, 2008 8:29 pm
Reply with quote

I have two files:

FILE1
Code:

----+----1----+----2----+----3----+----4
AB1234  XXXXXXXXXX    00035
CD5678  XXXXXXXXXX    00012
EF9012  XXXXXXXXXX    00006


FILE2
Code:

----+----1----+----2----+----3----+----4
AB1234  YYYYYYYYYYY
AB1234  YYYYYYYYYYY
AB1234  YYYYYYYYYYY
AB1234  YYYYYYYYYYY
AB1234  YYYYYYYYYYY
CD5678  YYYYYYYYYYY
CD5678  YYYYYYYYYYY
CD5678  YYYYYYYYYYY
EF9012  YYYYYYYYYYY
EF9012  YYYYYYYYYYY
EF9012  YYYYYYYYYYY
EF9012  YYYYYYYYYYY
EF9012  YYYYYYYYYYY


Based on the USERID in positions 1-6 in each record of FILE1, I want to copy the count to the same position of matching records of FILE2 without retaining any of the records from FILE1.

Output file should look like
Code:

----+----1----+----2----+----3----+----4
AB1234  YYYYYYYYYYY   00035
AB1234  YYYYYYYYYYY   00035
AB1234  YYYYYYYYYYY   00035
AB1234  YYYYYYYYYYY   00035
AB1234  YYYYYYYYYYY   00035
CD5678  YYYYYYYYYYY   00012
CD5678  YYYYYYYYYYY   00012
CD5678  YYYYYYYYYYY   00012
EF9012  YYYYYYYYYYY   00006
EF9012  YYYYYYYYYYY   00006
EF9012  YYYYYYYYYYY   00006
EF9012  YYYYYYYYYYY   00006
EF9012  YYYYYYYYYYY   00006
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 26, 2008 8:55 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//CON DD DSN=...  input file1 (FB/40)
//    DD DSN=...  input file2 (FB/40)
//OUT DD DSN=...  output file (FB/40)
//TOOLIN DD *
SPLICE FROM(CON) TO(OUT) ON(1,6,CH) -
  WITHALL WITH(1,6) WITH(9,11)
/*
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Mar 26, 2008 9:24 pm
Reply with quote

The solution worked great!

I always thought that SORT/ICEMAN/ICETOOL were all the same programs, just aliases of each other. I have found this is not the case.
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 26, 2008 9:30 pm
Reply with quote

SORT and ICEMAN are aliases of the DFSORT program. ICETOOL is a separate program shipped with DFSORT.
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 only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top