Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
DFSORT - Find the sum for the group

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

New User


Joined: 10 Jun 2008
Posts: 24
Location: india

PostPosted: Tue Feb 07, 2012 11:12 pm    Post subject: DFSORT - Find the sum for the group
Reply with quote

Hello... I have a requirement and I am seeing if we can do that through DFSORT option. I tried using SORT but wasn't able to arrive at the output.

Requirement is as follows,
Input file:

Code:
XXXX  02
YYYYY 01
ZZZZ 06
XXXX 01
ZZZZ 02


Expected output:
Code:
XXXX 02 03
YYYY 01 01
ZZZZ 06 08
XXXX 01 03
ZZZZ 02 08


Here from the requirement, you could see that the sum of a group is being listed at the end of each record. For XXXX, there are 2 records summing up to 03. The o/p to be written as XXXX 02 03 and XXXX 01 03.

Can you please let me know if it's possible and if so, share some samples or the code for the requirement.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Feb 07, 2012 11:31 pm    Post subject: Reply to: DFSORT - Find the sum for the group
Reply with quote

pravinj,

Use the following DFSORT JCL which will give you the desired results. I assumed that your input is FB and LRECL=80

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//INA      DD *                               
XXXX 02                                       
YYYY 01                                       
ZZZZ 06                                       
XXXX 01                                       
ZZZZ 02                                       
//INB      DD *                               
XXXX 02                                       
YYYY 01                                       
ZZZZ 06                                       
XXXX 01                                       
ZZZZ 02                                       
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  JOINKEYS F1=INA,FIELDS=(1,4,A)             
  JOINKEYS F2=INB,FIELDS=(1,4,A)             
  JOIN UNPAIRED                               
  REFORMAT FIELDS=(F1:1,8,F2:6,2,F1:11,78)   
  SORT FIELDS=(81,8,CH,A)                     
  OUTREC BUILD=(1,80)                         
//*                                           
//JNF1CNTL DD *                               
  INREC OVERLAY=(81:SEQNUM,8,ZD)             
//*                                           
//JNF2CNTL DD *                               
  SUM FIELDS=(6,2,ZD)                         
//*
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 Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Need urgent suggestion on DFSORT subratarec DFSORT/ICETOOL 6 Wed Mar 21, 2018 8:46 pm
No new posts Group changes and numbering the groups Auryn DB2 2 Tue Mar 20, 2018 7:12 pm
No new posts How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm
No new posts Find a string in PS file opened in br... mukkas CLIST & REXX 3 Sat Feb 24, 2018 2:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us