phani.mf2011
New User
Joined: 15 Apr 2011 Posts: 17 Location: india
|
|
|
|
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. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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'-'))
/*
|
|
|