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

Totalling the amount with certain condition through SORT


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

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Mar 05, 2010 11:09 am
Reply with quote

Hi,
I want to SORT a file under some conditions:

I have some rows of records..
Records are 2 types .. one is header record and other is details record.

suppose i have 20 header records and 25 detail record.
for ex:
FIELD1 PIC X(1)
AMOUNT PIC S9(15) starts from 2nd position.

FIELD1 AMOUNT
H -100.00
D 200.00
H 50.00
D 10.00
D 05.00
so...on..

I want to total the AMOUNT field which has FIELD : H only..
Can someone tell me how to do that in SORT utility..
Thanks
SK
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Mar 05, 2010 10:05 pm
Reply with quote

maxsubrat,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
H -100.00                                           
D 200.00                                             
H 50.00                                             
D 10.00                                             
D 05.00                                             
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  INCLUDE COND=(1,1,CH,EQ,C'H')                     
  OUTFIL REMOVECC,NODETAIL,                         
  TRAILER1=('TOTAL OF ALL H RECORDS: ',             
            TOT=(2,15,SFF,EDIT=(IIIIIIIIIIIIT.TT))) 
//*


the output from this job is

Code:

TOTAL OF ALL H RECORDS:            50.00
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top