Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts LMINIT problem - not finding DDNAME Danielle.Filteau CLIST & REXX 7 Tue Sep 19, 2017 9:57 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us