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
 

 

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 Why TS/OP would Not contact site supp... RahulG31 All Other Mainframe Topics 2 Wed Mar 22, 2017 7:46 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm


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