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: 331
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: 7905
Location: Bellevue, IA

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: 183
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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