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
 

 

Totalling the amount with certain condition through SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
maxsubrat

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Fri Mar 05, 2010 11:09 am    Post subject: Totalling the amount with certain condition through SORT
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    Post subject: Reply to: Totalling the amount with certain condition throug
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


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