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
 

 

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: 6968
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: 6968
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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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