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

Want to merge the two files in to an another file


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

New User


Joined: 27 Aug 2006
Posts: 8

PostPosted: Sun Aug 27, 2006 8:07 pm
Reply with quote

icon_eek.gif
Sir,
i have two sequential files having LRECL=80, now i want to merge the two files in to an another file... two files are merged according to the criteria that they have value in the particular fields.. i gave the below statement it is not working... what is the solution
Code:
                         
 //SORTING      EXEC     PGM=ICEMAN                                     
 //SYSOUT       DD       SYSOUT=*                                       
 //SORTIN01     DD       DSN=EDUC32.COBOL.EXT4,DISP=SHR                 
 //SORTIN02     DD       DSN=EDUC32.COBOL.EXT3,DISP=SHR                 
 //SORTOUT      DD       DSN=EDUC32.COBOL.EXT5,DISP=(MOD,CATLG),         
 //             SPACE=(TRK,(1,1)),UNIT=SYSDA,DCB=(LRECL=80,RECFM=FB,     
 //             BLKSIZE=29720)                                           
 //SYSIN        DD       *                                               
  MERGE FIELDS=(1,7,BI,A,33,7,BI,A)                                     

the fields which should have same value are specified as 1-7 in first file and 33-40 in second file.....
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Aug 28, 2006 1:04 am
Reply with quote

If you want to MERGE files, each file to be merged must already be in the order you use for the MERGE statement. For example, if you want to use:

MERGE FIELDS=(1,7,BI,A,33,7,BI,A)

then each input file to be merged must already have been sorted by 1,7,BI,A,33,7,BI,A. If the input files are not already sorted, then you would concatenate and SORT them rather than MERGE them.
Back to top
View user's profile Send private message
balaji_g_m

New User


Joined: 27 Aug 2006
Posts: 8

PostPosted: Mon Aug 28, 2006 1:45 am
Reply with quote

yes,, i understood. could u give me the syntax please
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 28, 2006 8:49 pm
Reply with quote

Quote:
could u give me the syntax please


Merge Example - records in each file must already be in sorted order - output will be in sorted order

Code:

//M1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD DSN=...  input file1
//SORTIN02 DD DSN=...  input file2
//SORTOUT  DD DSN=...  output file
//SYSIN    DD    *
  MERGE FIELDS=(1,7,BI,A,33,7,BI,A)
/*


Sort Example - records in each file can be in any order - output will be in sorted order

Code:

//S1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//       DD DSN=...  input file2
//SORTOUT  DD DSN=...  output file
//SYSIN    DD    *
  SORT FIELDS=(1,7,BI,A,33,7,BI,A)
/*


Copy Example - records in each file can be in any order - output will be in same order as input (file1, then file2)

Code:

//C1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//       DD DSN=...  input file2
//SORTOUT  DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top