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
 
Tricky sort report problem

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

New User


Joined: 27 Nov 2005
Posts: 15
Location: Phoenix

PostPosted: Fri Mar 09, 2007 6:04 am    Post subject: Tricky sort report problem
Reply with quote

Hi,

I have file as following format

Code:

               Code      Age        Gender      Income      Smoker Married
Length         X(4)     X(2)          X         9(10)          X       X
Position       1-4      5-6           7         8-18          19      20       
----------------------------------------------------------------------------------
Value1         C1    1-99 or U        M        value or U      Y       Y       
Value2         C2    1-99 or U        F        value or U      N       N       
Value3         C3    1-99 or U        U        value or U      U       U 


U :- Unknown

This is one sample there would be around 1million records of this combination.

I need a report in following format

Code:

Age                    C1         C2         C3
000-017               Count      Count      Count   
018-025               Count      Count      Count      
026-035               Count      Count      Count
036-045               Count      Count      Count
046-055               Count      Count      Count
056-064               Count      Count      Count
065-099               Count      Count      Count
099-099 (unknown)     Count      Count      Count

Gender                 C1         C2         C3   
M                     Count      Count      Count   
F                     Count      Count      Count
U                     Count      Count      Count

Smoker                 C1         C2         C3   
Y                     Count      Count      Count      
N                     Count      Count      Count
U                     Count      Count      Count

Married                C1         C2         C3
Y                     Count      Count      Count      
N                     Count      Count      Count
U                     Count      Count      Count

Income                 C1         C2         C3
A = $1,000-$14,999    Count      Count      Count
B = $15,000-$24,999   Count      Count      Count
C = $25,000-$34,999   Count      Count      Count
D = $35,000-$49,999   Count      Count      Count
E = $50,000-$74,999   Count      Count      Count
F = $75,000-$99,999   Count      Count      Count
G = $100,000-$124,999 Count      Count      Count
H = $125,000-$149,999 Count      Count      Count
I = $150,000-$174,999 Count      Count      Count
J = $175,000-$199,999 Count      Count      Count
K = $200,000-$249,999 Count      Count      Count
L = $250,000 +        Count      Count      Count
U = Unknown           Count      Count      Count
Z = match not found   Count      Count      Count


Please let me know how best could this be done with Sort.

Thanks
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: Fri Mar 09, 2007 7:11 am    Post subject:
Reply with quote

Frankly, I don't think doing this with the built-in functions of sort is practical. It would take a very large number of IFTHEN statements and several passes. If it were me, I'd write an E15 exit to do it. The E15 could save each needed counter as it reads and "deletes" each record, and then after EOF, insert records for the report with the appropriate headings, values and counts.
Back to top
View user's profile Send private message
atulxp

New User


Joined: 27 Nov 2005
Posts: 15
Location: Phoenix

PostPosted: Fri Mar 09, 2007 7:34 am    Post subject:
Reply with quote

Hi Frant Could you please elaborate some more on this.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Mar 09, 2007 9:44 am    Post subject:
Reply with quote

Hello,

This could best be done not using sort.

You seem to wish to avoid writing code. If you find a way to do this with sort using an exit, you will still write code. What happens if the requirement definition expands beyond your ability to support it with sort/exit? Then what could be a simple modification becomes a crash effort to implement the more sophisticated code.

If you were to define a few arrays and increment the counts in them as you read the file, you are looking at a very small programming effort. If you write the program you will pass the million records once. If you read the file and increment the appropriate counters for each record, you don't even have to have the records in any particular sequence.
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: Fri Mar 09, 2007 8:47 pm    Post subject:
Reply with quote

Quote:
Hi Frant Could you please elaborate some more on this.


Elaborate on what? E15 exits? See:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/4.0?DT=20060615185603

Quote:
If you were to define a few arrays and increment the counts in them as you read the file, you are looking at a very small programming effort. If you write the program you will pass the million records once. If you read the file and increment the appropriate counters for each record, you don't even have to have the records in any particular sequence.


That's essentially what you'd do in the E15 exit, except that DFSORT COPY would read the records and pass them to the E15 exit for further processing. I'm not saying that writing a "program" is necessarily better or worse than writing an E15 exit for this particular task - just that the approach would be similar.
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 Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Having a problem FTP'ng to the MF pahiker All Other Mainframe Topics 2 Fri Nov 10, 2017 8:20 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Copying part of the report using SARBCH Aedulla CA Products 1 Tue Oct 24, 2017 9:24 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

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