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 

average length of variable records ?

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


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Tue Nov 17, 2009 11:46 am    Post subject: average length of variable records ? Reply with quote

Is there a utility to compute the average length of all of the records in a variable length sequential mainframe file ? I thought I had seen one once, but can't seem to come up with one doing a search ...

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


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

PostPosted: Tue Nov 17, 2009 1:23 pm    Post subject: Reply with quote

tucrrier,

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?p=41957#41957
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Nov 17, 2009 3:25 pm    Post subject: Reply with quote

tcurrier,

Here's a very simple DFSORT job to do that:

Code:

//S1   EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD SYSOUT=*
//SYSIN  DD *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    TRAILER1=(AVG=(1,2,BI,TO=FS))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
advoss
Beginner


Joined: 23 Aug 2005
Posts: 26
Topics: 0

PostPosted: Wed Nov 18, 2009 9:48 am    Post subject: Reply with quote

Frank, I like the simplicity of your solution, but, since it calculates an integer average, it truncates the answer. Is it possible to display the answer as a decimal answer, like 119.3?
_________________
Alan Voss
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Nov 18, 2009 11:41 am    Post subject: Reply with quote

advoss,

AVG only displays an integer value, not a decimal value. If you want to display the decimal part, you have to multiply by the appropriate value (e.g. +100 for two decimal places or +1000 for three decimal places).

Use the following control cards

Code:

//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC OVERLAY=(5:(1,2,BI,SUB,+4),MUL,+100,TO=BI,LENGTH=4)
  OUTFIL REMOVECC,NODETAIL,                                 
      TRAILER1=(AVG=(5,4,BI,EDIT=(TTTTT.TT)))               
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
advoss
Beginner


Joined: 23 Aug 2005
Posts: 26
Topics: 0

PostPosted: Wed Nov 18, 2009 12:22 pm    Post subject: Reply with quote

Thank you.
_________________
Alan Voss
Back to top
View user's profile Send private message
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