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
 

 

Syncsort Combine Multiple Files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Syncsort Combine Multiple Files
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: 2284
Location: @my desk

PostPosted: Fri Oct 29, 2010 2:51 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Nov 09, 2010 9:39 pm    Post subject:
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: 2284
Location: @my desk

PostPosted: Thu Nov 11, 2010 5:18 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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