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: 75
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am


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