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
 
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
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 4 Fri Sep 22, 2017 11:35 pm
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm

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