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: 1714
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: 1609
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: 1609
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: 7228

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: 1609
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: 7228

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: 1609
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 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 File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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