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
 

 

Sort problem in generaring the report

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

New User


Joined: 03 Jun 2008
Posts: 14
Location: chennai

PostPosted: Mon Feb 01, 2010 12:08 pm    Post subject: Sort problem in generaring the report
Reply with quote

Hi,
I have a problem in generaring the report? Can someone help me?

My input file contains 3 fields. field1=x(16), amt=pic s9(7)v99 comp-3, tran=x(4)

I/P:
field1 amt tran
xxx 50 4000
yyy 50 4001
aaa 50 4002
bbb 50 4000
ccc 50 4001
ddd 50 4004

I want to create report based upon the tran.


O/P:

field1 amt tran
xxx 50 4000
bbb 50 4000
sub tot:100 count:2

yyy 50 4001
ccc 50 4001
sub tot:100 count:2

aaa 50 4002
sub tot: 50 count:1

ddd 50 4004
sub tot: 50 count:1


grand tot:300 count:6
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Feb 02, 2010 12:27 am    Post subject:
Reply with quote

Quote:
My input file contains 3 fields. field1=x(16), amt=pic s9(7)v99 comp-3, tran=x(4)


That means your fields would actually be like this:

field1 - positions 1-16 (CH)
amt - positions 17-21 (PD)
tran - positions 22-24 (CH)

Assuming you wanted to display the PD fields as ddddddd.dd corresponding to s9(7)v99, you could use a DFSORT job like the following:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  SORT FIELDS=(22,4,CH,A)
  OUTFIL REMOVECC,
    BUILD=(1,16,17:17,5,PD,EDIT=(IIIIIIT.TT),X,22,4,80:X),
    SECTIONS=(22,4,
      TRAILER3=(7:'sub tot:',TOT=(17,5,PD,EDIT=(IIIIIIT.TT)),
       32:'count:',COUNT)),
      TRAILER1=(7:'grand tot:',TOT=(17,5,PD,EDIT=(IIIIIIT.TT)),
       32:'count:',COUNT)
/*


SORTOUT would look like this:

Code:

xxx                  50.00 4000                   
bbb                  50.00 4000                   
      sub tot:    100.00       count:       2     
yyy                  50.00 4001                   
ccc                  50.00 4001                   
      sub tot:    100.00       count:       2     
aaa                  50.00 4002                   
      sub tot:     50.00       count:       1     
ddd                  50.00 4004                   
      sub tot:     50.00       count:       1     
      grand tot:    300.00     count:       6     
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 Problem commiting to DB2 from IMS MPP Ole Soerensen IMS DB/DC 1 Wed Jul 26, 2017 5:19 pm
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


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