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
 

 

Merging of two files

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

New User


Joined: 28 Nov 2007
Posts: 64
Location: Chennai

PostPosted: Fri Feb 19, 2016 12:36 pm    Post subject: Merging of two files
Reply with quote

Hi All,

I am looking for some help in sort to merge two files and the results to capture in an output file.

Input File 1 : FB, 200 LRECL
Input File 2: FBA, 166 LRECL

File 1 Format:

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
XXXXX     02/16/201602/17/201602/18/2016



File 2 Format:

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
     *** (AAA)                         9,999.99       8,88.00   77,777.07 
gjb jkhkjbn jhbgjk
ghfhjgfn jhygjhbjgh hjgjh
hngjk hjvjhbb
     *** (WWW)                         999,999.99     8,888.00  777,777.77 
asdjkashdkjh lkajsdklj
asdbhkjjkl nhjklanmsd,n j
ajksdnhjkn  lkkjjl
     *** (ZZZ)                         9,999.99       8,88.00   555,777.77
asda as sf  asdad 
     *** (MMM)                         9,909.99       8,88.00   555,777.77 


The output should be as below:

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
Sample report for system
WWW 999,999.99hard core  2016021720160218values        WWW   
ZZZ   9,999.99hard code  2016021720160218values        ZZZ


Condition to create:
1) It will have the header records written in the file as "Sample report for system".
2) It will look in file-2, and pull the values from it only when the value in position 10 to 14 are either (WWW) or (ZZZ).
3) For both the scenario:first three bytes as www or zzz.
4) Starting from 5th byte, the amount field will be pulled from file 2 position 40 to 50.
5) Constant "hard core " value will be populated from 15 to 25.
6) for date it will look into the file 1. for position 26 to 33 it will use the value from 21 to 30 from file 1. In file 1 the dates are in MM/DD/YYYY but in the output file it should be in YYYYMMDD.
7) for position 34 to 41, it will use the file 1 from 31 to 40.
8) Again hard code values needs to be populated.

Can someone please help me in this regard.
Back to top
View user's profile Send private message

Lakshmi Prakash

New User


Joined: 22 Feb 2016
Posts: 5
Location: India

PostPosted: Tue Feb 23, 2016 8:06 pm    Post subject:
Reply with quote

Hello,

On the first glance I could think of this approach

1) Remove unnecessary records from File 2
2) Add some dummy keys in front of file 1 and 2
3) Use Joinkeys and concatenate both File1 and file 2
4) Now you have both file 1 and file 2 in one line, you can reformat the line in the way you desire.

Not sure if this is any other better approach.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Feb 23, 2016 8:17 pm    Post subject: Reply to: Merging of two files
Reply with quote

Lakshmi Prakash,

That approach would work, but JOINKEYS uses more resources.

Better would be a two-step approach. First step generates a DFSORT symbol/SMNAMES for the static data from the single-record file.

Then it is the INCLUDE COND=(what you want), do the necessary formatting, using the symbol where required. Use OUTFIL with REMOVECC and HEADER1 to get the heading.

Several examples here.
Back to top
View user's profile Send private message
Lakshmi Prakash

New User


Joined: 22 Feb 2016
Posts: 5
Location: India

PostPosted: Tue Feb 23, 2016 8:21 pm    Post subject: Reply to: Merging of two files
Reply with quote

I completely agree with your approach Bill, that's an efficient way.
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 Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


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