IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File processing with Maximun count as a field


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Wed Dec 01, 2010 9:17 pm
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
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: 6966
Location: porcelain throne

PostPosted: Thu Dec 02, 2010 8:24 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top