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
 

 

Match two recs of same file and append it to first rec

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1738
Location: NY,USA

PostPosted: Fri Jul 13, 2012 4:45 pm    Post subject: Match two recs of same file and append it to first rec
Reply with quote

Input file:

Code:
format:wed2341236...&^ABC
Accountno:123456789

format:wed2241236...&^ABC
Accountno:123456735

format:wed2345236...&^ABC
Accountno:1234676457


Output file:

Code:
wed2341236...&^ABC123456789
wed2241236...&^ABC123456735
wed2345236...&^ABC1234676457


I am thinking of sepearing the input file into two files and adding seq number to every record of bothe the file

File1:

Code:
wed2341236...&^ABC001


File2:

Code:
123456789001

Based on join on last 3 positions I will pick the account number from second file and append to the first file record.


I am sure there could be some other way to do this, could you please guide on this.
Back to top
View user's profile Send private message

Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Fri Jul 13, 2012 5:00 pm    Post subject:
Reply with quote

You can use 'format' and 'Accountno'. Use WHEN=GROUP and PUSH the records. Finally you can OMIT what you don't want.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1826
Location: UK

PostPosted: Fri Jul 13, 2012 8:11 pm    Post subject:
Reply with quote

Possibly you can use RESIZE.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Jul 13, 2012 8:16 pm    Post subject: Reply to: Match two recs of same file and append it to first
Reply with quote

That's Naish's line. Nic :-)

If your records are in groups of three, you can use that on the GROUP which Naish has suggested.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 13, 2012 9:58 pm    Post subject:
Reply with quote

Use the following DFSORT JCL
Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6-
FORMAT:WED2341236...&^ABC                                   
ACCOUNTNO:123456789                                         
FORMAT:WED2241236...&^ABC                                   
ACCOUNTNO:123456735                                         
FORMAT:WED2345236...&^ABC                                   
ACCOUNTNO:1234676457                                         
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'FORMAT'),     
  PUSH=(81:8,18),RECORDS=2)                                 
  OUTFIL INCLUDE=(1,7,CH,EQ,C'ACCOUNTNO'),BUILD=(81,18,11,10)
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1738
Location: NY,USA

PostPosted: Wed Jul 18, 2012 5:01 pm    Post subject:
Reply with quote

Thanks All.
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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