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
 

 

Max timestamp in a file thru cobol

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

New User


Joined: 30 Apr 2010
Posts: 11
Location: USA

PostPosted: Tue Jul 27, 2010 8:55 pm    Post subject: Max timestamp in a file thru cobol
Reply with quote

Hi,

I have a similar requirement like the one Ambili has mentioned.. but i need to get this in cobol. is it possible to get the max value present in a file thru cobol? the data is not in sorted order.

I think I need to post my question under cobol and not here, but since the i have the same requirement, I m just putting the question here.

Thanks
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: Tue Jul 27, 2010 9:13 pm    Post subject:
Reply with quote

Hello,

http://ibmmainframes.com/viewtopic.php?t=41259
Quote:
I think I need to post my question under cobol and not here, but since the i have the same requirement, I m just putting the question here.


Yes, your topic has been split/moved.

Quote:
is it possible to get the max value present in a file thru cobol? the data is not in sorted order.
Sure. You can make 2 passes of the data (one to idenfity the max and one to get all of the records of the same bank).
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 28, 2010 12:04 am    Post subject:
Reply with quote

Arch wrote:
Hi,

I have a similar requirement like the one Ambili has mentioned.. but i need to get this in cobol. is it possible to get the max value present in a file thru cobol? the data is not in sorted order.

I think I need to post my question under cobol and not here, but since the i have the same requirement, I m just putting the question here.

Thanks


You don't expect us to write the COBOL program do you?
Back to top
View user's profile Send private message
Arch

New User


Joined: 30 Apr 2010
Posts: 11
Location: USA

PostPosted: Wed Jul 28, 2010 12:07 am    Post subject:
Reply with quote

of course, I am not expecting any one to write cobol program for me. I know I need to write my program. I was just expecting to know whether it is possible to use max function in cobol or not.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 28, 2010 12:25 am    Post subject:
Reply with quote

Arch wrote:
of course, I am not expecting any one to write cobol program for me. I know I need to write my program. I was just expecting to know whether it is possible to use max function in cobol or not.


The question is WHY do you need the max function in COBOL? It is a simple check as you read the records one by one.

1. Define a Working storage variable for WS-TSTAMP and initialize it with spaces.
2. Read the record and now compare the file Timestamp to WS-TSTAMP
3. If file timestamp is Greater than just move the file-timestamp to WS-TSTAMP
4. Repeat steps 2 and 3 till the end of the file.

btw just for the record, if you still want to use the max function , then you can , all you need to do is load up the entire file records into a working storage table and then use the MAX function.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jul 28, 2010 12:41 am    Post subject:
Reply with quote

Is this hopeful thinking?

Occupation: software engineer
Mainframe Skills: cobol,jcl,db2,vsam
Back to top
View user's profile Send private message
Arch

New User


Joined: 30 Apr 2010
Posts: 11
Location: USA

PostPosted: Wed Jul 28, 2010 12:45 am    Post subject:
Reply with quote

sorry, forgot to mention that there will be atleast 80-100 million records in my file. So this comparison might take real long time.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 28, 2010 12:50 am    Post subject:
Reply with quote

Arch wrote:
sorry, forgot to mention that there will be atleast 80-100 million records in my file. So this comparison might take real long time.


huh? It is a simple IF clause to compare the timestamp and you think it takes a real long time? The only time you would be wasting is the mount time of the tape ( Assuming that your input is on multi volume tape) and it wouldn't considered as CPU time.

And a cobol program in this case is much more efficient than a sort solution where you have to pass thru the data twice to get the desired results
Back to top
View user's profile Send private message
Arch

New User


Joined: 30 Apr 2010
Posts: 11
Location: USA

PostPosted: Wed Jul 28, 2010 12:55 am    Post subject:
Reply with quote

ok.. I will try to implement this comparison logic. Thanks for the answers..
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: Wed Jul 28, 2010 2:37 am    Post subject:
Reply with quote

Hello,

Quote:
I have a similar requirement like the one Ambili has mentioned..
I believe you need to explain exactly what this requirement is.

Among us, we have different perceptions of what is really needed.

The topic from which this was split is considerably more than finding a "max".

Show some sample input and the output you want from your program.
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. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm


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