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
 
File processing with Maximun count as a field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
dharmendra.rawat84

New User


Joined: 26 Oct 2010
Posts: 1
Location: Hyderabad

PostPosted: Wed Dec 01, 2010 8:59 pm    Post subject: File processing with Maximun count as a field
Reply with quote

Hi,

I have a file having records like this mentioned below.

SYS-ID PROV-ID COUNT

111111 3333333 10
111111 4444444 20
111111 5555555 15
222222 6666666 10
222222 7777777 20
222222 8888888 15

I have a requirement like I want the out file to be as below.
I want the records in output file that has max count.

SYS-ID PROV-ID COUNT

111111 4444444 20
222222 7777777 20

Please give me some suggestions...

Regards,

Dharam
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Wed Dec 01, 2010 9:17 pm    Post subject:
Reply with quote

if you know what the value of the max-count is, no problem
otherwise, sort the file prior to reading (max-count Desc).
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Dec 02, 2010 7:13 pm    Post subject:
Reply with quote

Or to put it more complete:

Sort on keys ASCENDING SYS-ID PROV-ID, DESCENDING COUNT and subsequently process the first record in each break of the key SYS-ID PROV-ID, and discard the rest.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu Dec 02, 2010 8:24 pm    Post subject:
Reply with quote

actually, you definition of the problem is confusing.

what are the actual control breaks?

is the highest count the highest of the file?
will every sys-id have a record (regardless of prov-id)
that contains this high-count.
or do you want the sys-id/prov-id/count for every sys-id?
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts To remove spaces from a VB file using... Selvarajars DFSORT/ICETOOL 5 Thu Jun 21, 2018 6:57 pm
No new posts B059 PREMATURE END OF FILE mvmadhuvenkatesh CA Products 5 Tue Jun 19, 2018 10:50 am
No new posts Formating output file Niki DFSORT/ICETOOL 3 Fri Jun 15, 2018 3:27 pm
No new posts Need help on TDQ load from file using... subratarec CICS 4 Wed Jun 13, 2018 11:32 pm
No new posts How to Count a particular record in a... Mounika Nemani DFSORT/ICETOOL 5 Tue May 29, 2018 1:07 pm

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