View previous topic :: View next topic
|
Author |
Message |
Mani453
New User
Joined: 19 Nov 2015 Posts: 13 Location: INDIA
|
|
|
|
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 |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Mani453
New User
Joined: 19 Nov 2015 Posts: 13 Location: INDIA
|
|
|
|
Thanks all for your suggestions. |
|
Back to top |
|
|
jerryte
Active User
Joined: 29 Oct 2010 Posts: 202 Location: Toronto, ON, Canada
|
|
|
|
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 |
|
|
|