MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Adding the relevant fields to give the total

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
me_naveen
Beginner


Joined: 21 Dec 2007
Posts: 23
Topics: 12

PostPosted: Mon Feb 09, 2009 7:47 am    Post subject: Adding the relevant fields to give the total Reply with quote

Hi All,

I need to create an ouptut which will give the sumation of the marks for
each student as the total.

Input :
Code:

Student   Subject      Marks   
A         ENGLISH      10         
A         MATHS        10         
B         ENGLISH      20         
B         MATHS        20         
C         ENGLISH      30         
C         MATHS        30           

output:
Code:

Student   Subject      Marks    Total
A         ENGLISH      10         20
A         MATHS        10         20
B         ENGLISH      20         40
B         MATHS        20         40
C         ENGLISH      30         60
C         MATHS        30         60

Output should have student wise(here it is A,B,C) and corresponding subject(English , Maths) and student total.

Output should have all the records same as input with an additional total column displayed.

Thanks In Advance.

Thanks
Naveen.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Mon Feb 09, 2009 11:10 am    Post subject: Reply with quote

me_naveen,

The following DFSORT/ICETOOL JCl will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                             
//DFSMSG   DD SYSOUT=*                                             
//IN       DD *                                                   
A         ENGLISH      10                                         
A         MATHS        10                                         
B         ENGLISH      20                                         
B         MATHS        20                                         
C         ENGLISH      30                                         
C         MATHS        30                                         
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)         
//OUT      DD SYSOUT=*                                             
//TOOLIN   DD *                                                   
  SORT   FROM(IN) USING(CTL1)                                     
  SPLICE FROM(T1) TO(OUT) ON(1,1,CH) WITH(1,34) WITHALL USING(CTL2)
//CTL1CNTL DD *                                                   
  SORT FIELDS=(1,1,CH,A)                                           
  OUTFIL FNAMES=T1,REMOVECC,                                       
  SECTIONS=(1,1,TRAILER3=(1,1,35:TOT=(24,2,ZD,M10,LENGTH=4)))     
//CTL2CNTL DD *                                                   
  SORT FIELDS=(1,1,CH,A,35,4,CH,D)                                 
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group