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

Syncsort Combine Multiple Files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Thu Oct 28, 2010 1:26 pm
Reply with quote

Hello,

I have a requirement to merge multiple files. Each file has Detail records and 2 trialer records. I want 2 trailer records in output files with count in each trailer record to be added.

LRECl of File - 50 (FB)

Sample Input File 1 -
Code:
1111                                             
1153                                             
TOTAL NO OF RECORDS PROCESSED :         0000000002
TOTAL NO OF RECORDS REJECTED :            0000000005


Sample Input File 2 -

Code:
4517                                                   
8374                                                   
6575                                                   
TOTAL NO OF RECORDS PROCESSED :         0000000002     
TOTAL NO OF RECORDS REJECTED :          0000000004     


Output File -
Code:
1111                                               
1153                                               
4517                                               
8374                                               
6575                                               
TOTAL NO OF RECORDS PROCESSED :         0000000004
TOTAL NO OF RECORDS REJECTED :          0000000009


I have multiple files like this to be merged. Could someone pleae suggest the solution using Synchsort.
Thanks.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Oct 29, 2010 2:51 pm
Reply with quote

anshul_gugnani,

The below Syncsort job will do what you asked for. I have assumed the field positions as in your sample input.
Code:
//STEP01 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DISP=SHR,DSN= Input file-1 --> FB/50
//         DD DISP=SHR,DSN= Input file-2 --> FB/50
//SORTOUT  DD DSN= Output file --> FB/50
//SYSIN    DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(51:SEQNUM,8,ZD,10C'0')),
        IFTHEN=(WHEN=(1,5,CH,EQ,C'TOTAL'),OVERLAY=(51:8C'9',41,10))
  SORT FIELDS=(51,8,CH,A,21,8,CH,A),EQUALS
  SUM FIELDS=(59,10,ZD)
  OUTREC IFTHEN=(WHEN=(1,5,CH,EQ,C'TOTAL'),BUILD=(1,40,59,10)),
         IFOUTLEN=50
Back to top
View user's profile Send private message
anshul_gugnani

New User


Joined: 02 Nov 2009
Posts: 73
Location: Mumbai

PostPosted: Tue Nov 09, 2010 3:08 pm
Reply with quote

Hi Arun,

Thanks for the sort card. This works perfect. Sorry could not reply earlier as was away from mainframes.

Could you please explain the EQUALS in this sortcard. I read EQUALS in manual but was not very clear.

Thanks,
Anshul.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 09, 2010 9:39 pm
Reply with quote

Hello,

EQUALS tells the sort to keep records in their original order within the defined sort key(s).

If this is not specified, the order of the records within the sort key(s) is not predictable.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 11, 2010 5:18 pm
Reply with quote

anshul_gugnani wrote:
Hi Arun,

Thanks for the sort card. This works perfect. Sorry could not reply earlier as was away from mainframes.
Not a problem. Even I was away for a week. Glad that it worked for you icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top