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

Max timestamp in a file thru cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Tue Jul 27, 2010 9:13 pm
Reply with quote

Hello,

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
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
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
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
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
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
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
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

Moderator Emeritus


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

PostPosted: Wed Jul 28, 2010 2:37 am
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 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 Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top