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
 

 

Pick a record from a file based on timestamp

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

New User


Joined: 19 Nov 2015
Posts: 12
Location: INDIA

PostPosted: Thu Jan 07, 2016 6:18 am    Post subject: Pick a record from a file based on timestamp
Reply with quote

Hi

In my requirement I am facing one condition difficulty.

My requirement is from multiple duplicate record it should pic latest record based on timestamp.

Example
In the below input I have 5 records, three records are same but timestamp differ and two records are completely different. In that three records I need to pic a record which has latest timestamp. Observe the following output.

Can anyone suggest using Cobol or JCL.
Input
456&67 520 vshjsjw 2012-10-01.098908
456&67 520 vshjsjw 2012-10-01.102122
456&67 520 vshjsjw 2012-10-01.112321
456&43 530 vshjsjw 2013-10-01.098908
456&54 540 vshjsjw 2014-10-01.098908

Output
456&67 520 vshjsjw 2012-10-01.112321
456&43 530 vshjsjw 2013-10-01.098908
456&54 540 vshjsjw 2014-10-01.098908

Thanks in advance
Mani
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 375
Location: USA

PostPosted: Thu Jan 07, 2016 7:08 am    Post subject: Reply to: pic a file based on timestamp
Reply with quote

Quote:
Can anyone suggest using Cobol or JCL.

Are you again asking the same thing icon_evil.gif : http://ibmmainframes.com/viewtopic.php?p=333018&highlight=#333018

.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8086
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 07, 2016 9:21 am    Post subject:
Reply with quote

Quote:
Can anyone suggest using Cobol or JCL.
1. It cannot be done in JCL. JCL only allocates resources and executes programs -- so you cannot write a JCL to pick records -- PERIOD.

2. Write a COBOL program. Seriously, if you do not understand the IF statement in COBOL and how to use it to simply and easily resolve your problem, you belong on The Beginner's and Students Forum, not on this forum which is for experts and people with mainframe experience. The question you asked in your post today is a beginner's question. You most likely will not get a lot of help on this forum for your question as those people who respond understand that you don't know COBOL and hence any help provided isn't likely to do much good without a LOT of follow up.

3. Terminology is critical in IT where similar terms may mean very different things. Your topic title and post statements use the term "pic" -- which is an abbreviation in a COBOL program for PICTURE -- yet the context indicates that you meant "pick". When you cannot use proper English capitalization and cannot spell a four-letter word correctly, you DEFINITELY belong on the Beginner's Forum and should not be posting on this forum for quite a while. Using appropriate English rules and spelling indicates a respect for the time of the people who respond on this forum, since they don't have to spend the time figuring out what you meant and can directly proceed to answering your question.
Back to top
View user's profile Send private message
Mani453

New User


Joined: 19 Nov 2015
Posts: 12
Location: INDIA

PostPosted: Fri Jan 08, 2016 9:11 pm    Post subject: Reply to: pic a file based on timestamp
Reply with quote

Thanks all for your suggestions.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 187
Location: Toronto, ON, Canada

PostPosted: Tue Jan 19, 2016 12:47 am    Post subject:
Reply with quote

You could do a SORT of the file which includes the timestamp field and then afterwards run a COBOL program to select the record with the most recent timestamp. This is the hard way.

It would be easier to use ICETOOL SELECT statement which can be invoked using JCL. Follow the links to see samples.
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 FTP xls file from Mainfrmae kumarsatheeshc1 TSO/ISPF 5 Tue Jun 20, 2017 6:56 pm
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts XML Parse for large file muralikrishnan_new COBOL Programming 3 Mon Jun 12, 2017 12:50 pm


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