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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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