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
 

 

Finding out consecutive date entries & count in file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
bhavya_sha

New User


Joined: 16 Apr 2005
Posts: 33

PostPosted: Fri Nov 20, 2015 3:24 pm    Post subject: Finding out consecutive date entries & count in file
Reply with quote

I have a file with fixed RECL as below.

File has person's travel history with person code,name,place and date.

If employee's travel plan was for 3 days file has 3 entries with consecutive dates as below.

P.NO Name ST Date
0001 bms1 ny 10/12/2015
0001 bms1 ny 12/12/2015
0001 bms1 nz 11/11/2015
0001 bms1 nz 11/12/2015
0002 bms2 az 11/10/2015
0002 bms2 az 11/11/2015
0002 bms2 az 11/12/2015


Requirement is to create file having 1 entry (instead of 3 as in input file) with details of start date and end date along with number of days in that place as below.

P.NO Name ST StartDate EndDate total days
0001 bms1 ny 10/12/2015 10/12/2015 1
0001 bms1 ny 12/12/2015 12/12/2015 1
0001 bms1 nz 11/11/2015 11/12/2015 2
0001 bms2 az 11/10/2015 11/12/2015 3

Have COBOL solution but was thinking of trying out using SORT too.
Any suggestions/guidance is of great help.

Thanks & Regards
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Fri Nov 20, 2015 7:18 pm    Post subject:
Reply with quote

I think, you can do by WHEN=GROUP , KEYBEGIN, build and DATEDIFF.
Can you please explain why you have these two entries?
Code:
0001 bms1 ny 10/12/2015 10/12/2015 1
0001 bms1 ny 12/12/2015 12/12/2015 1
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Fri Nov 20, 2015 8:49 pm    Post subject:
Reply with quote

Because those are 2 one-night stays - not consecutive nights.
(10 years on the forum and the OP still has not learned how to use the code tags! Shame on him/her.)
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Fri Nov 20, 2015 9:45 pm    Post subject: Reply to: Finding out consecutive date entries & count in file
Reply with quote

You need logic more than the technique to achieve what you want.

Have a look at this: http://ibmmainframes.com/viewtopic.php?t=64423&highlight=

.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Nov 20, 2015 10:09 pm    Post subject: Reply to: Finding out consecutive date entries & count in file
Reply with quote

One problem is whether there is a limit to the number of days per key.

What is the LRECL?
Back to top
View user's profile Send private message
bhavya_sha

New User


Joined: 16 Apr 2005
Posts: 33

PostPosted: Mon Nov 23, 2015 2:19 pm    Post subject:
Reply with quote

Nic Clouston wrote:
Because those are 2 one-night stays - not consecutive nights.
(10 years on the forum and the OP still has not learned how to use the code tags! Shame on him/her.)


Of course 10 years in the forum but i posted only 10/20 times in the forum (I've not used this recently), but I refrained my self from posting any query here rather found out my self referring books/websites , you know why whenever i open your forum i can see only comments targeting for asking questions saying silly...etc..I do understand why is this happening :(...Please be aware you could be the Master as Moderator but we may not get that good exposure and time with work we get .

We come back to you with questions because we trust you as a guide/guru who is much more knowledgeable than us.

Anyways thank you all for help.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Mon Nov 23, 2015 4:48 pm    Post subject:
Reply with quote

To get the est from a forum one should visit it regularly to see what is being posted. One never knows what one will learn. As a non-CICS person I know quite a bit about CICS (and other things) because I read everything posted daily, often several times a day.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Mon Nov 23, 2015 8:27 pm    Post subject:
Reply with quote

Don't take it personally on type or levels of questions you ask as that has nothing to do with this here.
Quote:
Please be aware you could be the Master as Moderator but we may not get that good exposure and time with work we get .

I don't disagree fully but that is not the point, Please follow the code tags simple and I am sure you would also do the same when somewhere you become the moderator.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Mon Nov 23, 2015 9:07 pm    Post subject: Reply to: Finding out consecutive date entries & count in file
Reply with quote

There's a lot of things that could be said but to be relevant it would have been much better if you had replied to Bill's question

AND 'just in case', If you have already solved it then it's worth posting the solution for the benefits of others.

.
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Tue Nov 24, 2015 10:15 am    Post subject:
Reply with quote

I tried, but failed. You can just use Cobol program to do it. Much easier imo.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Nov 25, 2015 1:10 am    Post subject:
Reply with quote

Tricky one, I spent sometime and could able to do it for 2 consecutive records but for 3 or more it is complicated and hence I think Bill raised the concerned already. But "Yes" programmatic approach is easy for now to write and after to prolong for someone else than maintaining a complex SORT card where we know the requirements are changing dynamically.
Something like
Code:
Step1- Use a KEYBEGIN to GROUP them and push the date and add seq #
Step 2- Use DATEDIFF with current and pushed one ( result will be 1 or other value)
step 3- condition ( seq # in step1 = 2 and datediff in step2 = 1) build  record by adding '2' suffixed
step 4- when other build with suffixed '1'
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 -> DFSORT/ICETOOL 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