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

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


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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Fri Jul 13, 2012 4:45 pm
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
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: 2455
Location: Hampshire, UK

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

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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 13, 2012 8:16 pm
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Jul 18, 2012 5:01 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top