Page 1 of 1

Rg: how to sumup in jcl?

PostPosted: Tue Dec 11, 2012 10:51 am
by kandrepavan
Hi all,

i want to sum the values of the following data.
Data format is HTNNO mark1 mark2
//TCHN635$ JOB MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B,
// REGION=5M,NOTIFY=&SYSUID,TIME=(5,0)
//STEP01 EXEC PGM=SORT
//SORTIN DD *
12346 34 35
12347 34 35
12348 34 35
12349 34 35
/*
//sortout dd sysout=*
//sysprint dd sysout=*

i need the output as , output data format :
htno m1 m2 total
12346 34 35 69
12347 34 35 69
12348 34 35 69
12349 34 35 69

and one more question is how to know which version of sort we are using ?

Re: Rg: how to sumup in jcl?

PostPosted: Tue Dec 11, 2012 1:20 pm
by enrico-sorichetti
use the code tags to make Your JCL/DATA more readable
it' s a due courtesy to the people willing to spend time helping You

without code tags is what You posted

with the code tags
//TCHN635$ JOB MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B,
// REGION=5M,NOTIFY=&SYSUID,TIME=(5,0)
//STEP01 EXEC PGM=SORT
//SORTIN DD *
12346 34 35
12347 34 35
12348 34 35
12349 34 35
/*
//sortout dd sysout=*
//sysprint dd sysout=*


htno m1 m2 total
12346 34 35 69
12347 34 35 69
12348 34 35 69
12349 34 35 69
 


if You click on the
DFSORT/ICETOOL/ICEGENER link at the top of the page
dfsort-icetool-icegener/

the second topic will tell all about the DFSORT levels and relative services

Re: Rg: how to sumup in jcl?

PostPosted: Tue Dec 11, 2012 2:24 pm
by NicC
Why JCL in the title? JCL cannot 'sumup'. You have posted in the DFSORT part of the forum so I presume you want DFSORT to do the summing up. You will, probably, use JCL to run the DFSORT process but it has nothing to do with your problem.

Re: Rg: how to sumup in jcl?

PostPosted: Tue Dec 11, 2012 4:41 pm
by BillyBoyo
If you want to add fields on a record, look at your documentation for ADD and the other mathematical things available.

Re: Rg: how to sumup in jcl?

PostPosted: Tue Dec 11, 2012 11:10 pm
by skolusu
kandrepavan,

Use the following DFSORT JCL which will give you the desired results
//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                   
----+----1----+----2----+----3----+----4----+----5-
12346 34 35                                       
12347 34 35                                       
12348 34 35                                       
12349 34 35                                       
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  INREC OVERLAY=(13:7,2,ZD,ADD,10,2,ZD,EDIT=(IIT))
//*


The output from this job is
12346 34 35  69
12347 34 35  69
12348 34 35  69
12349 34 35  69