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
 

 

Sum and Avg for the records.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Thu Sep 06, 2012 1:32 pm    Post subject: Sum and Avg for the records.
Reply with quote

Hi,

the dataset contains the records in this format.

Code:


00  978
01  683
02  442
03  274
04  255
05  235
06  296
07  471
08 1034
09 1571
10 2379


my output file should be like
Code:


Sum      Avg
8618      861.8   



Kindly let me know the tools to get this
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Sep 06, 2012 1:34 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

Kindly let us know which Sort product you use and why you can't find the manual. Look at the TRAILERn functions.
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Thu Sep 06, 2012 2:20 pm    Post subject:
Reply with quote

i need the exact code to get this ouput
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Thu Sep 06, 2012 2:40 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

I agree. If your code is not exact, you can't expect it to work.

Quote:
Kindly let me know the tools to get this


To confirm the answer to your question: your Sort product can do this.

To give you a hint. Look at the TRAILER1 function. Has TOTAL and AVG.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 06, 2012 6:49 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

Early on, you need to understand that the forum works best when you post sufficient information for someone to help you (what you believe is enough often is not).

You also need to provide the answers to requests for information. We do not ask just to entertain ourselves. The information requested is used to help you.

Quote:
i need the exact code to get this ouput
Yes, you surely do. (Re-read what Bill posted). And we will help you get to the "exact code". Our intention is to let you learn rather than doing the work for you.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Sep 06, 2012 9:05 pm    Post subject:
Reply with quote

Bill has given you indication, followed by Dick... Have you tried by writing some code using the SORT (product at your shop)? Did you get some error? Or faced some issue?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Sep 06, 2012 9:21 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

Hi Anuj,

Unfortunately, this looks line another "newbie" who believes others should provide solutions so that learning is not really necessary . . . icon_sad.gif

d
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Fri Sep 07, 2012 6:53 pm    Post subject:
Reply with quote

Code:

//SYSIN    DD *                                           
     OUTFIL REMOVECC,NODETAIL,                             
            TRAILER1=((C'AVERAGE:',1:AVG=(07,03,ZD,M12))   
/*                                                         


getting sysntax error
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Sep 07, 2012 7:01 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

Can you show us the error? Can't do much otherwise.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 07, 2012 7:04 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

Quote:
getting sysntax error

it would be nice if You would tell where

Quote:
i need the exact code to get this ouput

the TS wants us to provide it icon_cool.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Sep 07, 2012 7:09 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

At a guess, remove the "1:".

You seem to have forgotten any code for the total?
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Fri Sep 07, 2012 7:27 pm    Post subject:
Reply with quote

Code:

//STEP0006 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SYSPRINT DD SYSOUT=*                               
//SORTIN   DD DISP=SHR,DSN=G1OL00AT.QPRA.AFTR.MINU   
//SORTOUT  DD DSN=G1OL00AT.QPRA.AFTR.MINU.AVG,       
//            DISP=(OLD,CATLG,DELETE),               
//            SPACE=(CYL,(10,10),RLSE),               
//            DCB=(RECFM=FB,LRECL=50,BLKSIZE=27000)   
//SYSIN    DD *                                       
       SORT FIELDS=(1,4,CH,A)                         
       OUTFIL FNAMES=SORTOUT,NODETAIL,               
       SECTIONS=(01,04,                               
       TRAILER1=(C' AVG:',AVG=(81,08,ZD,EDIT=(TT.TT)))
/*                                                   



this is my code... pls tell me where i did wrong.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 07, 2012 7:30 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

nahh icon_wink.gif

it's the m12 that sucks
and since the numbers are integers the TS will have to do some mangling

and... since I am in a very good mood here is a snippet ...

Code:
 ****** ***************************** Top of Data ******************************
 000001 //ENRICO1  JOB (ACCT#),'SORT90',NOTIFY=ENRICO,
 000002 //             CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
 000003 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 000004 //*
 000005 //ICE     EXEC PGM=SORT
 000006 //SYSPRINT  DD SYSOUT=*
 000007 //SYSOUT    DD SYSOUT=*
 000008 //*4567890123456
 000009 //SORTIN    DD *
 000010 01       1
 000011 02      12
 000012 03     123
 000013 04    1234
 000014 05   12345
 000015 06   23456
 000016 07   34567
 000017 08   45678
 000018 09   56789
 000019 10   67890
 000020 //SORTOUT   DD SYSOUT=*
 000021 //SYSIN     DD *
 000022   OPTION COPY
 000023   INREC OVERLAY=(81:3,8,UFF,MUL,+100,M11,LENGTH=12)
 000024   OUTFIL REMOVECC,NODETAIL,
 000025          TRAILER1=('COUNT : ',COUNT=(M11,LENGTH=08),/,
 000026                    'SUM   : ',TOT=(81,12,UFF,EDIT=(TTTTTTTT.TT)),/,
 000027                    'AVG   : ',AVG=(81,12,UFF,EDIT=(TTTTTTTT.TT)))
 ****** **************************** Bottom of Data ****************************


adjust the positions and length accordingly
Back to top
View user's profile Send private message
shanth555

New User


Joined: 17 Aug 2012
Posts: 35
Location: India

PostPosted: Fri Sep 07, 2012 8:19 pm    Post subject:
Reply with quote

Thank You so Much Enrico

I would like to learn a lot from you... icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Sep 07, 2012 8:20 pm    Post subject: Reply to: Sum and Avg for the records.
Reply with quote

I am afraid You might not learn too much about sort from me icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Sep 07, 2012 8:41 pm    Post subject:
Reply with quote

Hello,

Good to hear it is working icon_smile.gif

When posting a problem like this one, you should post the JCL, control statements, and the diagnostics (including message numbers) generated by the run.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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