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
 

 

SORT - Sum of Group records and ratio on group

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

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Mon Aug 02, 2010 9:00 pm    Post subject: SORT - Sum of Group records and ratio on group
Reply with quote

Hi,

My requirement is like i need to sum the group of records and find the ration of that group.


for example. Input file has the below data.

GROUP AGENT AMOUNT
AAAA agent1 100
BBBB agent2 200
AAAA agent3 300
BBBB agent4 400
AAAA agent5 500
BBBB agent6 600


And, I want this in the output file1 as

GROUP AGENT AMOUNT RATIO
AAAA agent1 100
BBBB agent2 200
AAAA agent3 300
BBBB agent4 400
AAAA agent5 500
BBBB agent6 600

Where RATIO = GROUP TOTAL / Agent Amount

for group AAAA = 900 / Agent1 Amount 100 = RATIO of agent1
for group BBBB = 1200 / Agent2 Amount 200 = RATIO of agent2
like thi.


and in the output file2 should be as below

GROUP AMOUNT
AAAA 900
BBBB 1200


Can anybody give me suggessions on this or sort cards. or for the first task do i need to write cobol program. please let me know.

Thanks
G C Chowdary
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Mon Aug 02, 2010 10:15 pm    Post subject: Reply to: SORT - Sum of Group records and ratio on group
Reply with quote

gcchowdary,

Use the same file for SORTJNF1 and SORTJNF2 and the following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                                           
//SYSOUT   DD SYSOUT=*                                             
//SORTJNF1 DD *                                                   
AAAA AGENT1 100                                                   
BBBB AGENT2 200                                                   
AAAA AGENT3 300                                                   
BBBB AGENT4 400                                                   
AAAA AGENT5 500                                                   
BBBB AGENT6 600                                                   
//SORTJNF2 DD *                                                   
AAAA AGENT1 100                                                   
BBBB AGENT2 200                                                   
AAAA AGENT3 300                                                   
BBBB AGENT4 400                                                   
AAAA AGENT5 500                                                   
BBBB AGENT6 600                                                   
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  JOINKEYS FILES=F1,FIELDS=(1,4,A)                                 
  JOINKEYS FILES=F2,FIELDS=(1,4,A)                                 
  JOIN UNPAIRED                                                   
  REFORMAT FIELDS=(F1:1,80,F2:81,8)                               
  OUTFIL FNAMES=OUT1,BUILD=(1,17,81,8,ZD,DIV,13,3,ZD,M11,LENGTH=5)
  OUTFIL FNAMES=OUT2,REMOVECC,NODETAIL,BUILD=(13X),               
  SECTIONS=(1,4,TRAILER3=(1,4,X,81,8))                             
//JNF2CNTL DD *                                                   
  INREC OVERLAY=(81:5C'0',13,3)                                   
  SUM FIELDS=(81,8,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 SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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