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
 

 

Join 3 files and sum

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

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Tue Jul 14, 2015 2:40 pm    Post subject: Join 3 files and sum
Reply with quote

Please help me with the SORT/ICETOOL card for the following requirement:

I have 3 files:

INFILE - A

Code:

AAA002
BBB005
CCCCC003



INFile - B

Code:

AAA000
BBB002
CCCCC004


INFile - C

Code:

AAA001
BBB001
CCCCC004


Desired Output:

Code:

AAA003
BBB008
CCCCC011


Thanks,
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jul 14, 2015 3:08 pm    Post subject: Reply to: Join 3 files and sum
Reply with quote

So it is always three or five alphabetic characters followed by three numerics?
Back to top
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Tue Jul 14, 2015 4:04 pm    Post subject: Re: Reply to: Join 3 files and sum
Reply with quote

Bill Woodger wrote:
So it is always three or five alphabetic characters followed by three numerics?


Let us consider it always 3 character followed by the count for each record.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 159
Location: Chennai

PostPosted: Tue Jul 14, 2015 4:17 pm    Post subject: Reply to: Join 3 files and sum
Reply with quote

Have the three dataset concatenated

If three and 5 characters followed by number then.
Code:
//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DISP=SHR,DSN=FILE1     
//         DD DISP=SHR,DSN=FILE2     
//         DD DISP=SHR,DSN=FILE3     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN DD *                                                 
   INREC IFTHEN=(WHEN=(4,1,SS,EQ,C'0,1,2,3,4,5,6,7,8,9'),   
         BUILD=(1,3,X'4040',4,3)),                           
         IFTHEN=(WHEN=NONE,BUILD=(1,8))                     
    SORT FIELDS=(1,5,CH,A)                                   
    SUM FIELDS=(6,3,ZD)                                     
   OUTFIL BUILD=(1,8,SQZ=(SHIFT=LEFT))                       
/*                                                           


If only 3 characters then
Code:
//SYSIN DD *
  SORT FIELDS=(1,3,CH,A)   
  SUM FIELDS=(4,3,ZD)     
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jul 14, 2015 4:33 pm    Post subject: Reply to: Join 3 files and sum
Reply with quote

For three-characters followed by a count, a simple MERGE (so instead of SORTIN you use SORTIN01, SORTIN02 and SORTIN03) with the key and a SUM, or the OUTFIL reporting features with SECTIONS and TRAILER3 using TOT/TOTAL.

Of course, if your input files are not in order (despite the sample you have shown), you can't use MERGE, you have to SORT with concatenated data as has already been suggested.
Back to top
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Tue Jul 14, 2015 5:03 pm    Post subject: Re: Reply to: Join 3 files and sum
Reply with quote

Bill Woodger wrote:
For three-characters followed by a count, a simple MERGE (so instead of SORTIN you use SORTIN01, SORTIN02 and SORTIN03) with the key and a SUM, or the OUTFIL reporting features with SECTIONS and TRAILER3 using TOT/TOTAL.

Of course, if your input files are not in order (despite the sample you have shown), you can't use MERGE, you have to SORT with concatenated data as has already been suggested.


Hi, Thanks for Input can anyone please help me for an example or a similar sort card which can be used for reference. Frank any inputs pls ??
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Jul 14, 2015 5:28 pm    Post subject: Reply to: Join 3 files and sum
Reply with quote

If you mean Frank Yaeger, he retired from IBM in May 2012, so you're more than three years late.

It's a MERGE with SUM. SUM I hope you know. MERGE is like SORT but is for multiple files which are all in the same sequence. MERGE takes those files, and creates one output file, in sequence.

If you want to look at the OUTFIL with REMOVECC,NODETAIL and SECTIONS with TRAILER3, there are examples here.
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
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 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


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