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
 

 

Concatenate 2 different VB files to a new VB file

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

New User


Joined: 11 Mar 2015
Posts: 7
Location: USA

PostPosted: Sat Oct 10, 2015 2:12 am    Post subject: Concatenate 2 different VB files to a new VB file
Reply with quote

Hi,

I have a requirement to concatenate 2 files based on account number field. The position of the account number field in each of the input file is different. Please find the file 1 and file 2 format and the output that am expecting. Please let me know how can this be achieved thru sort ?

Input File 1 - Variable block say of length 50. Account number position is 15 of size 5.

Code:

----+----1----+----2----+----3----+----4----+-
***************************** Top of Data ****
ABCDEFGH       11223     BANGALORE           
XXXXXXXX       11345     CHENNAI             
TTTTTTTT       11700     MYSORE               
YYYYYYYYYY     12000     USA                 
ZZZZZZZZZ      13000     CANADA               
             
**************************** Bottom of Data **



Input File 2 - Variable block say of length 30. Account number position is 1 of size 5.

Code:

----+----1----+----2----+-                   
***************************** Top of Data ***
11223     CHINA                             
11345     BANGLADESH                         
11700     AUSTRALIA                         
12000     JAPAN                             
13000     WENTZVILLE                         
**************************** Bottom of Data *


Expected Output:


Code:

ABCDEFGH       11223     BANGALORE                             
11223     CHINA                                                 
XXXXXXXX       11345     CHENNAI                               
11345     BANGLADESH                                           
TTTTTTTT       11700     MYSORE                                 
11700     AUSTRALIA                                             
YYYYYYYYYY     12000     USA                                   
12000     JAPAN                                                 
ZZZZZZZZZ      13000     CANADA                                 
13000     WENTZVILLE                                           
           
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1846
Location: UK

PostPosted: Sat Oct 10, 2015 2:25 am    Post subject:
Reply with quote

Will there always be one record for each account on each file. Are the files in account number sequence?
Back to top
View user's profile Send private message
santhosh5983

New User


Joined: 11 Mar 2015
Posts: 7
Location: USA

PostPosted: Sat Oct 10, 2015 2:36 am    Post subject: Reply to: Concatenate 2 different VB files to a new VB file
Reply with quote

Yes the files will be sorted on account number. And yes both the files will have one record for every account number.

As part of error handling, it will be great if we can push the records that does not have the corresponding matching record to a different/separate file.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Sat Oct 10, 2015 2:40 am    Post subject:
Reply with quote

I see the file is already sorted by account number so all you need to do is add sequence number to each file and then sort based on that.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Sat Oct 10, 2015 3:13 am    Post subject:
Reply with quote

I got disconnected so couldn't edit my post.
So to continue, may be use a join key on account number or the sequence number as told above and reformat them together and then resize based on record length, Not sure if that works but try.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Oct 10, 2015 4:10 am    Post subject: Reply to: Concatenate 2 different VB files to a new VB file
Reply with quote

JOINKEYS on the account number.

Variable-length REFORMAT record, although one of the records (better the short one) need to be padded to fixed-length in the REFORMAT. Also specify the match-marker. JOIN UNMATCHED,F1,F2. There OUTFILs, one for matched, one for unmatched F1, one for unmatched F2.

On your match, BUILD, using the slash operator (/) to create two records from one OUTFIL input. Use VLTRIM to make the records variable again, being careful of what values may be in the final field on each record (you don't want to lose necessary trailing blanks).
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Mon Oct 12, 2015 8:36 pm    Post subject:
Reply with quote

Bill, Can we use resize(ICETOOL) as below as a alternative to '/'? any downsides?
e.g.Vb is not considered for this example.

Code:
//TOOLIN DD *                         
   COPY JKFROM     TO(OUT1) USING(CTL2)
   RESIZE FROM(OUT1) TO(OUT2) TOLEN(50)
//CTL2CNTL DD *                       
   JOINKEYS F1=IN1,FIELDS=(16,5,A)     
   JOINKEYS F2=IN2,FIELDS=(1,5,A)     
   JOIN UNPAIRED                       
   OPTION COPY                         
   REFORMAT FIELDS=(F1:1,50,F2:1,30)   
/*   
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Mon Oct 12, 2015 9:41 pm    Post subject: Reply to: Concatenate 2 different VB files to a new VB file
Reply with quote

RESIZE is for fixed-length records only.

With the COPY already being a JOINKEYS, the RESIZE would add a second pass of the data.

You could make a fixed-length REFORMAT record, and then RESIZE, but you still have the extra pass.

ICETOOL's COPY and SORT can use JKFROM. RESIZE cannot. Can't avoid the two passes.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Tue Oct 13, 2015 3:00 am    Post subject:
Reply with quote

Thanks Bill.
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 Match two files using multiple keys a... santoshks1987 SYNCSORT 10 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
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


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