MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Merging of files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
arunkumar_e
Beginner


Joined: 06 May 2004
Posts: 27
Topics: 16
Location: Bangalore

PostPosted: Tue Jul 27, 2004 7:39 am    Post subject: Merging of files Reply with quote

Hi All,
I have 3 files say File A, File B & File C each of length 80
Code:

File A:
----+----1----+----2----+----3----+----4--
************************** Top of D
    1      19553.98         BULK_DPST.......
    2      16032.63         BULK_DPST.......
    3     126888.25         BULK_DPST.......
    4      16602.51         BULK_DPST.......


Code:

File B:
----+----1----+----2----+----3----+----4--
***************************Top of D
    1       8338.83    17   DPST_ID.........
    1      11215.15    04   DPST_ID.........
    2      16032.63    04   DPST_ID.........
    3       2974.50    01   DPST_ID.........
    3     123913.75    04   DPST_ID.........
    4        189.22    08   DPST_ID.........


Code:

File C:
----+----1----+----2----+----3----+----4--
***************************Top of D
    1      19553.98   4    DPST_REMIT......
    2      16032.63   4    DPST_REMIT......
    3     123913.75   4    DPST_REMIT......
    4      16413.29   4    DPST_REMIT......
    4      16483.29   4    DPST_REMIT......



Now i want a new output file which should be a merge of these three
files namely File A, File B, File C. From each of these file i need only
records till 25 length.

The output file should look like

Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+
********************************* Top of Data ****************
    1      19553.98         1       8338.83    17      1      19553.98    4
                            1      11215.15    04
    2      16032.63         2      16032.63    04      2      16032.63    4
    3     126888.25         3       2974.50    01      3     123913.75    4
                            3     123913.75    04
    4      16602.51         4        189.22    08      4      16413.29    4
                                                       4      16483.29    4


Note here the duplicates should also be taken care, like mentioned in the output file.Can this be achieved using ICETOOL or any other utility? please let me know.

Thanks
_________________
Arun
"Genius is one percent inspiration and ninety-nine percent perspiration." -- Thomas A. Edison
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jul 27, 2004 8:04 am    Post subject: Reply with quote

Arun,
The following DFSORT/ICETOOL JCL will give you the desired results. If you have syncsort at your shop then change the pgm name to synctool.

Code:

//STEP0100 EXEC PGM=ICETOOL                   
//TOOLMSG   DD SYSOUT=*                       
//DFSMSG    DD SYSOUT=*                       
//IN1       DD *                             
    1      19553.98         BULK_DPST....... 
    2      16032.63         BULK_DPST....... 
    3     126888.25         BULK_DPST....... 
    4      16602.51         BULK_DPST....... 
//IN2       DD *                             
    1       8338.83    17   DPST_ID......... 
    1      11215.15    04   DPST_ID......... 
    2      16032.63    04   DPST_ID......... 
    3       2974.50    01   DPST_ID......... 
    3     123913.75    04   DPST_ID......... 
    4        189.22    08   DPST_ID......... 
//IN3       DD *                             
    1      19553.98   4    DPST_REMIT......   
    2      16032.63   4    DPST_REMIT......   
    3     123913.75   4    DPST_REMIT......   
    4      16413.29   4    DPST_REMIT......   
    4      16483.29   4    DPST_REMIT......   
//TOOLIN    DD *                             
  COPY FROM(IN1) USING(CTL1)                 
  COPY FROM(IN2) USING(CTL2)                 
  COPY FROM(IN3) USING(CTL3)                 
  SORT FROM(CON) USING(CTL4)                 
//T1        DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T2        DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//T3        DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE) 
//CON       DD DSN=&T1,DISP=OLD,VOL=REF=*.T1               
//          DD DSN=&T2,DISP=OLD,VOL=REF=*.T2               
//          DD DSN=&T3,DISP=OLD,VOL=REF=*.T3               
//OUT       DD SYSOUT=*                                     
//CTL1CNTL  DD *                                           
  OUTFIL FNAMES=T1,OUTREC=(1,25,50Z,5,1)                   
//CTL2CNTL  DD *                                           
  OUTFIL FNAMES=T2,OUTREC=(25Z,1,25,25Z,5,1)               
//CTL3CNTL  DD *                                           
  OUTFIL FNAMES=T3,OUTREC=(50Z,1,25,5,1)                   
//CTL4CNTL  DD *                                           
  OPTION EQUALS                                             
  SORT FIELDS=(76,1,CH,A)                                   
  SUM FIELDS=(26,8,34,8,42,8,50,8,58,8,66,8,74,2),FORMAT=BI
  OUTFIL FNAMES=OUT,OUTREC=(1,75)                           
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 27, 2004 10:24 am    Post subject: Reply with quote

Kolusu,

I don't see how this can work. If the SUM does NOT result in an overflow, then ALL of the records with '1' in 76 will be summed to get a single '1' record, so you won't get the second '1' record. If the SUM does overflow, then you'll get extra '1' records, but there's no way to control the overflows such that you'll necessarily get the extra records you want.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Jul 28, 2004 5:36 am    Post subject: Reply with quote

Frank,

Yes you are right. sorry arun for misleading you

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group