IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

MAX,MIN,AVG of column


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
phani.mf2011

New User


Joined: 15 Apr 2011
Posts: 17
Location: india

PostPosted: Thu Aug 25, 2011 11:04 pm
Reply with quote

HI All,

I want to find the MAX, MIN and AVG of a column. The file structure is given below

Code:
20110922ATQ0034
20101010WAT0001
20110203SQA0003
20110921ATQ0001
20110323WAT0022


MAximum should be found for column 12-15

Output should be like

MAX of Record Type ATQ is:0034
MIN of Record Type ATQ is:0001
----------
------
same for the others.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 25, 2011 11:29 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT                                         
//SYSOUT DD SYSOUT=*                                       
//SORTIN DD *                                               
20110922ATQ0034                                             
20101010WAT0001                                             
20110203SQA0003                                             
20110921ATQ0001                                             
20110323WAT0022                                             
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
  SORT FIELDS=(9,3,CH,A)                                   
  OUTFIL REMOVECC,NODETAIL,                                 
    SECTIONS=(9,3,                                         
      TRAILER3=('MAX of record type ',9,3,' is: ',         
        MAX=(12,4,ZD,TO=ZD),/,                             
      'MIN of record type ',9,3,' is: ',                   
        MIN=(12,4,ZD,TO=ZD),/,                             
      'AVG of record type ',9,3,' is: ',                   
        AVG=(12,4,ZD,TO=ZD),/,10'-'))                       
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts first column truncated in search result IBM Tools 13
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
No new posts Infosphere Optim - unable to save Col... IBM Tools 0
Search our Forums:

Back to Top