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
 

 

Combining Records Based on a Key Field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Combining Records Based on a Key Field
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 Moderator


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

PostPosted: Wed Mar 26, 2008 8:55 pm    Post subject:
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    Post subject: Reply to: Combining Records Based on a Key Field
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 Moderator


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

PostPosted: Wed Mar 26, 2008 9:30 pm    Post subject:
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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