IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SORT - Sum of Group records and ratio on group


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top