MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
me_naveen Beginner Joined: 21 Dec 2007 Posts: 23 Topics: 12
Posted: Mon Feb 09, 2009 7:47 am Post subject: Adding the relevant fields to give the total
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
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
Posted: Mon Feb 09, 2009 11:10 am Post subject:
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
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